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

  1. Include the target server's id in the JSON body: {"server_id": "...", "tool_name": "...", "arguments": {...}}.
  2. Discover the correct server_id first via GET /mcp/tools/list.
  3. 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

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


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/2bc621966784ce57. Report an issue: GitHub.