microsoft/autogen · error · ValueError

name is required for get_prompt

Error message

name is required for get_prompt

What it means

For type == 'get_prompt', McpActor.call() requires a non-None 'name' in the args dict; otherwise ValueError('name is required for get_prompt') is raised. The name identifies which server-side prompt template to render; optional template variables travel under args['kargs']['arguments'].

Source

Thrown at python/packages/autogen-ext/src/autogen_ext/tools/mcp/_actor.py:121

        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:
        if not self._active or self._actor_task is None:
            return
        self._shutdown_future = asyncio.Future()
        await self._command_queue.put({"type": "shutdown", "future": self._shutdown_future})
        await self._shutdown_future
        await self._actor_task
        self._active = False

View on GitHub (pinned to 027ecf0a37)

Solutions

  1. Include the prompt name: args={'name': 'code_review', 'kargs': {'arguments': {'language': 'python'}}}.
  2. Get valid names from actor.call('list_prompts') first.
  3. Match the key exactly: 'name', with variables nested under kargs['arguments'].

Example fix

# before
await actor.call("get_prompt", args={"kargs": {"arguments": {"language": "python"}}})

# after
await actor.call("get_prompt", args={"name": "code_review", "kargs": {"arguments": {"language": "python"}}})
Defensive patterns

Strategy: validation

Validate before calling

if cmd == "get_prompt" and not args.get("name"):
    raise ValueError("get_prompt requires args['name']")

Prevention

When it happens

Trigger: Calling actor.call('get_prompt', args={'kargs': {'arguments': {...}}}) with no 'name', or with the prompt id stored under a different key such as 'prompt'.

Common situations: Passing prompt variables but forgetting the prompt identifier; using 'prompt' as the key after reading the MCP spec's prompts/get shape where it is called 'name'; empty-string prompt name (falsy only if None — but a missing key yields None).

Related errors


AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15). Data as JSON: /api/errors/8efb1501e5519e16. Report an issue: GitHub.