Skip to content

The maxToolInputElements refusal lacks the Input validation error: prefix that the schema refusal carries #3111

Open

Description

@mihai-r-lupu

Version: @modelcontextprotocol/sdk 1.32.2 (the same text is in packages/server/src/server/mcp.ts on main).

McpServer.validateToolInput refuses a tool call in two ways. Both are McpError(ErrorCode.InvalidParams, …), and the tools/call handler returns either one as an isError: true result:

  • arguments over maxToolInputElements:
    Invalid arguments for tool start_run: arguments contain more than the maximum of 50000 elements
  • arguments that fail the input schema:
    Input validation error: Invalid arguments for tool get_run_state: Invalid input: expected string, received number at run_id

A client or a log filter that recognises an input refusal by its Input validation error: prefix misses the first one. Yet both are the same kind of refusal: bad arguments, same error code.

Suggestion: give the size refusal the same prefix:
Input validation error: Invalid arguments for tool start_run: arguments contain more than the maximum of 50000 elements

Context: we set maxToolInputElements: 50_000 in Realm's MCP server (thank you for #2926/#2927), and we document both texts for our users.

Related: #2879 asks for a hook to shape the schema refusal's result; if it lands, the size refusal could go through the same hook.

Activity

  1. barry166 commented on Oct 27, 2026

    @barry166

    I can take this. I’ll add the consistent input-validation prefix and a focused regression test.

  2. mihai-r-lupu commented on Oct 27, 2026

    @mihai-r-lupu
    Author

    Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions