@toolgrain/protocol 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,52 @@
1
+ /* JSON types */
2
+ /** @internal */
3
+ export const LATEST_PROTOCOL_VERSION = "2026-07-28";
4
+ /** @internal */
5
+ export const JSONRPC_VERSION = "2.0";
6
+ // Standard JSON-RPC error codes
7
+ export const PARSE_ERROR = -32700;
8
+ export const INVALID_REQUEST = -32600;
9
+ export const METHOD_NOT_FOUND = -32601;
10
+ export const INVALID_PARAMS = -32602;
11
+ export const INTERNAL_ERROR = -32603;
12
+ /*
13
+ * MCP error codes.
14
+ *
15
+ * JSON-RPC 2.0 reserves `-32000` to `-32099` for implementation-defined
16
+ * server errors. MCP partitions that range:
17
+ *
18
+ * - `-32000` to `-32019`: implementation-defined. Existing SDKs and
19
+ * implementations use codes here for their own purposes; the specification
20
+ * will never define codes in this sub-range, and receivers must not assign
21
+ * cross-implementation semantics to them.
22
+ * - `-32020` to `-32099`: reserved for error codes defined by the MCP
23
+ * specification. Every code allocated here is recorded in this file.
24
+ * Codes are allocated sequentially starting at `-32020` and proceeding
25
+ * toward `-32099`.
26
+ *
27
+ * Codes defined by earlier protocol versions remain reserved and are never
28
+ * reused: `-32002` (resource not found, 2025-11-25 and earlier; replaced by
29
+ * `-32602`) and `-32042` (URL elicitation required, 2025-11-25 only).
30
+ */
31
+ /**
32
+ * Error code returned when the HTTP headers of a request do not match the
33
+ * corresponding values in the request body, or required headers are
34
+ * missing or malformed.
35
+ *
36
+ * @category Errors
37
+ */
38
+ export const HEADER_MISMATCH = -32020;
39
+ /**
40
+ * Error code returned when a server requires a client capability that was
41
+ * not declared in the request's `clientCapabilities`.
42
+ *
43
+ * @category Errors
44
+ */
45
+ export const MISSING_REQUIRED_CLIENT_CAPABILITY = -32021;
46
+ /**
47
+ * Error code returned when the request's protocol version is not supported
48
+ * by the server.
49
+ *
50
+ * @category Errors
51
+ */
52
+ export const UNSUPPORTED_PROTOCOL_VERSION = -32022;