Skip to content

Return Invalid Request for an empty JSON-RPC batch #4

Description

@royalpinto007

Problem

handleMcpRequest treats an empty JSON array as a batch with no responses and returns HTTP 202. Under JSON-RPC 2.0, an empty batch is invalid and should return an Invalid Request error.

Relevant code: src/mcp.ts.

Expected behavior

A request body of [] should return a JSON-RPC error with code -32600, rather than a successful empty response.

Acceptance criteria

  • Detect an empty batch before dispatch.
  • Return a valid JSON-RPC Invalid Request error with id null.
  • Keep notification-only non-empty batches returning no response.
  • Add request-level tests covering empty batches and notification-only batches.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions