{"record":{"id":"51428f2597196a5b","repo":"microsoft/autogen","slug":"unknown-command-type-type","errorCode":null,"errorMessage":"Unknown command type: {type}","messagePattern":"Unknown command type: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-ext/src/autogen_ext/tools/mcp/_actor.py","lineNumber":128,"sourceCode":"            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:\n        if not self._active or self._actor_task is None:\n            return\n        self._shutdown_future = asyncio.Future()\n        await self._command_queue.put({\"type\": \"shutdown\", \"future\": self._shutdown_future})\n        await self._shutdown_future\n        await self._actor_task\n        self._active = False\n\n    async def _sampling_callback(\n        self,\n        context: RequestContext[ClientSession, Any],\n        params: mcp_types.CreateMessageRequestParams,\n    ) -> mcp_types.CreateMessageResult | mcp_types.ErrorData:\n        \"\"\"Handle sampling requests using the provided model client.\"\"\"\n        if self._host is None:","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-ext/src/autogen_ext/tools/mcp/_actor.py#L110-L146","documentation":"McpActor.call() only recognizes a fixed command vocabulary: list_tools, list_prompts, list_resources, list_resource_templates, shutdown, call_tool, read_resource, get_prompt. Anything else falls to the final else and raises ValueError(f'Unknown command type: {type}'). Note this shadows the builtin type name because the parameter is called 'type' — the message interpolates the string you passed.","triggerScenarios":"Calling actor.call('tools/list') or 'ping' or a typo like 'list_tool' (singular); passing MCP protocol method names instead of the actor's internal command names.","commonSituations":"Translating raw MCP JSON-RPC method names from a server log into actor calls; singular/plural typos (list_tool vs list_tools); version skew where a newer command name is used against an older autogen-ext.","solutions":["Use one of the exact command strings: 'list_tools', 'list_prompts', 'list_resources', 'list_resource_templates', 'shutdown', 'call_tool', 'read_resource', 'get_prompt'.","If you need ping/notifications, go through the underlying MCP session object instead of the actor command queue.","Guard command strings with a constant set in your wrapper to fail early on typos."],"exampleFix":"# before\nawait actor.call(\"tools/list\")\n\n# after\nawait actor.call(\"list_tools\")","handlingStrategy":"validation","validationCode":"KNOWN = {\n    \"list_tools\", \"list_prompts\", \"list_resources\", \"list_resource_templates\",\n    \"shutdown\", \"call_tool\", \"read_resource\", \"get_prompt\",\n}\nif cmd not in KNOWN:\n    raise ValueError(f\"unknown actor command {cmd!r}; known: {sorted(KNOWN)}\")","typeGuard":"from typing import Literal\n\nActorCommand = Literal[\n    \"list_tools\", \"list_prompts\", \"list_resources\", \"list_resource_templates\",\n    \"shutdown\", \"call_tool\", \"read_resource\", \"get_prompt\",\n]","tryCatchPattern":null,"preventionTips":["Type the command parameter with a Literal union so typos fail static analysis.","Never feed raw MCP JSON-RPC method names into actor.call."],"tags":["mcp","validation","command-dispatch","typo"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}