rohitg00/ai-engineering-from-scratch · error · ValueError
unsupported input request
Error message
unsupported input request: {method} What it means
Raised in the client-side fulfillment helper when the server requests a client capability method other than the known roots/list, sampling/createMessage, and elicitation/create. It is a generic dispatch guard: the incoming request method string is the faulty input and does not match any handler this demo client implements.
Solutions
- Add a handler branch for the requested method (e.g. ping or another client capability) in the fulfill dispatch
- Upgrade or align the server so it only requests capabilities the client advertises
- Return a JSON-RPC method-not-found error to the server instead of crashing when an optional capability is unsupported
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at certifications/claude/lessons/11-mcp-server-design-and-integration/code/main.py:590 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of rohitg00/ai-engineering-from-scratch@39ea8a1c6d (2026-08-26).
Data as JSON: /api/errors/881521e3831ee297.
Report an issue: GitHub.
Appendix: source
Thrown at certifications/claude/lessons/11-mcp-server-design-and-integration/code/main.py:590
method = request.get("method")
if method == "roots/list":
responses[key] = {
"roots": [{"uri": "file:///workspace", "name": "Workspace"}],
}
elif method == "sampling/createMessage":
responses[key] = {
"role": "assistant",
"content": {"type": "text", "text": "Check correctness and rollback risk."},
"model": "study-model",
"stopReason": "endTurn",
}
elif method == "elicitation/create":
responses[key] = {
"action": "accept",
"content": {"goal": "find correctness risks"},
}
else:
raise ValueError(f"unsupported input request: {method}")
return responses
def streamable_http_profile() -> dict[str, Any]:
return {
"endpoint": "/mcp",
"method": "POST",
"oneMessagePerPost": True,
"protocolSessions": False,
"responseTypes": ["application/json", "text/event-stream"],
"requestScopedSSE": True,
"changeNotifications": "subscriptions/listen",
"supportsGetStream": False,
"supportsDeleteSession": False,
"supportsLastEventId": False,
}
View on GitHub (pinned to 39ea8a1c6d)