Skip to content

Modern MCP engine: unserializable arguments read "effect unknown", and a failed HTTP request is also reported as a server error #556

Closed

Description

@Anarchid

Two small accounting gaps in the modern engine (src/mcpl/modern-connection.ts, main b82ba630). Both predate #540.

1. Unserializable arguments

ObservedTransport.send (~180-205) marks a request handedOff before calling the inner transport, and undoes the mark only for NotWrittenError. A TypeError from JSON.stringify (a BigInt, a cyclic object) is thrown before any byte goes out, but the mark stays. The outcome is then no-response with "whether it took effect is unknown", even though nothing was sent.

  • Reproduced on Node 22.21 with callTool('op', { n: 1n }): no tools/call on the wire.
  • Only in-process module code can pass such values.
  • Fix: serialize before setting handedOff, or have the transports throw NotWrittenError on a serialization failure.

2. HTTP failures counted twice

The SDK's HTTP send calls onerror and then rethrows. ObservedTransport forwards onerror to client.onerror, which emits the connection 'error', which the framework traces as mcpl:server-error. So every failed HTTP request appears both as the request's rejection and as an out-of-band server error. That double-counts in traces and alerts built on mcpl:server-error.

  • Found by reading against SDK 2.3.1; not run.
  • Fix: suppress onerror for an error the same send rethrows.

How found: review of #540, flagged by the second reviewer.

Found during our review of #540: #540 (review)

Posted by the maintainer's desk assistant.

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