Skip to content

mcp

ClientResult module-attribute

InputRequiredRoundsExceededError

Bases: RuntimeError

The server kept returning InputRequiredResult past the configured max_rounds.

Source code in src/mcp/client/_input_required.py
40
41
42
43
44
45
46
47
48
49
class InputRequiredRoundsExceededError(RuntimeError):
    """The server kept returning `InputRequiredResult` past the configured `max_rounds`."""

    def __init__(self, max_rounds: int) -> None:
        super().__init__(
            f"Server returned InputRequiredResult for more than {max_rounds} rounds; "
            "raise input_required_max_rounds on the Client, or use "
            "client.session.<method>(..., allow_input_required=True) to drive the loop manually."
        )
        self.max_rounds = max_rounds

Classes

  • CallToolRequest — Used by the client to invoke a tool provided by the server.
  • Client — A high-level MCP client for connecting to MCP servers.
  • ClientCapabilities — Capabilities a client may support.
  • ClientSession — Client half of an MCP connection, running on a Dispatcher.
  • ClientSessionGroup — Client for managing connections to multiple MCP servers.
  • CompleteRequest — A request from the client to the server, to ask for completion options.
  • CreateMessageRequest — A request from the server to sample an LLM via the client.
  • CreateMessageResult — The client's response to a sampling/createMessage request from the server.
  • CreateMessageResultWithTools — The client's response to a sampling/createMessage request when tools were provided.
  • ErrorData — Error information for JSON-RPC error responses.
  • GetPromptRequest — Used by the client to get a prompt provided by the server.
  • GetPromptResult — The server's response to a prompts/get request from the client.
  • Implementation — Describes the name and version of an MCP implementation (clientInfo / serverInfo).
  • InitializedNotification — This notification is sent from the client to the server after initialization has finished.
  • InitializeRequest — This request is sent from the client to the server when it first connects, asking it to begin initialization.
  • InitializeResult — After receiving an initialize request from the client, the server sends this response.
  • InputRequiredRoundsExceededError — The server kept returning InputRequiredResult past the configured max_rounds.
  • InvalidUriTemplate — Raised when a URI template string is malformed or unsupported.
  • JSONRPCError — A response to a request that indicates an error occurred.
  • JSONRPCRequest — A JSON-RPC request that expects a response.
  • JSONRPCResponse — A successful (non-error) response to a request.
  • ListPromptsRequest — Sent from the client to request a list of prompts and prompt templates the server has.
  • ListPromptsResult — The server's response to a prompts/list request from the client.
  • ListResourcesRequest — Sent from the client to request a list of resources the server has.
  • ListResourcesResult — The server's response to a resources/list request from the client.
  • ListToolsResult — The server's response to a tools/list request from the client.
  • LoggingMessageNotification — Notification of a log message passed from server to client.
  • MCPDeprecationWarning — A custom deprecation warning for the MCP SDK.
  • MCPError — Exception type raised when an error arrives over an MCP connection.
  • Notification — Base class for JSON-RPC notifications.
  • PingRequest — A ping, issued by either the server or the client, to check that the other party is still alive. The receiver must promptly respond, or else may be disconnected.
  • ProgressNotification — An out-of-band notification used to inform the receiver of a progress update for a long-running request.
  • PromptsCapability — Capability for prompts operations.
  • ReadResourceRequest — Sent from the client to the server, to read a specific resource URI.
  • ReadResourceResult — The server's response to a resources/read request from the client.
  • Resource — A known resource that the server is capable of reading.
  • ResourcesCapability — Capability for resources operations.
  • ResourceUpdatedNotification — A notification from the server to the client, informing it that a resource has changed and may need to be read again.
  • RootsCapability — Capability for root operations.
  • SamplingCapability — Sampling capability structure. Deprecated in 2026-07-28 (SEP-2577); shape unchanged.
  • SamplingContextCapability — Capability for context inclusion during sampling.
  • SamplingMessage — Describes a message issued to or received from an LLM API.
  • SamplingToolsCapability — Capability indicating support for tool calling during sampling.
  • ServerCapabilities — Capabilities that a server may support. Not a closed set.
  • ServerSession — Per-request proxy for server-to-client requests and notifications.
  • SetLevelRequest — A request from the client to the server, to enable or adjust logging.
  • StdioServerParameters
  • SubscribeRequest — Sent from the client to request resources/updated notifications from the server whenever a particular resource changes.
  • Tool — Definition for a tool the client can call.
  • ToolChoice — Controls tool selection behavior for sampling requests (2025-11-25+).
  • ToolResultContent — The result of a tool use, provided by the user back to the assistant (2025-11-25+).
  • ToolsCapability — Capability for tools operations.
  • ToolUseContent — An assistant's request to invoke a tool during sampling (2025-11-25+).
  • UnsubscribeRequest — Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request.
  • UriTemplate — A parsed RFC 6570 URI template.
  • UrlElicitationRequiredError — Specialized error for when a tool requires URL mode elicitation(s) before proceeding.

Functions

  • stdio_client — Spawns an MCP server subprocess and connects to it over stdin/stdout.
  • stdio_server — Server transport for stdio: this communicates with an MCP client by reading from the current process' stdin and writing to stdout.

Attributes

  • ClientNotification — Notifications sent from the client to the server.
  • ClientRequest — Union of client-to-server request payloads across all supported protocol versions.
  • ClientResult
  • IncludeContext — Scope of MCP-server context a sampling request asks the client to attach.
  • LoggingLevel — The severity of a log message.
  • SamplingContent — Basic content types for sampling responses (without tool use).
  • SamplingMessageContentBlock — Content block types allowed in sampling messages.
  • SamplingRole — The sender or recipient of messages and data in a conversation.
  • ServerNotification — Union of server-to-client notification payloads across all supported protocol versions.
  • ServerRequest — Union of standalone JSON-RPC requests a server can send to a client.
  • ServerResult — Union of every result payload a server can return for a client request.
  • StopReason — The reason why sampling stopped, if known.