microsoft/autogen · error · ValueError
name is required for call_tool
Error message
name is required for call_tool
What it means
Inside McpActor.call(), when type == 'call_tool' the args dict must contain a 'name' key; args.get('name') returning None triggers ValueError('name is required for call_tool'). The actor needs the tool name to route the command to the MCP server's tools/call method.
Source
Thrown at python/packages/autogen-ext/src/autogen_ext/tools/mcp/_actor.py:113
self._active = True
self._actor_task = asyncio.create_task(self._run_actor())
async def call(self, type: str, args: McpActorArgs | None = None) -> McpFuture:
if not self._active:
raise RuntimeError("MCP Actor not running, call initialize() first")
if self._actor_task and self._actor_task.done():
raise RuntimeError("MCP actor task crashed", self._actor_task.exception())
fut: asyncio.Future[McpFuture] = asyncio.Future()
if type in {"list_tools", "list_prompts", "list_resources", "list_resource_templates", "shutdown"}:
await self._command_queue.put({"type": type, "future": fut})
res = await fut
elif type in {"call_tool", "read_resource", "get_prompt"}:
if args is None:
raise ValueError(f"args is required for {type}")
name = args.get("name", None)
kwargs = args.get("kargs", {})
if type == "call_tool" and name is None:
raise ValueError("name is required for call_tool")
elif type == "read_resource":
uri = kwargs.get("uri", None)
if uri is None:
raise ValueError("uri is required for read_resource")
await self._command_queue.put({"type": type, "uri": uri, "future": fut})
elif type == "get_prompt":
if name is None:
raise ValueError("name is required for get_prompt")
prompt_args = kwargs.get("arguments", None)
await self._command_queue.put({"type": type, "name": name, "args": prompt_args, "future": fut})
else: # call_tool
await self._command_queue.put({"type": type, "name": name, "args": kwargs, "future": fut})
res = await fut
else:
raise ValueError(f"Unknown command type: {type}")
return res
async def close(self) -> None:View on GitHub (pinned to 027ecf0a37)
Solutions
- Include the tool name: args={'name': '<tool>', 'kargs': {<tool arguments>}}.
- Check spelling/case of the 'name' key — it must be exactly 'name'.
- Use the adapter/workbench layer (e.g. McpToolAdapter) which supplies the name from the discovered tool object.
Example fix
# before
await actor.call("call_tool", args={"kargs": {"query": "hello"}})
# after
await actor.call("call_tool", args={"name": "search", "kargs": {"query": "hello"}}) Defensive patterns
Strategy: validation
Validate before calling
if cmd == "call_tool" and not args.get("name"):
raise ValueError("call_tool requires args['name']") Prevention
- Build args dicts via a helper: def call_tool_args(name, **kargs): return {"name": name, "kargs": kargs}.
- Add unit tests covering the args shape for every command type you use.
When it happens
Trigger: Calling actor.call('call_tool', args={...}) where the dict has 'kargs' but no 'name', or the key is misspelled ('tool_name', 'tool').
Common situations: Building the args dict by hand and copying parameter names from MCP protocol JSON (which uses 'name' at top level but people confuse it with tool arguments); passing the tool's parameters directly instead of wrapping them under 'kargs' plus a 'name' key.
Related errors
- args is required for {type}
- name is required for get_prompt
- Failed to call MCP tool
- Invalid server URL configuration
- uri is required for read_resource
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/5fc63a9fcac9e0eb.
Report an issue: GitHub.