Tools
Tools are callable functions agents use to search, read files, query data, or hit APIs. They sit beside MCPs (remote tool servers), Apps, Skills (domain instructions), and Knowledge (retrieved facts) — see official Agent Capabilities. This chapter covers crewai_tools and custom tools.
Attach tools to agents
SerperDevTool needs SERPER_API_KEY. In JSONC, "tools": ["SerperDevTool"] loads by class name; custom tools use "custom:" pointing at tools/*.py.
Built-ins (full table: Tools concepts): FileReadTool, FileWriterTool, DirectoryReadTool, *SearchTool variants (PDF / CSV / site RAG), ScrapeWebsiteTool, CodeInterpreterTool, RagTool, LlamaIndexTool, LangChainTool.
Document retrieval should follow this site’s RAG chunking and eval advice. Implement the index in LlamaIndex and wrap it with LlamaIndexTool. LangChain tools wrap via LangChainTool for a CrewAI agent.
Custom: @tool
Async functions work the same (async def under @tool). The docstring becomes the tool description — say when to use it and what arguments mean.
Custom: subclass BaseTool
You may return a Pydantic model as a typed output; agents typically see JSON fields. For business failures, prefer official ToolFailure (crewai.tools.tool_failure) over an error-looking string. tool_failure_policy (ignore / warn / raise) controls what happens next.
MCP
CrewAI can expose MCP servers as tools (crewai-tools adapters, or the MCP DSL / mcps field on agents). Transports include stdio, SSE, and Streamable HTTP. Security matches this site’s MCP tutorial: only trusted servers, least privilege. Follow official MCP pages; do not invent client APIs.
Practical notes
- Fewer tools is better: give each role only what it needs.
- Task-level
tools=[...]tightens permissions (e.g. writers cannot search the web). - Built-in caching cuts repeat external calls; tune with
cache_function. - RAG quality issues belong in the RAG tutorial (chunking / recall), not in “add another agent”.