From febb45af8a8175c9d31dee4ea148a1a14c215587 Mon Sep 17 00:00:00 2001 From: Ben Brandt Date: Sun, 12 Oct 2025 23:07:38 +0200 Subject: [PATCH 1/2] Copy docs over to request/notif enums --- rust/agent.rs | 93 +++++++++++++++++++++++++++++++++++++++++++++++++ rust/client.rs | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 187 insertions(+) diff --git a/rust/agent.rs b/rust/agent.rs index d91c25ad..6e9fc085 100644 --- a/rust/agent.rs +++ b/rust/agent.rs @@ -640,14 +640,90 @@ pub(crate) const SESSION_SET_MODEL_METHOD_NAME: &str = "session/set_model"; #[serde(untagged)] #[schemars(extend("x-docs-ignore" = true))] pub enum ClientRequest { + /// Establishes the connection with a client and negotiates protocol capabilities. + /// + /// This method is called once at the beginning of the connection to: + /// - Negotiate the protocol version to use + /// - Exchange capability information between client and agent + /// - Determine available authentication methods + /// + /// The agent should respond with its supported protocol version and capabilities. + /// + /// See protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization) InitializeRequest(InitializeRequest), + /// Authenticates the client using the specified authentication method. + /// + /// Called when the agent requires authentication before allowing session creation. + /// The client provides the authentication method ID that was advertised during initialization. + /// + /// After successful authentication, the client can proceed to create sessions with + /// `new_session` without receiving an `auth_required` error. + /// + /// See protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization) AuthenticateRequest(AuthenticateRequest), + /// Creates a new conversation session with the agent. + /// + /// Sessions represent independent conversation contexts with their own history and state. + /// + /// The agent should: + /// - Create a new session context + /// - Connect to any specified MCP servers + /// - Return a unique session ID for future requests + /// + /// May return an `auth_required` error if the agent requires authentication. + /// + /// See protocol docs: [Session Setup](https://agentclientprotocol.com/protocol/session-setup) NewSessionRequest(NewSessionRequest), + /// Loads an existing session to resume a previous conversation. + /// + /// This method is only available if the agent advertises the `loadSession` capability. + /// + /// The agent should: + /// - Restore the session context and conversation history + /// - Connect to the specified MCP servers + /// - Stream the entire conversation history back to the client via notifications + /// + /// See protocol docs: [Loading Sessions](https://agentclientprotocol.com/protocol/session-setup#loading-sessions) LoadSessionRequest(LoadSessionRequest), + /// Sets the current mode for a session. + /// + /// Allows switching between different agent modes (e.g., "ask", "architect", "code") + /// that affect system prompts, tool availability, and permission behaviors. + /// + /// The mode must be one of the modes advertised in `availableModes` during session + /// creation or loading. Agents may also change modes autonomously and notify the + /// client via `current_mode_update` notifications. + /// + /// This method can be called at any time during a session, whether the Agent is + /// idle or actively generating a response. + /// + /// See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes) SetSessionModeRequest(SetSessionModeRequest), + /// Processes a user prompt within a session. + /// + /// This method handles the whole lifecycle of a prompt: + /// - Receives user messages with optional context (files, images, etc.) + /// - Processes the prompt using language models + /// - Reports language model content and tool calls to the Clients + /// - Requests permission to run tools + /// - Executes any requested tool calls + /// - Returns when the turn is complete with a stop reason + /// + /// See protocol docs: [Prompt Turn](https://agentclientprotocol.com/protocol/prompt-turn) PromptRequest(PromptRequest), #[cfg(feature = "unstable")] + /// **UNSTABLE** + /// + /// This capability is not part of the spec yet, and may be removed or changed at any point. + /// + /// Select a model for a given session. SetSessionModelRequest(SetSessionModelRequest), + /// Handles extension method requests from the client. + /// + /// Extension methods provide a way to add custom functionality while maintaining + /// protocol compatibility. + /// + /// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility) ExtMethodRequest(ExtRequest), } @@ -682,7 +758,24 @@ pub enum AgentResponse { #[serde(untagged)] #[schemars(extend("x-docs-ignore" = true))] pub enum ClientNotification { + /// Cancels ongoing operations for a session. + /// + /// This is a notification sent by the client to cancel an ongoing prompt turn. + /// + /// Upon receiving this notification, the Agent SHOULD: + /// - Stop all language model requests as soon as possible + /// - Abort all tool call invocations in progress + /// - Send any pending `session/update` notifications + /// - Respond to the original `session/prompt` request with `StopReason::Cancelled` + /// + /// See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/prompt-turn#cancellation) CancelNotification(CancelNotification), + /// Handles extension notifications from the client. + /// + /// Extension notifications provide a way to send one-way messages for custom functionality + /// while maintaining protocol compatibility. + /// + /// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility) ExtNotification(ExtNotification), } diff --git a/rust/client.rs b/rust/client.rs index f75ca554..b5af4905 100644 --- a/rust/client.rs +++ b/rust/client.rs @@ -541,14 +541,90 @@ pub(crate) const TERMINAL_KILL_METHOD_NAME: &str = "terminal/kill"; #[serde(untagged)] #[schemars(extend("x-docs-ignore" = true))] pub enum AgentRequest { + /// Writes content to a text file in the client's file system. + /// + /// Only available if the client advertises the `fs.writeTextFile` capability. + /// Allows the agent to create or modify files within the client's environment. + /// + /// See protocol docs: [Client](https://agentclientprotocol.com/protocol/overview#client) WriteTextFileRequest(WriteTextFileRequest), + /// Reads content from a text file in the client's file system. + /// + /// Only available if the client advertises the `fs.readTextFile` capability. + /// Allows the agent to access file contents within the client's environment. + /// + /// See protocol docs: [Client](https://agentclientprotocol.com/protocol/overview#client) ReadTextFileRequest(ReadTextFileRequest), + /// Requests permission from the user for a tool call operation. + /// + /// Called by the agent when it needs user authorization before executing + /// a potentially sensitive operation. The client should present the options + /// to the user and return their decision. + /// + /// If the client cancels the prompt turn via `session/cancel`, it MUST + /// respond to this request with `RequestPermissionOutcome::Cancelled`. + /// + /// See protocol docs: [Requesting Permission](https://agentclientprotocol.com/protocol/tool-calls#requesting-permission) RequestPermissionRequest(RequestPermissionRequest), + /// Executes a command in a new terminal + /// + /// Only available if the `terminal` Client capability is set to `true`. + /// + /// Returns a `TerminalId` that can be used with other terminal methods + /// to get the current output, wait for exit, and kill the command. + /// + /// The `TerminalId` can also be used to embed the terminal in a tool call + /// by using the `ToolCallContent::Terminal` variant. + /// + /// The Agent is responsible for releasing the terminal by using the `terminal/release` + /// method. + /// + /// See protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminals) CreateTerminalRequest(CreateTerminalRequest), + /// Gets the terminal output and exit status + /// + /// Returns the current content in the terminal without waiting for the command to exit. + /// If the command has already exited, the exit status is included. + /// + /// See protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminals) TerminalOutputRequest(TerminalOutputRequest), + /// Releases a terminal + /// + /// The command is killed if it hasn't exited yet. Use `terminal/wait_for_exit` + /// to wait for the command to exit before releasing the terminal. + /// + /// After release, the `TerminalId` can no longer be used with other `terminal/*` methods, + /// but tool calls that already contain it, continue to display its output. + /// + /// The `terminal/kill` method can be used to terminate the command without releasing + /// the terminal, allowing the Agent to call `terminal/output` and other methods. + /// + /// See protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminals) ReleaseTerminalRequest(ReleaseTerminalRequest), + /// Waits for the terminal command to exit and return its exit status + /// + /// See protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminals) WaitForTerminalExitRequest(WaitForTerminalExitRequest), + /// Kills the terminal command without releasing the terminal + /// + /// While `terminal/release` will also kill the command, this method will keep + /// the `TerminalId` valid so it can be used with other methods. + /// + /// This method can be helpful when implementing command timeouts which terminate + /// the command as soon as elapsed, and then get the final output so it can be sent + /// to the model. + /// + /// Note: `terminal/release` when `TerminalId` is no longer needed. + /// + /// See protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminals) KillTerminalCommandRequest(KillTerminalCommandRequest), + /// Handles extension method requests from the agent. + /// + /// Allows the Agent to send an arbitrary request that is not part of the ACP spec. + /// Extension methods provide a way to add custom functionality while maintaining + /// protocol compatibility. + /// + /// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility) ExtMethodRequest(ExtRequest), } @@ -584,6 +660,24 @@ pub enum ClientResponse { #[allow(clippy::large_enum_variant)] #[schemars(extend("x-docs-ignore" = true))] pub enum AgentNotification { + /// Handles session update notifications from the agent. + /// + /// This is a notification endpoint (no response expected) that receives + /// real-time updates about session progress, including message chunks, + /// tool calls, and execution plans. + /// + /// Note: Clients SHOULD continue accepting tool call updates even after + /// sending a `session/cancel` notification, as the agent may send final + /// updates before responding with the cancelled stop reason. + /// + /// See protocol docs: [Agent Reports Output](https://agentclientprotocol.com/protocol/prompt-turn#3-agent-reports-output) SessionNotification(SessionNotification), + /// Handles extension notifications from the agent. + /// + /// Allows the Agent to send an arbitrary notification that is not part of the ACP spec. + /// Extension notifications provide a way to send one-way messages for custom functionality + /// while maintaining protocol compatibility. + /// + /// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility) ExtNotification(ExtNotification), } From 47f7bacf6ace63d84ab28f7041dea05b0011efc4 Mon Sep 17 00:00:00 2001 From: Ben Brandt Date: Mon, 13 Oct 2025 10:22:11 +0200 Subject: [PATCH 2/2] Migrate doc generation to schema objects --- rust/bin/generate.rs | 139 +++++++++++++++++++++++++++---------------- schema/schema.json | 21 +++++++ 2 files changed, 109 insertions(+), 51 deletions(-) diff --git a/rust/bin/generate.rs b/rust/bin/generate.rs index 3402f417..b937a996 100644 --- a/rust/bin/generate.rs +++ b/rust/bin/generate.rs @@ -226,7 +226,14 @@ mod markdown_generator { writeln!(&mut self.output, "## Agent").unwrap(); writeln!(&mut self.output).unwrap(); - writeln!(&mut self.output, "{}", side_docs.agent_trait).unwrap(); + writeln!( + &mut self.output, + "Defines the interface that all ACP-compliant agents must implement. + +Agents are programs that use generative AI to autonomously modify code. They handle +requests from clients and execute tasks using language models and tools." + ) + .unwrap(); writeln!(&mut self.output).unwrap(); for (method, types) in agent_types { @@ -235,7 +242,15 @@ mod markdown_generator { writeln!(&mut self.output, "## Client").unwrap(); writeln!(&mut self.output).unwrap(); - writeln!(&mut self.output, "{}", side_docs.client_trait).unwrap(); + writeln!( + &mut self.output, + "Defines the interface that ACP-compliant clients must implement. + +Clients are typically code editors (IDEs, text editors) that provide the interface +between users and AI agents. They manage the environment, handle user interactions, +and control access to resources." + ) + .unwrap(); for (method, types) in client_types { self.generate_method(&method, side_docs.client_method_doc(&method), types); @@ -775,23 +790,21 @@ mod markdown_generator { } struct SideDocs { - agent_trait: String, agent_methods: HashMap, - client_trait: String, client_methods: HashMap, } impl SideDocs { fn agent_method_doc(&self, method_name: &str) -> &String { match method_name { - "initialize" => self.agent_methods.get("initialize").unwrap(), - "authenticate" => self.agent_methods.get("authenticate").unwrap(), - "session/new" => self.agent_methods.get("new_session").unwrap(), - "session/load" => self.agent_methods.get("load_session").unwrap(), - "session/set_mode" => self.agent_methods.get("set_session_mode").unwrap(), - "session/prompt" => self.agent_methods.get("prompt").unwrap(), - "session/cancel" => self.agent_methods.get("cancel").unwrap(), - "session/set_model" => self.agent_methods.get("set_session_model").unwrap(), + "initialize" => self.agent_methods.get("InitializeRequest").unwrap(), + "authenticate" => self.agent_methods.get("AuthenticateRequest").unwrap(), + "session/new" => self.agent_methods.get("NewSessionRequest").unwrap(), + "session/load" => self.agent_methods.get("LoadSessionRequest").unwrap(), + "session/set_mode" => self.agent_methods.get("SetSessionModeRequest").unwrap(), + "session/prompt" => self.agent_methods.get("PromptRequest").unwrap(), + "session/cancel" => self.agent_methods.get("CancelNotification").unwrap(), + "session/set_model" => self.agent_methods.get("SetSessionModelRequest").unwrap(), _ => panic!("Introduced a method? Add it here :)"), } } @@ -799,18 +812,22 @@ mod markdown_generator { fn client_method_doc(&self, method_name: &str) -> &String { match method_name { "session/request_permission" => { - self.client_methods.get("request_permission").unwrap() - } - "fs/write_text_file" => self.client_methods.get("write_text_file").unwrap(), - "fs/read_text_file" => self.client_methods.get("read_text_file").unwrap(), - "session/update" => self.client_methods.get("session_notification").unwrap(), - "terminal/create" => self.client_methods.get("create_terminal").unwrap(), - "terminal/output" => self.client_methods.get("terminal_output").unwrap(), - "terminal/release" => self.client_methods.get("release_terminal").unwrap(), - "terminal/wait_for_exit" => { - self.client_methods.get("wait_for_terminal_exit").unwrap() + self.client_methods.get("RequestPermissionRequest").unwrap() } - "terminal/kill" => self.client_methods.get("kill_terminal_command").unwrap(), + "fs/write_text_file" => self.client_methods.get("WriteTextFileRequest").unwrap(), + "fs/read_text_file" => self.client_methods.get("ReadTextFileRequest").unwrap(), + "session/update" => self.client_methods.get("SessionNotification").unwrap(), + "terminal/create" => self.client_methods.get("CreateTerminalRequest").unwrap(), + "terminal/output" => self.client_methods.get("TerminalOutputRequest").unwrap(), + "terminal/release" => self.client_methods.get("ReleaseTerminalRequest").unwrap(), + "terminal/wait_for_exit" => self + .client_methods + .get("WaitForTerminalExitRequest") + .unwrap(), + "terminal/kill" => self + .client_methods + .get("KillTerminalCommandRequest") + .unwrap(), _ => panic!("Introduced a method? Add it here :)"), } } @@ -845,48 +862,68 @@ mod markdown_generator { let doc: Value = serde_json::from_str(&json_content).unwrap(); let mut side_docs = SideDocs { - agent_trait: String::new(), agent_methods: HashMap::new(), - client_trait: String::new(), client_methods: HashMap::new(), }; if let Some(index) = doc["index"].as_object() { for (_, item) in index { - if item["name"].as_str() == Some("Agent") { - if let Some(docs) = item["docs"].as_str() { - side_docs.agent_trait = docs.to_string(); + if item["name"].as_str() == Some("ClientRequest") + && let Some(variants) = item["inner"]["enum"]["variants"].as_array() + { + for variant_id in variants { + if let Some(variant) = doc["index"][variant_id.to_string()].as_object() + && let Some(name) = variant["name"].as_str() + { + side_docs.agent_methods.insert( + name.to_string(), + variant["docs"].as_str().unwrap_or_default().to_string(), + ); + } } + } - if let Some(items) = item["inner"]["trait"]["items"].as_array() { - for method_id in items { - if let Some(method) = doc["index"][method_id.to_string()].as_object() - && let Some(name) = method["name"].as_str() - { - side_docs.agent_methods.insert( - name.to_string(), - method["docs"].as_str().unwrap_or_default().to_string(), - ); - } + if item["name"].as_str() == Some("ClientNotification") + && let Some(variants) = item["inner"]["enum"]["variants"].as_array() + { + for variant_id in variants { + if let Some(variant) = doc["index"][variant_id.to_string()].as_object() + && let Some(name) = variant["name"].as_str() + { + side_docs.agent_methods.insert( + name.to_string(), + variant["docs"].as_str().unwrap_or_default().to_string(), + ); } } } - if item["name"].as_str() == Some("Client") { - if let Some(docs) = item["docs"].as_str() { - side_docs.client_trait = docs.to_string(); + if item["name"].as_str() == Some("AgentRequest") + && let Some(variants) = item["inner"]["enum"]["variants"].as_array() + { + for variant_id in variants { + if let Some(variant) = doc["index"][variant_id.to_string()].as_object() + && let Some(name) = variant["name"].as_str() + { + side_docs.client_methods.insert( + name.to_string(), + variant["docs"].as_str().unwrap_or_default().to_string(), + ); + } } + } - if let Some(items) = item["inner"]["trait"]["items"].as_array() { - for method_id in items { - if let Some(method) = doc["index"][method_id.to_string()].as_object() - && let Some(name) = method["name"].as_str() - { - side_docs.client_methods.insert( - name.to_string(), - method["docs"].as_str().unwrap_or_default().to_string(), - ); - } + if item["name"].as_str() == Some("AgentNotification") + && let Some(variants) = item["inner"]["enum"]["variants"].as_array() + { + for variant_id in variants { + if let Some(variant) = doc["index"][variant_id.to_string()].as_object() + && let Some(name) = variant["name"].as_str() + { + side_docs.client_methods.insert( + name.to_string(), + variant["docs"].as_str().unwrap_or_default().to_string(), + ); } } } diff --git a/schema/schema.json b/schema/schema.json index 96b13780..7db21b69 100644 --- a/schema/schema.json +++ b/schema/schema.json @@ -35,9 +35,11 @@ "anyOf": [ { "$ref": "#/$defs/SessionNotification", + "description": "Handles session update notifications from the agent.\n\nThis is a notification endpoint (no response expected) that receives\nreal-time updates about session progress, including message chunks,\ntool calls, and execution plans.\n\nNote: Clients SHOULD continue accepting tool call updates even after\nsending a `session/cancel` notification, as the agent may send final\nupdates before responding with the cancelled stop reason.\n\nSee protocol docs: [Agent Reports Output](https://agentclientprotocol.com/protocol/prompt-turn#3-agent-reports-output)", "title": "SessionNotification" }, { + "description": "Handles extension notifications from the agent.\n\nAllows the Agent to send an arbitrary notification that is not part of the ACP spec.\nExtension notifications provide a way to send one-way messages for custom functionality\nwhile maintaining protocol compatibility.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", "title": "ExtNotification" } ], @@ -48,37 +50,46 @@ "anyOf": [ { "$ref": "#/$defs/WriteTextFileRequest", + "description": "Writes content to a text file in the client's file system.\n\nOnly available if the client advertises the `fs.writeTextFile` capability.\nAllows the agent to create or modify files within the client's environment.\n\nSee protocol docs: [Client](https://agentclientprotocol.com/protocol/overview#client)", "title": "WriteTextFileRequest" }, { "$ref": "#/$defs/ReadTextFileRequest", + "description": "Reads content from a text file in the client's file system.\n\nOnly available if the client advertises the `fs.readTextFile` capability.\nAllows the agent to access file contents within the client's environment.\n\nSee protocol docs: [Client](https://agentclientprotocol.com/protocol/overview#client)", "title": "ReadTextFileRequest" }, { "$ref": "#/$defs/RequestPermissionRequest", + "description": "Requests permission from the user for a tool call operation.\n\nCalled by the agent when it needs user authorization before executing\na potentially sensitive operation. The client should present the options\nto the user and return their decision.\n\nIf the client cancels the prompt turn via `session/cancel`, it MUST\nrespond to this request with `RequestPermissionOutcome::Cancelled`.\n\nSee protocol docs: [Requesting Permission](https://agentclientprotocol.com/protocol/tool-calls#requesting-permission)", "title": "RequestPermissionRequest" }, { "$ref": "#/$defs/CreateTerminalRequest", + "description": "Executes a command in a new terminal\n\nOnly available if the `terminal` Client capability is set to `true`.\n\nReturns a `TerminalId` that can be used with other terminal methods\nto get the current output, wait for exit, and kill the command.\n\nThe `TerminalId` can also be used to embed the terminal in a tool call\nby using the `ToolCallContent::Terminal` variant.\n\nThe Agent is responsible for releasing the terminal by using the `terminal/release`\nmethod.\n\nSee protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminals)", "title": "CreateTerminalRequest" }, { "$ref": "#/$defs/TerminalOutputRequest", + "description": "Gets the terminal output and exit status\n\nReturns the current content in the terminal without waiting for the command to exit.\nIf the command has already exited, the exit status is included.\n\nSee protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminals)", "title": "TerminalOutputRequest" }, { "$ref": "#/$defs/ReleaseTerminalRequest", + "description": "Releases a terminal\n\nThe command is killed if it hasn't exited yet. Use `terminal/wait_for_exit`\nto wait for the command to exit before releasing the terminal.\n\nAfter release, the `TerminalId` can no longer be used with other `terminal/*` methods,\nbut tool calls that already contain it, continue to display its output.\n\nThe `terminal/kill` method can be used to terminate the command without releasing\nthe terminal, allowing the Agent to call `terminal/output` and other methods.\n\nSee protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminals)", "title": "ReleaseTerminalRequest" }, { "$ref": "#/$defs/WaitForTerminalExitRequest", + "description": "Waits for the terminal command to exit and return its exit status\n\nSee protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminals)", "title": "WaitForTerminalExitRequest" }, { "$ref": "#/$defs/KillTerminalCommandRequest", + "description": "Kills the terminal command without releasing the terminal\n\nWhile `terminal/release` will also kill the command, this method will keep\nthe `TerminalId` valid so it can be used with other methods.\n\nThis method can be helpful when implementing command timeouts which terminate\nthe command as soon as elapsed, and then get the final output so it can be sent\nto the model.\n\nNote: `terminal/release` when `TerminalId` is no longer needed.\n\nSee protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminals)", "title": "KillTerminalCommandRequest" }, { + "description": "Handles extension method requests from the agent.\n\nAllows the Agent to send an arbitrary request that is not part of the ACP spec.\nExtension methods provide a way to add custom functionality while maintaining\nprotocol compatibility.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", "title": "ExtMethodRequest" } ], @@ -330,9 +341,11 @@ "anyOf": [ { "$ref": "#/$defs/CancelNotification", + "description": "Cancels ongoing operations for a session.\n\nThis is a notification sent by the client to cancel an ongoing prompt turn.\n\nUpon receiving this notification, the Agent SHOULD:\n- Stop all language model requests as soon as possible\n- Abort all tool call invocations in progress\n- Send any pending `session/update` notifications\n- Respond to the original `session/prompt` request with `StopReason::Cancelled`\n\nSee protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/prompt-turn#cancellation)", "title": "CancelNotification" }, { + "description": "Handles extension notifications from the client.\n\nExtension notifications provide a way to send one-way messages for custom functionality\nwhile maintaining protocol compatibility.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", "title": "ExtNotification" } ], @@ -343,33 +356,41 @@ "anyOf": [ { "$ref": "#/$defs/InitializeRequest", + "description": "Establishes the connection with a client and negotiates protocol capabilities.\n\nThis method is called once at the beginning of the connection to:\n- Negotiate the protocol version to use\n- Exchange capability information between client and agent\n- Determine available authentication methods\n\nThe agent should respond with its supported protocol version and capabilities.\n\nSee protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization)", "title": "InitializeRequest" }, { "$ref": "#/$defs/AuthenticateRequest", + "description": "Authenticates the client using the specified authentication method.\n\nCalled when the agent requires authentication before allowing session creation.\nThe client provides the authentication method ID that was advertised during initialization.\n\nAfter successful authentication, the client can proceed to create sessions with\n`new_session` without receiving an `auth_required` error.\n\nSee protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization)", "title": "AuthenticateRequest" }, { "$ref": "#/$defs/NewSessionRequest", + "description": "Creates a new conversation session with the agent.\n\nSessions represent independent conversation contexts with their own history and state.\n\nThe agent should:\n- Create a new session context\n- Connect to any specified MCP servers\n- Return a unique session ID for future requests\n\nMay return an `auth_required` error if the agent requires authentication.\n\nSee protocol docs: [Session Setup](https://agentclientprotocol.com/protocol/session-setup)", "title": "NewSessionRequest" }, { "$ref": "#/$defs/LoadSessionRequest", + "description": "Loads an existing session to resume a previous conversation.\n\nThis method is only available if the agent advertises the `loadSession` capability.\n\nThe agent should:\n- Restore the session context and conversation history\n- Connect to the specified MCP servers\n- Stream the entire conversation history back to the client via notifications\n\nSee protocol docs: [Loading Sessions](https://agentclientprotocol.com/protocol/session-setup#loading-sessions)", "title": "LoadSessionRequest" }, { "$ref": "#/$defs/SetSessionModeRequest", + "description": "Sets the current mode for a session.\n\nAllows switching between different agent modes (e.g., \"ask\", \"architect\", \"code\")\nthat affect system prompts, tool availability, and permission behaviors.\n\nThe mode must be one of the modes advertised in `availableModes` during session\ncreation or loading. Agents may also change modes autonomously and notify the\nclient via `current_mode_update` notifications.\n\nThis method can be called at any time during a session, whether the Agent is\nidle or actively generating a response.\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)", "title": "SetSessionModeRequest" }, { "$ref": "#/$defs/PromptRequest", + "description": "Processes a user prompt within a session.\n\nThis method handles the whole lifecycle of a prompt:\n- Receives user messages with optional context (files, images, etc.)\n- Processes the prompt using language models\n- Reports language model content and tool calls to the Clients\n- Requests permission to run tools\n- Executes any requested tool calls\n- Returns when the turn is complete with a stop reason\n\nSee protocol docs: [Prompt Turn](https://agentclientprotocol.com/protocol/prompt-turn)", "title": "PromptRequest" }, { "$ref": "#/$defs/SetSessionModelRequest", + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nSelect a model for a given session.", "title": "SetSessionModelRequest" }, { + "description": "Handles extension method requests from the client.\n\nExtension methods provide a way to add custom functionality while maintaining\nprotocol compatibility.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", "title": "ExtMethodRequest" } ],