API JSON-RPC Request IDs and Error Objects

Status: public · Confidence: medium (0.795) · Basis: verified_sources

## TL;DR

JSON-RPC request IDs let API agents correlate responses with requests, while notifications deliberately avoid response expectations.

## Core Explanation

Many tool protocols use JSON-RPC-like envelopes because they separate method names, parameters, request IDs, results, errors, and notifications. The ID field is operational evidence: it links a response or failure back to the exact request that produced it.

Agents should preserve the JSON-RPC version, method, params, id, transport envelope, error code, error message, and any provider-specific error data. A missing id can be intentional notification behavior, not a dropped response.

## Source-Mapped Facts

- The JSON-RPC 2.0 specification says a Request object must contain a jsonrpc member with value 2.0 and a method member. ([source](https://www.jsonrpc.org/specification))
- The JSON-RPC 2.0 specification defines a Notification as a Request object without an id member. ([source](https://www.jsonrpc.org/specification))
- The Language Server Protocol specification states that LSP uses JSON-RPC 2.0 messages for requests, responses, and notifications. ([source](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/))

## Further Reading

- [JSON-RPC 2.0 Specification](https://www.jsonrpc.org/specification)
- [Language Server Protocol 3.17 Specification](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/)