Skip to content

Wrong kinds of MCP errors returned in some cases #228

@NobodysNightmare

Description

@NobodysNightmare

Describe the bug
Since the introduction of #194 the error behaviour of the MCP server has changed. Now missing tools and violations of the input schema do not cause a protocol error (JSON RPC error) anymore, but a tool execution error (i.e. successful JSON RPC response, with MCP isError flag set to true).

At least the former seems to be in violation of the MCP spec: https://modelcontextprotocol.io/specification/2025-06-18/server/tools#error-handling

Tools use two error reporting mechanisms:

  1. Protocol Errors: Standard JSON-RPC errors for issues like:
    • Unknown tools
    • Invalid arguments
    • Server errors

(highlighting mine)

To Reproduce
Steps to reproduce the behavior:

  1. Create an MCP server that has an empty array of tools (MCP::Server.new(tools: []))
  2. Try to call a tool

Expected behavior
A JSON RPC error response (e.g. root-level element error)

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions