crewAI icon indicating copy to clipboard operation
crewAI copied to clipboard

[BUG] MCP tools with description null are dropped

Open TehilaTheStudent opened this issue 1 month ago • 1 comments

Description

MCPToolResolver skips an MCP tool when tools/list returns "description": null. The tool never reaches the agent. The only signal is an error log, then resolution continues.

MCP Tool.description is an optional string. A missing description is valid. JSON null is what FastMCP publishes when the tool function has no docstring (@mcp.tool copies __doc__). dict.get("description", "") does not replace an explicit null, so the value stays None. BaseTool.description is str, construction raises, and the tool is discarded.

Verified on crewAI 1.15.32. The same tool_def.get("description", "") path is on the current default branch. There is no flag to keep the tool.

Steps to Reproduce

  1. Serve an MCP tool whose function has no docstring, so tools/list includes "description": null (FastMCP @mcp.tool does this).
  2. Point a CrewAI agent at that server with MCPServerHTTP (native resolver, not crewai-tools).
  3. Resolve tools via MCPToolResolver._resolve_native.
  4. See Failed to create native MCP tool and an empty tool list for that server.

Relevant code in 1.15.32 lib/crewai/src/crewai/mcp/tool_resolver.py:

tool_schema = {
    "description": tool_def.get("description", ""),
    "args_schema": args_schema,
}
try:
    native_tool = MCPNativeTool(...)
    tools.append(native_tool)
except Exception as e:
    self._logger.log("error", f"Failed to create native MCP tool: {e}")
    continue

MCPNativeTool then does tool_schema.get("description", f"Tool {tool_name} from {server_name}"). That fallback also keeps None when the key is present.

Expected behavior

A tool with a null description should be registered. Treat null like an omitted description and use the fallback string MCPNativeTool already has, or surface one error for the whole server. The tool should not disappear after a caught validation error.

An empty string already passes BaseTool. Only JSON null is dropped.

Screenshots/Code snippets

BaseTool in 1.15.32:

description: str = Field(
    description="Used to tell the model how/when/why to use the tool."
)

No default. None fails validation. "" is accepted.

Operating System

Other (specify in additional context)

Python Version

3.12

crewAI Version

1.15.32

crewAI Tools Version

not used (crewai.mcp.tool_resolver / MCPNativeTool)

Virtual Environment

Venv

Evidence

Pydantic rejects description=None while building MCPNativeTool. The resolver logs Failed to create native MCP tool and continues. The agent then runs with that tool omitted. Two tools that both have description: null produce an agent with zero tools.

A tool whose description key is absent becomes "" and is kept. The same tool with "description": null is dropped.

Possible Solution

Coerce a null description to the existing fallback (Tool {name} from {server}) before constructing MCPNativeTool. dict.get does not do this for an explicit null.

Additional context

FastAPI is not involved. FastMCP is the server that emits description: null when the function has no docstring. The drop is in CrewAI. macOS, Python 3.12. Same resolver code is on the current default branch after 1.15.32.

TehilaTheStudent avatar Oct 29 '26 04:10 TehilaTheStudent

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Nov 28 '26 12:11 github-actions[bot]