Initial Checks
Release line
2.x (current stable)
Description
Description
When a prompt is called without a required argument, the request is correctly rejected, but the Python SDK logs the validation error with a full traceback.
To Reproduce
Steps to reproduce the behavior:
-
Create a prompt with a required argument:
@mcp.prompt()
def diagnose_cluster(problem: str) -> str:
return f"Diagnose: {problem}"
-
Call prompts/list and confirm that problem is marked as required.
-
Call prompts/get without providing the required argument:
{
"method": "prompts/get",
"params": {
"name": "diagnose_cluster"
}
}
-
The request is rejected, but the server logs a full traceback:
Error getting prompt diagnose_cluster
Traceback (most recent call last):
...
File ".../mcp/server/mcpserver/server.py", line 1285, in get_prompt
rendered = await prompt.render(arguments, context)
File ".../mcp/server/mcpserver/prompts/base.py", line 160, in render
raise ValueError(f"Missing required arguments: {missing}")
ValueError: Missing required arguments: {'problem'}
handler for 'prompts/get' raised
Example Code
Python & MCP Python SDK
## Environment
- MCP Python SDK: v2
- Python: 3.x
- Server: `MCPServer`
- Prompt transport: Streamable HTTP
Reactions are currently unavailable
Initial Checks
Release line
2.x (current stable)
Description
Description
When a prompt is called without a required argument, the request is correctly rejected, but the Python SDK logs the validation error with a full traceback.
To Reproduce
Steps to reproduce the behavior:
Create a prompt with a required argument:
Call prompts/list and confirm that problem is marked as required.
Call prompts/get without providing the required argument:
{ "method": "prompts/get", "params": { "name": "diagnose_cluster" } }The request is rejected, but the server logs a full traceback:
Error getting prompt diagnose_cluster Traceback (most recent call last): ... File ".../mcp/server/mcpserver/server.py", line 1285, in get_prompt rendered = await prompt.render(arguments, context) File ".../mcp/server/mcpserver/prompts/base.py", line 160, in render raise ValueError(f"Missing required arguments: {missing}") ValueError: Missing required arguments: {'problem'} handler for 'prompts/get' raisedExample Code
Python & MCP Python SDK