(sigil mcp protocol)
JSON-RPC 2.0 protocol implementation for MCP.
Provides message parsing, generation, and error handling for the JSON-RPC 2.0 protocol used by MCP.
Exports
jsonrpc-requestprocedureConstruct a jsonrpc-request struct.
jsonrpc-request?procedureTest if a value is a jsonrpc-request struct.
jsonrpc-request-idprocedureGet the id field of a jsonrpc-request struct.
jsonrpc-request-methodprocedureGet the method field of a jsonrpc-request struct.
jsonrpc-request-paramsprocedureGet the params field of a jsonrpc-request struct.
%jsonrpc-notification--typevariableGet the params field of a jsonrpc-request struct.
jsonrpc-notificationprocedureConstruct a jsonrpc-notification struct.
jsonrpc-notification?procedureTest if a value is a jsonrpc-notification struct.
jsonrpc-notification-methodprocedureGet the method field of a jsonrpc-notification struct.
jsonrpc-notification-paramsprocedureGet the params field of a jsonrpc-notification struct.
%jsonrpc-response--typevariableGet the params field of a jsonrpc-notification struct.
jsonrpc-responseprocedureConstruct a jsonrpc-response struct.
jsonrpc-response?procedureTest if a value is a jsonrpc-response struct.
jsonrpc-response-idprocedureGet the id field of a jsonrpc-response struct.
jsonrpc-response-resultprocedureGet the result field of a jsonrpc-response struct.
%jsonrpc-error-response--typevariableGet the result field of a jsonrpc-response struct.
jsonrpc-error-responseprocedureConstruct a jsonrpc-error-response struct.
jsonrpc-error-response?procedureTest if a value is a jsonrpc-error-response struct.
jsonrpc-error-response-idprocedureGet the id field of a jsonrpc-error-response struct.
jsonrpc-error-response-codeprocedureGet the code field of a jsonrpc-error-response struct.
jsonrpc-error-response-messageprocedureGet the message field of a jsonrpc-error-response struct.
jsonrpc-error-response-dataprocedureGet the data field of a jsonrpc-error-response struct.
mcp-current-versionvariableThe current (stateless) protocol revision. Requests in this era carry their version in _meta on every message and never call initialize.
mcp-legacy-versionsvariableRevisions reachable only through the legacy initialize handshake, newest first. The head is the fallback offered to a legacy client whose requested version we do not recognise.
mcp-supported-versionsvariableEverything this implementation can speak, newest first.
mcp-negotiate-legacy-versionprocedureChoose the version to answer a legacy initialize with.
Echoes the client's request when we support it, otherwise offers our newest legacy revision. NEVER answers with mcp-current-version: that revision has no initialize handshake at all, so a legacy client handed it would be looking at a version it cannot speak. A client that asked for a version we do not know is expected to disconnect if it cannot accept the counter-offer.
parse-message-stringprocedureParse a JSON-RPC message from a JSON string.
Returns a jsonrpc-request, jsonrpc-notification, or #f on parse error. Does not handle batch requests (arrays).
parse-messageprocedureParse a JSON-RPC message from a parsed JSON value (dict).
Returns a JSON-RPC request, notification, response, error response, or #f if invalid. Keeping both directions in this module prevents clients and servers from growing subtly different wire parsers.
response->jsonprocedureSerialize a successful response to JSON string.
notification->jsonprocedureSerialize a notification to JSON string.
request->jsonprocedureSerialize a request to JSON string.
make-responseprocedureCreate a successful response for a request.
make-error-responseprocedureCreate an error response for a request.
make-notificationprocedureCreate a notification (server to client).
error-response->jsonvariable(No description)
error-parsevariable(No description)
error-invalid-requestvariable(No description)
error-method-not-foundvariable(No description)
error-invalid-paramsvariable(No description)
error-internalvariable(No description)
error-header-mismatchvariable(No description)
error-missing-capabilityvariable(No description)
error-unsupported-versionvariable(No description)
meta-protocol-version-keyvariable(No description)
meta-client-capabilities-keyvariable(No description)
meta-client-info-keyvariable(No description)
meta-server-info-keyvariable(No description)