{"record":{"id":"5fc63a9fcac9e0eb","repo":"microsoft/autogen","slug":"name-is-required-for-call-tool","errorCode":null,"errorMessage":"name is required for call_tool","messagePattern":"name is required for call_tool","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-ext/src/autogen_ext/tools/mcp/_actor.py","lineNumber":113,"sourceCode":"            self._active = True\n            self._actor_task = asyncio.create_task(self._run_actor())\n\n    async def call(self, type: str, args: McpActorArgs | None = None) -> McpFuture:\n        if not self._active:\n            raise RuntimeError(\"MCP Actor not running, call initialize() first\")\n        if self._actor_task and self._actor_task.done():\n            raise RuntimeError(\"MCP actor task crashed\", self._actor_task.exception())\n        fut: asyncio.Future[McpFuture] = asyncio.Future()\n        if type in {\"list_tools\", \"list_prompts\", \"list_resources\", \"list_resource_templates\", \"shutdown\"}:\n            await self._command_queue.put({\"type\": type, \"future\": fut})\n            res = await fut\n        elif type in {\"call_tool\", \"read_resource\", \"get_prompt\"}:\n            if args is None:\n                raise ValueError(f\"args is required for {type}\")\n            name = args.get(\"name\", None)\n            kwargs = args.get(\"kargs\", {})\n            if type == \"call_tool\" and name is None:\n                raise ValueError(\"name is required for call_tool\")\n            elif type == \"read_resource\":\n                uri = kwargs.get(\"uri\", None)\n                if uri is None:\n                    raise ValueError(\"uri is required for read_resource\")\n                await self._command_queue.put({\"type\": type, \"uri\": uri, \"future\": fut})\n            elif type == \"get_prompt\":\n                if name is None:\n                    raise ValueError(\"name is required for get_prompt\")\n                prompt_args = kwargs.get(\"arguments\", None)\n                await self._command_queue.put({\"type\": type, \"name\": name, \"args\": prompt_args, \"future\": fut})\n            else:  # call_tool\n                await self._command_queue.put({\"type\": type, \"name\": name, \"args\": kwargs, \"future\": fut})\n            res = await fut\n        else:\n            raise ValueError(f\"Unknown command type: {type}\")\n        return res\n\n    async def close(self) -> None:","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-ext/src/autogen_ext/tools/mcp/_actor.py#L95-L131","documentation":"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.","triggerScenarios":"Calling actor.call('call_tool', args={...}) where the dict has 'kargs' but no 'name', or the key is misspelled ('tool_name', 'tool').","commonSituations":"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.","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."],"exampleFix":"# before\nawait actor.call(\"call_tool\", args={\"kargs\": {\"query\": \"hello\"}})\n\n# after\nawait actor.call(\"call_tool\", args={\"name\": \"search\", \"kargs\": {\"query\": \"hello\"}})","handlingStrategy":"validation","validationCode":"if cmd == \"call_tool\" and not args.get(\"name\"):\n    raise ValueError(\"call_tool requires args['name']\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["mcp","validation","arguments","tool-call"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}