JSONRPCRequest (mcp_types/jsonrpc.py)

python-sdk · src/mcp-types/mcp_types/jsonrpc.py · python · MIT
integration

Defines JSON‑RPC 2.0 request, response, error models and constants for a Python SDK.

# Source: https://github.com/modelcontextprotocol/python-sdk | License: MIT | Copyright 2024 Anthropic, PBC
# Provided via justclaw.it.com; keep this notice with the code.
"""This module follows the JSON-RPC 2.0 specification: https://www.jsonrpc.org/specification."""

from __future__ import annotations

from typing import Annotated, Any, Final, Literal

from pydantic import BaseModel, Field, TypeAdapter

__all__ = [
    "CONNECTION_CLOSED",
    "HEADER_MISMATCH",
    "INTERNAL_ERROR",
    "INVALID_PARAMS",
    "INVALID_REQUEST",
    "JSONRPC_VERSION",
    "METHOD_NOT_FOUND",
    "MISSING_REQUIRED_CLIENT_CAPABILITY",
    "PARSE_ERROR",
    "REQUEST_TIMEOUT",
    "UNSUPPORTED_PROTOCOL_VERSION",
    "URL_ELICITATION_REQUIRED",
    "ErrorData",
    "JSONRPCError",
    "JSONRPCMessage",
    "J

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key