Skip to content

Return JSON-RPC errors instead of HTTP 400 for filtered tool calls #5751

Closed as not planned

Description

@JAORMX

Part of #5743 (Workstream B: 2025-11-25 compliance).

Gap

When the tool-call gating middleware blocks a filtered tool, it returns HTTP 400 instead of a JSON-RPC error response (pkg/mcp/tool_filter.go, acknowledged in a code comment). MCP clients expect protocol-level errors for protocol-level problems; a transport 400 breaks client error handling and shows up as a connection problem rather than "tool not found".

Proposed work

Return a proper JSON-RPC error (method the spec uses for unknown tools — invalid params / tool not found semantics) over the negotiated response mode (JSON or SSE), keeping HTTP 400 only for genuinely malformed HTTP/JSON.

Priority: Low.

Activity

  1. added
    needs-triage
    on Jul 8, 2026
  2. JAORMX commented on Jul 8, 2026

    @JAORMX
    CollaboratorAuthor

    Consolidated into #5764 (compliance polish bundle).

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

    needs-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions