BerriAI/litellm · error · HTTPException
missing_parameter
missing_parameter
Error message
server_id is required in request body
What it means
The REST tool-call route validates required body fields early: for any concrete tool (everything except the virtual mcp_tool_search/mcp_tool_call tools), server_id must be a non-empty field of the JSON request body. Missing, null, or empty-string server_id yields 400 error=missing_parameter with this message before any auth or upstream work happens.
Source
Thrown at litellm/proxy/_experimental/mcp_server/rest_endpoints.py:952
try:
user_api_key_dict = await acting_user_auth(user_api_key_dict)
data = await request.json()
tool_name: Final = data.get("name")
tool_arguments: Final = data.get("arguments") or {}
from litellm.proxy._experimental.mcp_server.tool_search import (
MCP_TOOL_CALL_TOOL_NAME,
MCP_TOOL_SEARCH_TOOL_NAME,
)
if tool_name in (MCP_TOOL_SEARCH_TOOL_NAME, MCP_TOOL_CALL_TOOL_NAME):
return await _handle_virtual_mcp_tool(request, data, tool_name, user_api_key_dict)
# Validate required parameters early
server_id: Final = data.get("server_id")
if not server_id:
raise HTTPException(
status_code=400,
detail={
"error": "missing_parameter",
"message": "server_id is required in request body",
},
)
if not tool_name:
raise HTTPException(
status_code=400,
detail={
"error": "missing_parameter",
"message": "name is required in request body",
},
)
proxy_base_llm_response_processor: Final = ProxyBaseLLMRequestProcessing(data=data)
(View on GitHub (pinned to 77b7c6c40c)
Solutions
- Include the target server's id in the JSON body: {"server_id": "...", "tool_name": "...", "arguments": {...}}.
- Discover the correct server_id first via GET /mcp/tools/list.
- If you genuinely want server-agnostic search/call, use the mcp_tool_search/mcp_tool_call virtual tools - but the key then needs mcp_tool_search_enabled.
Example fix
# before
curl -X POST $PROXY/mcp/tool-call -H "Authorization: Bearer $KEY" \
-d '{"tool_name": "get_weather", "arguments": {"city": "Paris"}}'
# -> 400 {"error":"missing_parameter","message":"server_id is required in request body"}
# after
curl -X POST $PROXY/mcp/tool-call -H "Authorization: Bearer $KEY" \
-d '{"server_id": "weather", "tool_name": "get_weather", "arguments": {"city": "Paris"}}' Defensive patterns
Strategy: validation
Validate before calling
def valid_tool_call_payload(payload: dict) -> bool:
return (
bool(payload.get("tool_name"))
and bool(payload.get("server_id")) # not required only for mcp_tool_search/mcp_tool_call
and isinstance(payload.get("arguments", {}), dict)
)
assert valid_tool_call_payload(payload), "server_id and tool_name are required in the body" Try / catch
resp = await client.post(f"{proxy}/mcp/tool-call", json=payload, headers=headers)
if resp.status_code == 400 and resp.json().get("detail", {}).get("error") == "missing_parameter":
raise BadRequest(f"fill required body fields: {resp.json()['detail']['message']}") from None
resp.raise_for_status() Prevention
- Validate the request body shape (server_id + tool_name + arguments) client-side before sending.
- Remember server_id lives in the JSON body, not the URL or query string, on this route.
- Only the virtual tools mcp_tool_search/mcp_tool_call omit server_id - and those need the key flag.
When it happens
Trigger: POST to the tool-call route with {"tool_name": ..., "arguments": ...} but no server_id; putting server_id in the query string or URL path instead of the body; sending "server_id": "" or null.
Common situations: Clients ported from the native MCP SDK where tools are addressed globally without a server; generated SDKs that drop optional-looking fields; copy-pasting examples that use the virtual tool shape for concrete tools.
Related errors
- Request arguments are required
- max_budget cannot be negative. Received: {data.max_budget}
- soft_budget cannot be negative. Received: {data.soft_budget}
- soft_budget ({data.soft_budget}) must be strictly lower than
- Model '{m}' not in team's allowed models. Team allowed model
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/2bc621966784ce57.
Report an issue: GitHub.