// This file is generated by the effect-acp package. Do not edit manually. // Current ACP schema release: v0.11.3 import * as Schema from "effect/Schema"; export type AuthEnvVar = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly label?: string | null; readonly name: string; readonly optional?: boolean; readonly secret?: boolean; }; export const AuthEnvVar = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), label: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Human-readable label for this variable, displayed in client UI.", }), Schema.Null, ]), ), name: Schema.String.annotate({ description: 'The environment variable name (e.g. `"OPENAI_API_KEY"`).', }), optional: Schema.optionalKey( Schema.Boolean.annotate({ description: "Whether this variable is optional.\n\nDefaults to `false`.", default: false, }), ), secret: Schema.optionalKey( Schema.Boolean.annotate({ description: "Whether this value is a secret (e.g. API key, token).\nClients should use a password-style input for secret vars.\n\nDefaults to `true`.", default: true, }), ), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nDescribes a single environment variable for an [`AuthMethodEnvVar`] authentication method.", }); export type AvailableCommandInput = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly hint: string; }; export const AvailableCommandInput = Schema.Union([ Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), hint: Schema.String.annotate({ description: "A hint to display when the input hasn't been provided yet", }), }).annotate({ title: "unstructured", description: "All text that was typed after the command name is provided as input.", }), ]).annotate({ description: "The input specification for a command." }); export type Cost = { readonly amount: number; readonly currency: string }; export const Cost = Schema.Struct({ amount: Schema.Number.annotate({ description: "Total cumulative cost for session.", format: "double", }).check(Schema.isFinite()), currency: Schema.String.annotate({ description: 'ISO 4217 currency code (e.g., "USD", "EUR").' }), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nCost information for a session.", }); export type ElicitationContentValue = string | number | number | boolean | ReadonlyArray; export const ElicitationContentValue = Schema.Union([ Schema.String.annotate({ title: "String" }), Schema.Number.annotate({ title: "Integer", format: "int64" }).check(Schema.isInt()), Schema.Number.annotate({ title: "Number", format: "double" }).check(Schema.isFinite()), Schema.Boolean.annotate({ title: "Boolean" }), Schema.Array(Schema.String).annotate({ title: "StringArray" }), ]); export type ElicitationFormCapabilities = { readonly _meta?: { readonly [x: string]: unknown } | null; }; export const ElicitationFormCapabilities = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nForm-based elicitation capabilities.", }); export type ElicitationUrlCapabilities = { readonly _meta?: { readonly [x: string]: unknown } | null; }; export const ElicitationUrlCapabilities = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nURL-based elicitation capabilities.", }); export type EmbeddedResourceResource = | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly mimeType?: string | null; readonly text: string; readonly uri: string; } | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly blob: string; readonly mimeType?: string | null; readonly uri: string; }; export const EmbeddedResourceResource = Schema.Union([ Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), mimeType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), text: Schema.String, uri: Schema.String, }).annotate({ title: "TextResourceContents", description: "Text-based resource contents." }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), blob: Schema.String, mimeType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), uri: Schema.String, }).annotate({ title: "BlobResourceContents", description: "Binary resource contents." }), ]).annotate({ description: "Resource content that can be embedded in a message." }); export type EnumOption = { readonly const: string; readonly title: string }; export const EnumOption = Schema.Struct({ const: Schema.String.annotate({ description: "The constant value for this option." }), title: Schema.String.annotate({ description: "Human-readable title for this option." }), }).annotate({ description: "A titled enum option with a const value and human-readable title." }); export type EnvVariable = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly name: string; readonly value: string; }; export const EnvVariable = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), name: Schema.String.annotate({ description: "The name of the environment variable." }), value: Schema.String.annotate({ description: "The value to set for the environment variable." }), }).annotate({ description: "An environment variable to set when launching an MCP server." }); export type Error = { readonly code: | -32700 | -32600 | -32601 | -32602 | -32603 | -32800 | -32000 | -32002 | -32042 | number; readonly data?: unknown; readonly message: string; }; export const Error = Schema.Struct({ code: Schema.Union([ Schema.Literal(-32700).annotate({ title: "Parse error", description: "**Parse error**: Invalid JSON was received by the server.\nAn error occurred on the server while parsing the JSON text.", format: "int32", }), Schema.Literal(-32600).annotate({ title: "Invalid request", description: "**Invalid request**: The JSON sent is not a valid Request object.", format: "int32", }), Schema.Literal(-32601).annotate({ title: "Method not found", description: "**Method not found**: The method does not exist or is not available.", format: "int32", }), Schema.Literal(-32602).annotate({ title: "Invalid params", description: "**Invalid params**: Invalid method parameter(s).", format: "int32", }), Schema.Literal(-32603).annotate({ title: "Internal error", description: "**Internal error**: Internal JSON-RPC error.\nReserved for implementation-defined server errors.", format: "int32", }), Schema.Literal(-32800).annotate({ title: "Request cancelled", description: "**Request cancelled**: **UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nExecution of the method was aborted either due to a cancellation request from the caller or\nbecause of resource constraints or shutdown.", format: "int32", }), Schema.Literal(-32000).annotate({ title: "Authentication required", description: "**Authentication required**: Authentication is required before this operation can be performed.", format: "int32", }), Schema.Literal(-32002).annotate({ title: "Resource not found", description: "**Resource not found**: A given resource, such as a file, was not found.", format: "int32", }), Schema.Literal(-32042).annotate({ title: "URL elicitation required", description: "**URL elicitation required**: **UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nThe agent requires user input via a URL-based elicitation before it can proceed.", format: "int32", }), Schema.Number.annotate({ title: "Other", description: "Other undefined error code.", format: "int32", }).check(Schema.isInt()), ]).annotate({ description: "Predefined error codes for common JSON-RPC and ACP-specific errors.\n\nThese codes follow the JSON-RPC 2.0 specification for standard errors\nand use the reserved range (-32000 to -32099) for protocol-specific errors.", }), data: Schema.optionalKey( Schema.Unknown.annotate({ description: "Optional primitive or structured value that contains additional information about the error.\nThis may include debugging information or context-specific details.", }), ), message: Schema.String.annotate({ description: "A string providing a short description of the error.\nThe message should be limited to a concise single sentence.", }), }).annotate({ description: "JSON-RPC error object.\n\nRepresents an error that occurred during method execution, following the\nJSON-RPC 2.0 error object specification with optional additional data.\n\nSee protocol docs: [JSON-RPC Error Object](https://www.jsonrpc.org/specification#error_object)", }); export type HttpHeader = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly name: string; readonly value: string; }; export const HttpHeader = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), name: Schema.String.annotate({ description: "The name of the HTTP header." }), value: Schema.String.annotate({ description: "The value to set for the HTTP header." }), }).annotate({ description: "An HTTP header to set when making requests to the MCP server." }); export type Implementation = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly name: string; readonly title?: string | null; readonly version: string; }; export const Implementation = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), name: Schema.String.annotate({ description: "Intended for programmatic or logical use, but can be used as a display\nname fallback if title isn’t present.", }), title: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Intended for UI and end-user contexts — optimized to be human-readable\nand easily understood.\n\nIf not provided, the name should be used for display.", }), Schema.Null, ]), ), version: Schema.String.annotate({ description: 'Version of the implementation. Can be displayed to the user or used\nfor debugging or metrics purposes. (e.g. "1.0.0").', }), }).annotate({ description: "Metadata about the implementation of the client or agent.\nDescribes the name and version of an MCP implementation, with an optional\ntitle for UI representation.", }); export type LogoutCapabilities = { readonly _meta?: { readonly [x: string]: unknown } | null }; export const LogoutCapabilities = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nLogout capabilities supported by the agent.\n\nBy supplying `{}` it means that the agent supports the logout method.", }); export type ModelInfo = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly description?: string | null; readonly modelId: string; readonly name: string; }; export const ModelInfo = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), description: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Optional description of the model." }), Schema.Null, ]), ), modelId: Schema.String.annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA unique identifier for a model.", }), name: Schema.String.annotate({ description: "Human-readable name of the model." }), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInformation about a selectable model.", }); export type PermissionOption = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly kind: "allow_once" | "allow_always" | "reject_once" | "reject_always"; readonly name: string; readonly optionId: string; }; export const PermissionOption = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), kind: Schema.Literals(["allow_once", "allow_always", "reject_once", "reject_always"]).annotate({ description: "The type of permission option being presented to the user.\n\nHelps clients choose appropriate icons and UI treatment.", }), name: Schema.String.annotate({ description: "Human-readable label to display to the user." }), optionId: Schema.String.annotate({ description: "Unique identifier for a permission option." }), }).annotate({ description: "An option presented to the user when requesting permission." }); export type PlanEntry = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly content: string; readonly priority: "high" | "medium" | "low"; readonly status: "pending" | "in_progress" | "completed"; }; export const PlanEntry = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), content: Schema.String.annotate({ description: "Human-readable description of what this task aims to accomplish.", }), priority: Schema.Literals(["high", "medium", "low"]).annotate({ description: "Priority levels for plan entries.\n\nUsed to indicate the relative importance or urgency of different\ntasks in the execution plan.\nSee protocol docs: [Plan Entries](https://agentclientprotocol.com/protocol/agent-plan#plan-entries)", }), status: Schema.Literals(["pending", "in_progress", "completed"]).annotate({ description: "Status of a plan entry in the execution flow.\n\nTracks the lifecycle of each task from planning through completion.\nSee protocol docs: [Plan Entries](https://agentclientprotocol.com/protocol/agent-plan#plan-entries)", }), }).annotate({ description: "A single entry in the execution plan.\n\nRepresents a task or goal that the assistant intends to accomplish\nas part of fulfilling the user's request.\nSee protocol docs: [Plan Entries](https://agentclientprotocol.com/protocol/agent-plan#plan-entries)", }); export type RequestId = null | number | string; export const RequestId = Schema.Union([ Schema.Null.annotate({ title: "Null" }), Schema.Number.annotate({ title: "Number", format: "int64" }).check(Schema.isInt()), Schema.String.annotate({ title: "Str" }), ]).annotate({ description: "JSON RPC Request Id\n\nAn identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null [1] and Numbers SHOULD NOT contain fractional parts [2]\n\nThe Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects.\n\n[1] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling.\n\n[2] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions.", }); export type Role = "assistant" | "user"; export const Role = Schema.Literals(["assistant", "user"]).annotate({ description: "The sender or recipient of messages and data in a conversation.", }); export type SessionCloseCapabilities = { readonly _meta?: { readonly [x: string]: unknown } | null; }; export const SessionCloseCapabilities = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nCapabilities for the `session/close` method.\n\nBy supplying `{}` it means that the agent supports closing of sessions.", }); export type SessionConfigOptionCategory = "mode" | "model" | "thought_level" | string; export const SessionConfigOptionCategory = Schema.Union([ Schema.Literal("mode").annotate({ description: "Session mode selector." }), Schema.Literal("model").annotate({ description: "Model selector." }), Schema.Literal("thought_level").annotate({ description: "Thought/reasoning level selector." }), Schema.String.annotate({ title: "other", description: "Unknown / uncategorized selector." }), ]).annotate({ description: "Semantic category for a session configuration option.\n\nThis is intended to help Clients distinguish broadly common selectors (e.g. model selector vs\nsession mode selector vs thought/reasoning level) for UX purposes (keyboard shortcuts, icons,\nplacement). It MUST NOT be required for correctness. Clients MUST handle missing or unknown\ncategories gracefully.\n\nCategory names beginning with `_` are free for custom use, like other ACP extension methods.\nCategory names that do not begin with `_` are reserved for the ACP spec.", }); export type SessionConfigSelectOption = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly description?: string | null; readonly name: string; readonly value: string; }; export const SessionConfigSelectOption = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), description: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Optional description for this option value." }), Schema.Null, ]), ), name: Schema.String.annotate({ description: "Human-readable label for this option value." }), value: Schema.String.annotate({ description: "Unique identifier for a session configuration option value.", }), }).annotate({ description: "A possible value for a session configuration option." }); export type SessionForkCapabilities = { readonly _meta?: { readonly [x: string]: unknown } | null }; export const SessionForkCapabilities = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nCapabilities for the `session/fork` method.\n\nBy supplying `{}` it means that the agent supports forking of sessions.", }); export type SessionInfo = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly cwd: string; readonly sessionId: string; readonly title?: string | null; readonly updatedAt?: string | null; }; export const SessionInfo = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), cwd: Schema.String.annotate({ description: "The working directory for this session. Must be an absolute path.", }), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), title: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Human-readable title for the session" }), Schema.Null, ]), ), updatedAt: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "ISO 8601 timestamp of last activity" }), Schema.Null, ]), ), }).annotate({ description: "Information about a session returned by session/list" }); export type SessionListCapabilities = { readonly _meta?: { readonly [x: string]: unknown } | null }; export const SessionListCapabilities = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), }).annotate({ description: "Capabilities for the `session/list` method.\n\nBy supplying `{}` it means that the agent supports listing of sessions.", }); export type SessionModeId = string; export const SessionModeId = Schema.String.annotate({ description: "Unique identifier for a Session Mode.", }); export type SessionResumeCapabilities = { readonly _meta?: { readonly [x: string]: unknown } | null; }; export const SessionResumeCapabilities = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nCapabilities for the `session/resume` method.\n\nBy supplying `{}` it means that the agent supports resuming of sessions.", }); export type StringFormat = "email" | "uri" | "date" | "date-time"; export const StringFormat = Schema.Literals(["email", "uri", "date", "date-time"]).annotate({ description: "String format types for string properties in elicitation schemas.", }); export type TerminalExitStatus = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly exitCode?: number | null; readonly signal?: string | null; }; export const TerminalExitStatus = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), exitCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "The process exit code (may be null if terminated by signal).", format: "uint32", }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)), Schema.Null, ]), ), signal: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "The signal that terminated the process (may be null if exited normally).", }), Schema.Null, ]), ), }).annotate({ description: "Exit status of a terminal command." }); export type ToolCallLocation = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly line?: number | null; readonly path: string; }; export const ToolCallLocation = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), line: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "Optional line number within the file.", format: "uint32", }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)), Schema.Null, ]), ), path: Schema.String.annotate({ description: "The file path being accessed or modified." }), }).annotate({ description: 'A file location being accessed or modified by a tool.\n\nEnables clients to implement "follow-along" features that track\nwhich files the agent is working with in real-time.\n\nSee protocol docs: [Following the Agent](https://agentclientprotocol.com/protocol/tool-calls#following-the-agent)', }); export type ToolCallStatus = "pending" | "in_progress" | "completed" | "failed"; export const ToolCallStatus = Schema.Literals([ "pending", "in_progress", "completed", "failed", ]).annotate({ description: "Execution status of a tool call.\n\nTool calls progress through different statuses during their lifecycle.\n\nSee protocol docs: [Status](https://agentclientprotocol.com/protocol/tool-calls#status)", }); export type ToolKind = | "read" | "edit" | "delete" | "move" | "search" | "execute" | "think" | "fetch" | "switch_mode" | "other"; export const ToolKind = Schema.Literals([ "read", "edit", "delete", "move", "search", "execute", "think", "fetch", "switch_mode", "other", ]).annotate({ description: "Categories of tools that can be invoked.\n\nTool kinds help clients choose appropriate icons and optimize how they\ndisplay tool execution progress.\n\nSee protocol docs: [Creating](https://agentclientprotocol.com/protocol/tool-calls#creating)", }); export type Usage = { readonly cachedReadTokens?: number | null; readonly cachedWriteTokens?: number | null; readonly inputTokens: number; readonly outputTokens: number; readonly thoughtTokens?: number | null; readonly totalTokens: number; }; export const Usage = Schema.Struct({ cachedReadTokens: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "Total cache read tokens.", format: "uint64" }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)), Schema.Null, ]), ), cachedWriteTokens: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "Total cache write tokens.", format: "uint64" }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)), Schema.Null, ]), ), inputTokens: Schema.Number.annotate({ description: "Total input tokens across all turns.", format: "uint64", }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)), outputTokens: Schema.Number.annotate({ description: "Total output tokens across all turns.", format: "uint64", }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)), thoughtTokens: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "Total thought/reasoning tokens", format: "uint64" }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)), Schema.Null, ]), ), totalTokens: Schema.Number.annotate({ description: "Sum of all token types across session.", format: "uint64", }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nToken usage information for a prompt turn.", }); export type AuthMethod = | { readonly type: "env_var"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly description?: string | null; readonly id: string; readonly link?: string | null; readonly name: string; readonly vars: ReadonlyArray; } | { readonly type: "terminal"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly args?: ReadonlyArray; readonly description?: string | null; readonly env?: { readonly [x: string]: string }; readonly id: string; readonly name: string; } | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly description?: string | null; readonly id: string; readonly name: string; }; export const AuthMethod = Schema.Union([ Schema.Struct({ type: Schema.Literal("env_var"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), description: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Optional description providing more details about this authentication method.", }), Schema.Null, ]), ), id: Schema.String.annotate({ description: "Unique identifier for this authentication method.", }), link: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Optional link to a page where the user can obtain their credentials.", }), Schema.Null, ]), ), name: Schema.String.annotate({ description: "Human-readable name of the authentication method.", }), vars: Schema.Array(AuthEnvVar).annotate({ description: "The environment variables the client should set.", }), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nEnvironment variable authentication method.\n\nThe user provides credentials that the client passes to the agent as environment variables.", }), Schema.Struct({ type: Schema.Literal("terminal"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), args: Schema.optionalKey( Schema.Array(Schema.String).annotate({ description: "Additional arguments to pass when running the agent binary for terminal auth.", }), ), description: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Optional description providing more details about this authentication method.", }), Schema.Null, ]), ), env: Schema.optionalKey( Schema.Record(Schema.String, Schema.String).annotate({ description: "Additional environment variables to set when running the agent binary for terminal auth.", }), ), id: Schema.String.annotate({ description: "Unique identifier for this authentication method.", }), name: Schema.String.annotate({ description: "Human-readable name of the authentication method.", }), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nTerminal-based authentication method.\n\nThe client runs an interactive terminal for the user to authenticate via a TUI.", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), description: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Optional description providing more details about this authentication method.", }), Schema.Null, ]), ), id: Schema.String.annotate({ description: "Unique identifier for this authentication method.", }), name: Schema.String.annotate({ description: "Human-readable name of the authentication method.", }), }).annotate({ title: "agent", description: "Agent handles authentication itself.\n\nThis is the default authentication method type.", }), ]).annotate({ description: "Describes an available authentication method.\n\nThe `type` field acts as the discriminator in the serialized JSON form.\nWhen no `type` is present, the method is treated as `agent`.", }); export type AvailableCommand = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly description: string; readonly input?: AvailableCommandInput | null; readonly name: string; }; export const AvailableCommand = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), description: Schema.String.annotate({ description: "Human-readable description of what the command does.", }), input: Schema.optionalKey( Schema.Union([AvailableCommandInput, Schema.Null]).annotate({ description: "Input for the command if required", }), ), name: Schema.String.annotate({ description: "Command name (e.g., `create_plan`, `research_codebase`).", }), }).annotate({ description: "Information about a command." }); export type ElicitationCapabilities = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly form?: ElicitationFormCapabilities | null; readonly url?: ElicitationUrlCapabilities | null; }; export const ElicitationCapabilities = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), form: Schema.optionalKey( Schema.Union([ElicitationFormCapabilities, Schema.Null]).annotate({ description: "Whether the client supports form-based elicitation.", }), ), url: Schema.optionalKey( Schema.Union([ElicitationUrlCapabilities, Schema.Null]).annotate({ description: "Whether the client supports URL-based elicitation.", }), ), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nElicitation capabilities supported by the client.", }); export type McpServer = | { readonly type: "http"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly headers: ReadonlyArray; readonly name: string; readonly url: string; } | { readonly type: "sse"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly headers: ReadonlyArray; readonly name: string; readonly url: string; } | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly args: ReadonlyArray; readonly command: string; readonly env: ReadonlyArray; readonly name: string; }; export const McpServer = Schema.Union([ Schema.Struct({ type: Schema.Literal("http"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), headers: Schema.Array(HttpHeader).annotate({ description: "HTTP headers to set when making requests to the MCP server.", }), name: Schema.String.annotate({ description: "Human-readable name identifying this MCP server.", }), url: Schema.String.annotate({ description: "URL to the MCP server." }), }).annotate({ description: "HTTP transport configuration for MCP." }), Schema.Struct({ type: Schema.Literal("sse"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), headers: Schema.Array(HttpHeader).annotate({ description: "HTTP headers to set when making requests to the MCP server.", }), name: Schema.String.annotate({ description: "Human-readable name identifying this MCP server.", }), url: Schema.String.annotate({ description: "URL to the MCP server." }), }).annotate({ description: "SSE transport configuration for MCP." }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), args: Schema.Array(Schema.String).annotate({ description: "Command-line arguments to pass to the MCP server.", }), command: Schema.String.annotate({ description: "Path to the MCP server executable." }), env: Schema.Array(EnvVariable).annotate({ description: "Environment variables to set when launching the MCP server.", }), name: Schema.String.annotate({ description: "Human-readable name identifying this MCP server.", }), }).annotate({ title: "stdio", description: "Stdio transport configuration for MCP." }), ]).annotate({ description: "Configuration for connecting to an MCP (Model Context Protocol) server.\n\nMCP servers provide tools and context that the agent can use when\nprocessing prompts.\n\nSee protocol docs: [MCP Servers](https://agentclientprotocol.com/protocol/session-setup#mcp-servers)", }); export type SessionModelState = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly availableModels: ReadonlyArray; readonly currentModelId: string; }; export const SessionModelState = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), availableModels: Schema.Array(ModelInfo).annotate({ description: "The set of models that the Agent can use", }), currentModelId: Schema.String.annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA unique identifier for a model.", }), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nThe set of models and the one currently active.", }); export type Annotations = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly audience?: ReadonlyArray | null; readonly lastModified?: string | null; readonly priority?: number | null; }; export const Annotations = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), audience: Schema.optionalKey(Schema.Union([Schema.Array(Role), Schema.Null])), lastModified: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), priority: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "double" }).check(Schema.isFinite()), Schema.Null, ]), ), }).annotate({ description: "Optional annotations for the client. The client can use annotations to inform how objects are used or displayed", }); export type SessionConfigSelectGroup = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly group: string; readonly name: string; readonly options: ReadonlyArray; }; export const SessionConfigSelectGroup = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), group: Schema.String.annotate({ description: "Unique identifier for a session configuration option value group.", }), name: Schema.String.annotate({ description: "Human-readable label for this group." }), options: Schema.Array(SessionConfigSelectOption).annotate({ description: "The set of option values in this group.", }), }).annotate({ description: "A group of possible values for a session configuration option." }); export type SessionMode = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly description?: string | null; readonly id: SessionModeId; readonly name: string; }; export const SessionMode = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), id: SessionModeId, name: Schema.String, }).annotate({ description: "A mode the agent can operate in.\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)", }); export type ElicitationPropertySchema = | { readonly type: "string"; readonly default?: string | null; readonly description?: string | null; readonly enum?: ReadonlyArray | null; readonly format?: StringFormat | null; readonly maxLength?: number | null; readonly minLength?: number | null; readonly oneOf?: ReadonlyArray | null; readonly pattern?: string | null; readonly title?: string | null; } | { readonly type: "number"; readonly default?: number | null; readonly description?: string | null; readonly maximum?: number | null; readonly minimum?: number | null; readonly title?: string | null; } | { readonly type: "integer"; readonly default?: number | null; readonly description?: string | null; readonly maximum?: number | null; readonly minimum?: number | null; readonly title?: string | null; } | { readonly type: "boolean"; readonly default?: boolean | null; readonly description?: string | null; readonly title?: string | null; } | { readonly type: "array"; readonly default?: ReadonlyArray | null; readonly description?: string | null; readonly items: | { readonly enum: ReadonlyArray; readonly type: "string" } | { readonly anyOf: ReadonlyArray }; readonly maxItems?: number | null; readonly minItems?: number | null; readonly title?: string | null; }; export const ElicitationPropertySchema = Schema.Union( [ Schema.Struct({ type: Schema.Literal("string"), default: Schema.optionalKey( Schema.Union([Schema.String.annotate({ description: "Default value." }), Schema.Null]), ), description: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Human-readable description." }), Schema.Null, ]), ), enum: Schema.optionalKey( Schema.Union([ Schema.Array(Schema.String).annotate({ description: "Enum values for untitled single-select enums.", }), Schema.Null, ]), ), format: Schema.optionalKey( Schema.Union([StringFormat, Schema.Null]).annotate({ description: "String format." }), ), maxLength: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "Maximum string length.", format: "uint32" }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)), Schema.Null, ]), ), minLength: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "Minimum string length.", format: "uint32" }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)), Schema.Null, ]), ), oneOf: Schema.optionalKey( Schema.Union([ Schema.Array(EnumOption).annotate({ description: "Titled enum options for titled single-select enums.", }), Schema.Null, ]), ), pattern: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Pattern the string must match." }), Schema.Null, ]), ), title: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Optional title for the property." }), Schema.Null, ]), ), }).annotate({ description: 'Schema for string properties in an elicitation form.\n\nWhen `enum` or `oneOf` is set, this represents a single-select enum\nwith `"type": "string"`.', }), Schema.Struct({ type: Schema.Literal("number"), default: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "Default value.", format: "double" }).check( Schema.isFinite(), ), Schema.Null, ]), ), description: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Human-readable description." }), Schema.Null, ]), ), maximum: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "Maximum value (inclusive).", format: "double", }).check(Schema.isFinite()), Schema.Null, ]), ), minimum: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "Minimum value (inclusive).", format: "double", }).check(Schema.isFinite()), Schema.Null, ]), ), title: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Optional title for the property." }), Schema.Null, ]), ), }).annotate({ description: "Schema for number (floating-point) properties in an elicitation form.", }), Schema.Struct({ type: Schema.Literal("integer"), default: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "Default value.", format: "int64" }).check( Schema.isInt(), ), Schema.Null, ]), ), description: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Human-readable description." }), Schema.Null, ]), ), maximum: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "Maximum value (inclusive).", format: "int64", }).check(Schema.isInt()), Schema.Null, ]), ), minimum: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "Minimum value (inclusive).", format: "int64", }).check(Schema.isInt()), Schema.Null, ]), ), title: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Optional title for the property." }), Schema.Null, ]), ), }).annotate({ description: "Schema for integer properties in an elicitation form." }), Schema.Struct({ type: Schema.Literal("boolean"), default: Schema.optionalKey( Schema.Union([Schema.Boolean.annotate({ description: "Default value." }), Schema.Null]), ), description: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Human-readable description." }), Schema.Null, ]), ), title: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Optional title for the property." }), Schema.Null, ]), ), }).annotate({ description: "Schema for boolean properties in an elicitation form." }), Schema.Struct({ type: Schema.Literal("array"), default: Schema.optionalKey( Schema.Union([ Schema.Array(Schema.String).annotate({ description: "Default selected values." }), Schema.Null, ]), ), description: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Human-readable description." }), Schema.Null, ]), ), items: Schema.Union([ Schema.Struct({ enum: Schema.Array(Schema.String).annotate({ description: "Allowed enum values." }), type: Schema.Literal("string").annotate({ description: "Items definition for untitled multi-select enum properties.", }), }).annotate({ title: "Untitled", description: "Items definition for untitled multi-select enum properties.", }), Schema.Struct({ anyOf: Schema.Array(EnumOption).annotate({ description: "Titled enum options." }), }).annotate({ title: "Titled", description: "Items definition for titled multi-select enum properties.", }), ]).annotate({ description: "Items for a multi-select (array) property schema." }), maxItems: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "Maximum number of items to select.", format: "uint64", }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)), Schema.Null, ]), ), minItems: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "Minimum number of items to select.", format: "uint64", }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)), Schema.Null, ]), ), title: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Optional title for the property." }), Schema.Null, ]), ), }).annotate({ description: "Schema for multi-select (array) properties in an elicitation form.", }), ], { mode: "oneOf" }, ).annotate({ description: 'Property schema for elicitation form fields.\n\nEach variant corresponds to a JSON Schema `"type"` value.\nSingle-select enums use the `String` variant with `enum` or `oneOf` set.\nMulti-select enums use the `Array` variant.', }); export type ContentBlock = | { readonly type: "text"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly text: string; } | { readonly type: "image"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly data: string; readonly mimeType: string; readonly uri?: string | null; } | { readonly type: "audio"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly data: string; readonly mimeType: string; } | { readonly type: "resource_link"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly description?: string | null; readonly mimeType?: string | null; readonly name: string; readonly size?: number | null; readonly title?: string | null; readonly uri: string; } | { readonly type: "resource"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly resource: EmbeddedResourceResource; }; export const ContentBlock = Schema.Union( [ Schema.Struct({ type: Schema.Literal("text"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), text: Schema.String, }).annotate({ description: "Text provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("image"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), data: Schema.String, mimeType: Schema.String, uri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), }).annotate({ description: "An image provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("audio"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), data: Schema.String, mimeType: Schema.String, }).annotate({ description: "Audio provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("resource_link"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), mimeType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), name: Schema.String, size: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null, ]), ), title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), uri: Schema.String, }).annotate({ description: "A resource that the server is capable of reading, included in a prompt or tool call result.", }), Schema.Struct({ type: Schema.Literal("resource"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), resource: EmbeddedResourceResource, }).annotate({ description: "The contents of a resource, embedded into a prompt or tool call result.", }), ], { mode: "oneOf" }, ).annotate({ description: "Content blocks represent displayable information in the Agent Client Protocol.\n\nThey provide a structured way to handle various types of user-facing content—whether\nit's text from language models, images for analysis, or embedded resources for context.\n\nContent blocks appear in:\n- User prompts sent via `session/prompt`\n- Language model output streamed through `session/update` notifications\n- Progress updates and results from tool calls\n\nThis structure is compatible with the Model Context Protocol (MCP), enabling\nagents to seamlessly forward content from MCP tool outputs without transformation.\n\nSee protocol docs: [Content](https://agentclientprotocol.com/protocol/content)", }); export type ToolCallContent = | { readonly type: "content"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly content: | { readonly type: "text"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly text: string; } | { readonly type: "image"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly data: string; readonly mimeType: string; readonly uri?: string | null; } | { readonly type: "audio"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly data: string; readonly mimeType: string; } | { readonly type: "resource_link"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly description?: string | null; readonly mimeType?: string | null; readonly name: string; readonly size?: number | null; readonly title?: string | null; readonly uri: string; } | { readonly type: "resource"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly resource: EmbeddedResourceResource; }; } | { readonly type: "diff"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly newText: string; readonly oldText?: string | null; readonly path: string; } | { readonly type: "terminal"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly terminalId: string; }; export const ToolCallContent = Schema.Union( [ Schema.Struct({ type: Schema.Literal("content"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), content: Schema.Union( [ Schema.Struct({ type: Schema.Literal("text"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), text: Schema.String, }).annotate({ description: "Text provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("image"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), data: Schema.String, mimeType: Schema.String, uri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), }).annotate({ description: "An image provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("audio"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), data: Schema.String, mimeType: Schema.String, }).annotate({ description: "Audio provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("resource_link"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), mimeType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), name: Schema.String, size: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null, ]), ), title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), uri: Schema.String, }).annotate({ description: "A resource that the server is capable of reading, included in a prompt or tool call result.", }), Schema.Struct({ type: Schema.Literal("resource"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), resource: EmbeddedResourceResource, }).annotate({ description: "The contents of a resource, embedded into a prompt or tool call result.", }), ], { mode: "oneOf" }, ).annotate({ description: "Content blocks represent displayable information in the Agent Client Protocol.\n\nThey provide a structured way to handle various types of user-facing content—whether\nit's text from language models, images for analysis, or embedded resources for context.\n\nContent blocks appear in:\n- User prompts sent via `session/prompt`\n- Language model output streamed through `session/update` notifications\n- Progress updates and results from tool calls\n\nThis structure is compatible with the Model Context Protocol (MCP), enabling\nagents to seamlessly forward content from MCP tool outputs without transformation.\n\nSee protocol docs: [Content](https://agentclientprotocol.com/protocol/content)", }), }).annotate({ description: "Standard content block (text, images, resources)." }), Schema.Struct({ type: Schema.Literal("diff"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), newText: Schema.String.annotate({ description: "The new content after modification." }), oldText: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "The original content (None for new files)." }), Schema.Null, ]), ), path: Schema.String.annotate({ description: "The file path being modified." }), }).annotate({ description: "A diff representing file modifications.\n\nShows changes to files in a format suitable for display in the client UI.\n\nSee protocol docs: [Content](https://agentclientprotocol.com/protocol/tool-calls#content)", }), Schema.Struct({ type: Schema.Literal("terminal"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), terminalId: Schema.String, }).annotate({ description: "Embed a terminal created with `terminal/create` by its id.\n\nThe terminal must be added before calling `terminal/release`.\n\nSee protocol docs: [Terminal](https://agentclientprotocol.com/protocol/terminals)", }), ], { mode: "oneOf" }, ).annotate({ description: "Content produced by a tool call.\n\nTool calls can produce different types of content including\nstandard content blocks (text, images) or file diffs.\n\nSee protocol docs: [Content](https://agentclientprotocol.com/protocol/tool-calls#content)", }); export type SessionConfigOption = | { readonly type: "select"; readonly currentValue: string; readonly options: | ReadonlyArray | ReadonlyArray; readonly _meta?: { readonly [x: string]: unknown } | null; readonly category?: SessionConfigOptionCategory | null; readonly description?: string | null; readonly id: string; readonly name: string; } | { readonly type: "boolean"; readonly currentValue: boolean; readonly _meta?: { readonly [x: string]: unknown } | null; readonly category?: SessionConfigOptionCategory | null; readonly description?: string | null; readonly id: string; readonly name: string; }; export const SessionConfigOption = Schema.Union([ Schema.Struct({ type: Schema.Literal("select"), currentValue: Schema.String.annotate({ description: "Unique identifier for a session configuration option value.", }), options: Schema.Union([ Schema.Array(SessionConfigSelectOption).annotate({ title: "Ungrouped", description: "A flat list of options with no grouping.", }), Schema.Array(SessionConfigSelectGroup).annotate({ title: "Grouped", description: "A list of options grouped under headers.", }), ]).annotate({ description: "Possible values for a session configuration option." }), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), category: Schema.optionalKey( Schema.Union([SessionConfigOptionCategory, Schema.Null]).annotate({ description: "Optional semantic category for this option (UX only).", }), ), description: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Optional description for the Client to display to the user.", }), Schema.Null, ]), ), id: Schema.String.annotate({ description: "Unique identifier for a session configuration option.", }), name: Schema.String.annotate({ description: "Human-readable label for the option." }), }).annotate({ description: "A session configuration option selector and its current state." }), Schema.Struct({ type: Schema.Literal("boolean"), currentValue: Schema.Boolean.annotate({ description: "The current value of the boolean option.", }), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), category: Schema.optionalKey( Schema.Union([SessionConfigOptionCategory, Schema.Null]).annotate({ description: "Optional semantic category for this option (UX only).", }), ), description: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Optional description for the Client to display to the user.", }), Schema.Null, ]), ), id: Schema.String.annotate({ description: "Unique identifier for a session configuration option.", }), name: Schema.String.annotate({ description: "Human-readable label for the option." }), }).annotate({ description: "A session configuration option selector and its current state." }), ]); export type SessionModeState = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly availableModes: ReadonlyArray; readonly currentModeId: string; }; export const SessionModeState = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), availableModes: Schema.Array(SessionMode).annotate({ description: "The set of modes that the Agent can operate in", }), currentModeId: Schema.String.annotate({ description: "Unique identifier for a Session Mode." }), }).annotate({ description: "The set of modes and the one currently active." }); export type AgentAuthCapabilities = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly logout?: LogoutCapabilities | null; }; export const AgentAuthCapabilities = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), logout: Schema.optionalKey( Schema.Union([LogoutCapabilities, Schema.Null]).annotate({ description: "Whether the agent supports the logout method.\n\nBy supplying `{}` it means that the agent supports the logout method.", }), ), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nAuthentication-related capabilities supported by the agent.", }); export type AgentCapabilities = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly auth?: { readonly _meta?: { readonly [x: string]: unknown } | null; readonly logout?: LogoutCapabilities | null; }; readonly loadSession?: boolean; readonly mcpCapabilities?: { readonly _meta?: { readonly [x: string]: unknown } | null; readonly http?: boolean; readonly sse?: boolean; }; readonly promptCapabilities?: { readonly _meta?: { readonly [x: string]: unknown } | null; readonly audio?: boolean; readonly embeddedContext?: boolean; readonly image?: boolean; }; readonly sessionCapabilities?: { readonly _meta?: { readonly [x: string]: unknown } | null; readonly close?: SessionCloseCapabilities | null; readonly fork?: SessionForkCapabilities | null; readonly list?: SessionListCapabilities | null; readonly resume?: SessionResumeCapabilities | null; }; }; export const AgentCapabilities = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), auth: Schema.optionalKey( Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), logout: Schema.optionalKey( Schema.Union([LogoutCapabilities, Schema.Null]).annotate({ description: "Whether the agent supports the logout method.\n\nBy supplying `{}` it means that the agent supports the logout method.", }), ), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nAuthentication-related capabilities supported by the agent.", default: {}, }), ), loadSession: Schema.optionalKey( Schema.Boolean.annotate({ description: "Whether the agent supports `session/load`.", default: false, }), ), mcpCapabilities: Schema.optionalKey( Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), http: Schema.optionalKey( Schema.Boolean.annotate({ description: "Agent supports [`McpServer::Http`].", default: false, }), ), sse: Schema.optionalKey( Schema.Boolean.annotate({ description: "Agent supports [`McpServer::Sse`].", default: false, }), ), }).annotate({ description: "MCP capabilities supported by the agent", default: { http: false, sse: false }, }), ), promptCapabilities: Schema.optionalKey( Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), audio: Schema.optionalKey( Schema.Boolean.annotate({ description: "Agent supports [`ContentBlock::Audio`].", default: false, }), ), embeddedContext: Schema.optionalKey( Schema.Boolean.annotate({ description: "Agent supports embedded context in `session/prompt` requests.\n\nWhen enabled, the Client is allowed to include [`ContentBlock::Resource`]\nin prompt requests for pieces of context that are referenced in the message.", default: false, }), ), image: Schema.optionalKey( Schema.Boolean.annotate({ description: "Agent supports [`ContentBlock::Image`].", default: false, }), ), }).annotate({ description: "Prompt capabilities supported by the agent in `session/prompt` requests.\n\nBaseline agent functionality requires support for [`ContentBlock::Text`]\nand [`ContentBlock::ResourceLink`] in prompt requests.\n\nOther variants must be explicitly opted in to.\nCapabilities for different types of content in prompt requests.\n\nIndicates which content types beyond the baseline (text and resource links)\nthe agent can process.\n\nSee protocol docs: [Prompt Capabilities](https://agentclientprotocol.com/protocol/initialization#prompt-capabilities)", default: { audio: false, embeddedContext: false, image: false }, }), ), sessionCapabilities: Schema.optionalKey( Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), close: Schema.optionalKey( Schema.Union([SessionCloseCapabilities, Schema.Null]).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nWhether the agent supports `session/close`.", }), ), fork: Schema.optionalKey( Schema.Union([SessionForkCapabilities, Schema.Null]).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nWhether the agent supports `session/fork`.", }), ), list: Schema.optionalKey( Schema.Union([SessionListCapabilities, Schema.Null]).annotate({ description: "Whether the agent supports `session/list`.", }), ), resume: Schema.optionalKey( Schema.Union([SessionResumeCapabilities, Schema.Null]).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nWhether the agent supports `session/resume`.", }), ), }).annotate({ default: {}, description: "Session capabilities supported by the agent.\n\nAs a baseline, all Agents **MUST** support `session/new`, `session/prompt`, `session/cancel`, and `session/update`.\n\nOptionally, they **MAY** support other session methods and notifications by specifying additional capabilities.\n\nNote: `session/load` is still handled by the top-level `load_session` capability. This will be unified in future versions of the protocol.\n\nSee protocol docs: [Session Capabilities](https://agentclientprotocol.com/protocol/initialization#session-capabilities)", }), ), }).annotate({ description: "Capabilities supported by the agent.\n\nAdvertised during initialization to inform the client about\navailable features and content types.\n\nSee protocol docs: [Agent Capabilities](https://agentclientprotocol.com/protocol/initialization#agent-capabilities)", }); export type AgentNotification = { readonly method: string; readonly params?: | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly sessionId: string; readonly update: | { readonly sessionUpdate: "user_message_chunk"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly content: | { readonly type: "text"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly text: string; } | { readonly type: "image"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly data: string; readonly mimeType: string; readonly uri?: string | null; } | { readonly type: "audio"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly data: string; readonly mimeType: string; } | { readonly type: "resource_link"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly description?: string | null; readonly mimeType?: string | null; readonly name: string; readonly size?: number | null; readonly title?: string | null; readonly uri: string; } | { readonly type: "resource"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly resource: EmbeddedResourceResource; }; readonly messageId?: string | null; } | { readonly sessionUpdate: "agent_message_chunk"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly content: | { readonly type: "text"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly text: string; } | { readonly type: "image"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly data: string; readonly mimeType: string; readonly uri?: string | null; } | { readonly type: "audio"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly data: string; readonly mimeType: string; } | { readonly type: "resource_link"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly description?: string | null; readonly mimeType?: string | null; readonly name: string; readonly size?: number | null; readonly title?: string | null; readonly uri: string; } | { readonly type: "resource"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly resource: EmbeddedResourceResource; }; readonly messageId?: string | null; } | { readonly sessionUpdate: "agent_thought_chunk"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly content: | { readonly type: "text"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly text: string; } | { readonly type: "image"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly data: string; readonly mimeType: string; readonly uri?: string | null; } | { readonly type: "audio"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly data: string; readonly mimeType: string; } | { readonly type: "resource_link"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly description?: string | null; readonly mimeType?: string | null; readonly name: string; readonly size?: number | null; readonly title?: string | null; readonly uri: string; } | { readonly type: "resource"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly resource: EmbeddedResourceResource; }; readonly messageId?: string | null; } | { readonly sessionUpdate: "tool_call"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly content?: ReadonlyArray; readonly kind?: | "read" | "edit" | "delete" | "move" | "search" | "execute" | "think" | "fetch" | "switch_mode" | "other"; readonly locations?: ReadonlyArray; readonly rawInput?: unknown; readonly rawOutput?: unknown; readonly status?: "pending" | "in_progress" | "completed" | "failed"; readonly title: string; readonly toolCallId: string; } | { readonly sessionUpdate: "tool_call_update"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly content?: ReadonlyArray | null; readonly kind?: ToolKind | null; readonly locations?: ReadonlyArray | null; readonly rawInput?: unknown; readonly rawOutput?: unknown; readonly status?: ToolCallStatus | null; readonly title?: string | null; readonly toolCallId: string; } | { readonly sessionUpdate: "plan"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly entries: ReadonlyArray; } | { readonly sessionUpdate: "available_commands_update"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly availableCommands: ReadonlyArray; } | { readonly sessionUpdate: "current_mode_update"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly currentModeId: string; } | { readonly sessionUpdate: "config_option_update"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly configOptions: ReadonlyArray; } | { readonly sessionUpdate: "session_info_update"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly title?: string | null; readonly updatedAt?: string | null; } | { readonly sessionUpdate: "usage_update"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly cost?: Cost | null; readonly size: number; readonly used: number; }; } | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly elicitationId: string } | unknown | null; }; export const AgentNotification = Schema.Struct({ method: Schema.String, params: Schema.optionalKey( Schema.Union([ Schema.Union([ Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), update: Schema.Union( [ Schema.Struct({ sessionUpdate: Schema.Literal("user_message_chunk"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), content: Schema.Union( [ Schema.Struct({ type: Schema.Literal("text"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), text: Schema.String, }).annotate({ description: "Text provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("image"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), data: Schema.String, mimeType: Schema.String, uri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), }).annotate({ description: "An image provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("audio"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), data: Schema.String, mimeType: Schema.String, }).annotate({ description: "Audio provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("resource_link"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), mimeType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), name: Schema.String, size: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null, ]), ), title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), uri: Schema.String, }).annotate({ description: "A resource that the server is capable of reading, included in a prompt or tool call result.", }), Schema.Struct({ type: Schema.Literal("resource"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), resource: EmbeddedResourceResource, }).annotate({ description: "The contents of a resource, embedded into a prompt or tool call result.", }), ], { mode: "oneOf" }, ).annotate({ description: "Content blocks represent displayable information in the Agent Client Protocol.\n\nThey provide a structured way to handle various types of user-facing content—whether\nit's text from language models, images for analysis, or embedded resources for context.\n\nContent blocks appear in:\n- User prompts sent via `session/prompt`\n- Language model output streamed through `session/update` notifications\n- Progress updates and results from tool calls\n\nThis structure is compatible with the Model Context Protocol (MCP), enabling\nagents to seamlessly forward content from MCP tool outputs without transformation.\n\nSee protocol docs: [Content](https://agentclientprotocol.com/protocol/content)", }), messageId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA unique identifier for the message this chunk belongs to.\n\nAll chunks belonging to the same message share the same `messageId`.\nA change in `messageId` indicates a new message has started.\nBoth clients and agents MUST use UUID format for message IDs.", }), Schema.Null, ]), ), }).annotate({ description: "A streamed item of content" }), Schema.Struct({ sessionUpdate: Schema.Literal("agent_message_chunk"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), content: Schema.Union( [ Schema.Struct({ type: Schema.Literal("text"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), text: Schema.String, }).annotate({ description: "Text provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("image"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), data: Schema.String, mimeType: Schema.String, uri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), }).annotate({ description: "An image provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("audio"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), data: Schema.String, mimeType: Schema.String, }).annotate({ description: "Audio provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("resource_link"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), mimeType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), name: Schema.String, size: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null, ]), ), title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), uri: Schema.String, }).annotate({ description: "A resource that the server is capable of reading, included in a prompt or tool call result.", }), Schema.Struct({ type: Schema.Literal("resource"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), resource: EmbeddedResourceResource, }).annotate({ description: "The contents of a resource, embedded into a prompt or tool call result.", }), ], { mode: "oneOf" }, ).annotate({ description: "Content blocks represent displayable information in the Agent Client Protocol.\n\nThey provide a structured way to handle various types of user-facing content—whether\nit's text from language models, images for analysis, or embedded resources for context.\n\nContent blocks appear in:\n- User prompts sent via `session/prompt`\n- Language model output streamed through `session/update` notifications\n- Progress updates and results from tool calls\n\nThis structure is compatible with the Model Context Protocol (MCP), enabling\nagents to seamlessly forward content from MCP tool outputs without transformation.\n\nSee protocol docs: [Content](https://agentclientprotocol.com/protocol/content)", }), messageId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA unique identifier for the message this chunk belongs to.\n\nAll chunks belonging to the same message share the same `messageId`.\nA change in `messageId` indicates a new message has started.\nBoth clients and agents MUST use UUID format for message IDs.", }), Schema.Null, ]), ), }).annotate({ description: "A streamed item of content" }), Schema.Struct({ sessionUpdate: Schema.Literal("agent_thought_chunk"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), content: Schema.Union( [ Schema.Struct({ type: Schema.Literal("text"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), text: Schema.String, }).annotate({ description: "Text provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("image"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), data: Schema.String, mimeType: Schema.String, uri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), }).annotate({ description: "An image provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("audio"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), data: Schema.String, mimeType: Schema.String, }).annotate({ description: "Audio provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("resource_link"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), mimeType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), name: Schema.String, size: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null, ]), ), title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), uri: Schema.String, }).annotate({ description: "A resource that the server is capable of reading, included in a prompt or tool call result.", }), Schema.Struct({ type: Schema.Literal("resource"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), resource: EmbeddedResourceResource, }).annotate({ description: "The contents of a resource, embedded into a prompt or tool call result.", }), ], { mode: "oneOf" }, ).annotate({ description: "Content blocks represent displayable information in the Agent Client Protocol.\n\nThey provide a structured way to handle various types of user-facing content—whether\nit's text from language models, images for analysis, or embedded resources for context.\n\nContent blocks appear in:\n- User prompts sent via `session/prompt`\n- Language model output streamed through `session/update` notifications\n- Progress updates and results from tool calls\n\nThis structure is compatible with the Model Context Protocol (MCP), enabling\nagents to seamlessly forward content from MCP tool outputs without transformation.\n\nSee protocol docs: [Content](https://agentclientprotocol.com/protocol/content)", }), messageId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA unique identifier for the message this chunk belongs to.\n\nAll chunks belonging to the same message share the same `messageId`.\nA change in `messageId` indicates a new message has started.\nBoth clients and agents MUST use UUID format for message IDs.", }), Schema.Null, ]), ), }).annotate({ description: "A streamed item of content" }), Schema.Struct({ sessionUpdate: Schema.Literal("tool_call"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), content: Schema.optionalKey( Schema.Array(ToolCallContent).annotate({ description: "Content produced by the tool call.", }), ), kind: Schema.optionalKey( Schema.Literals([ "read", "edit", "delete", "move", "search", "execute", "think", "fetch", "switch_mode", "other", ]).annotate({ description: "Categories of tools that can be invoked.\n\nTool kinds help clients choose appropriate icons and optimize how they\ndisplay tool execution progress.\n\nSee protocol docs: [Creating](https://agentclientprotocol.com/protocol/tool-calls#creating)", }), ), locations: Schema.optionalKey( Schema.Array(ToolCallLocation).annotate({ description: 'File locations affected by this tool call.\nEnables "follow-along" features in clients.', }), ), rawInput: Schema.optionalKey( Schema.Unknown.annotate({ description: "Raw input parameters sent to the tool.", }), ), rawOutput: Schema.optionalKey( Schema.Unknown.annotate({ description: "Raw output returned by the tool." }), ), status: Schema.optionalKey( Schema.Literals(["pending", "in_progress", "completed", "failed"]).annotate({ description: "Execution status of a tool call.\n\nTool calls progress through different statuses during their lifecycle.\n\nSee protocol docs: [Status](https://agentclientprotocol.com/protocol/tool-calls#status)", }), ), title: Schema.String.annotate({ description: "Human-readable title describing what the tool is doing.", }), toolCallId: Schema.String.annotate({ description: "Unique identifier for a tool call within a session.", }), }).annotate({ description: "Represents a tool call that the language model has requested.\n\nTool calls are actions that the agent executes on behalf of the language model,\nsuch as reading files, executing code, or fetching data from external sources.\n\nSee protocol docs: [Tool Calls](https://agentclientprotocol.com/protocol/tool-calls)", }), Schema.Struct({ sessionUpdate: Schema.Literal("tool_call_update"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), content: Schema.optionalKey( Schema.Union([ Schema.Array(ToolCallContent).annotate({ description: "Replace the content collection.", }), Schema.Null, ]), ), kind: Schema.optionalKey( Schema.Union([ToolKind, Schema.Null]).annotate({ description: "Update the tool kind.", }), ), locations: Schema.optionalKey( Schema.Union([ Schema.Array(ToolCallLocation).annotate({ description: "Replace the locations collection.", }), Schema.Null, ]), ), rawInput: Schema.optionalKey( Schema.Unknown.annotate({ description: "Update the raw input." }), ), rawOutput: Schema.optionalKey( Schema.Unknown.annotate({ description: "Update the raw output." }), ), status: Schema.optionalKey( Schema.Union([ToolCallStatus, Schema.Null]).annotate({ description: "Update the execution status.", }), ), title: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Update the human-readable title." }), Schema.Null, ]), ), toolCallId: Schema.String.annotate({ description: "Unique identifier for a tool call within a session.", }), }).annotate({ description: "An update to an existing tool call.\n\nUsed to report progress and results as tools execute. All fields except\nthe tool call ID are optional - only changed fields need to be included.\n\nSee protocol docs: [Updating](https://agentclientprotocol.com/protocol/tool-calls#updating)", }), Schema.Struct({ sessionUpdate: Schema.Literal("plan"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), entries: Schema.Array(PlanEntry).annotate({ description: "The list of tasks to be accomplished.\n\nWhen updating a plan, the agent must send a complete list of all entries\nwith their current status. The client replaces the entire plan with each update.", }), }).annotate({ description: "An execution plan for accomplishing complex tasks.\n\nPlans consist of multiple entries representing individual tasks or goals.\nAgents report plans to clients to provide visibility into their execution strategy.\nPlans can evolve during execution as the agent discovers new requirements or completes tasks.\n\nSee protocol docs: [Agent Plan](https://agentclientprotocol.com/protocol/agent-plan)", }), Schema.Struct({ sessionUpdate: Schema.Literal("available_commands_update"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), availableCommands: Schema.Array(AvailableCommand).annotate({ description: "Commands the agent can execute", }), }).annotate({ description: "Available commands are ready or have changed" }), Schema.Struct({ sessionUpdate: Schema.Literal("current_mode_update"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), currentModeId: Schema.String.annotate({ description: "Unique identifier for a Session Mode.", }), }).annotate({ description: "The current mode of the session has changed\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)", }), Schema.Struct({ sessionUpdate: Schema.Literal("config_option_update"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), configOptions: Schema.Array(SessionConfigOption).annotate({ description: "The full set of configuration options and their current values.", }), }).annotate({ description: "Session configuration options have been updated." }), Schema.Struct({ sessionUpdate: Schema.Literal("session_info_update"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), title: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Human-readable title for the session. Set to null to clear.", }), Schema.Null, ]), ), updatedAt: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "ISO 8601 timestamp of last activity. Set to null to clear.", }), Schema.Null, ]), ), }).annotate({ description: "Update to session metadata. All fields are optional to support partial updates.\n\nAgents send this notification to update session information like title or custom metadata.\nThis allows clients to display dynamic session names and track session state changes.", }), Schema.Struct({ sessionUpdate: Schema.Literal("usage_update"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), cost: Schema.optionalKey( Schema.Union([Cost, Schema.Null]).annotate({ description: "Cumulative session cost (optional).", }), ), size: Schema.Number.annotate({ description: "Total context window size in tokens.", format: "uint64", }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)), used: Schema.Number.annotate({ description: "Tokens currently in context.", format: "uint64", }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nContext window and cost update for a session.", }), ], { mode: "oneOf" }, ).annotate({ description: "Different types of updates that can be sent during session processing.\n\nThese updates provide real-time feedback about the agent's progress.\n\nSee protocol docs: [Agent Reports Output](https://agentclientprotocol.com/protocol/prompt-turn#3-agent-reports-output)", }), }).annotate({ title: "SessionNotification", description: "Notification containing a session update from the agent.\n\nUsed to stream real-time progress and results during prompt processing.\n\nSee protocol docs: [Agent Reports Output](https://agentclientprotocol.com/protocol/prompt-turn#3-agent-reports-output)", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), elicitationId: Schema.String.annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nUnique identifier for an elicitation.", }), }).annotate({ title: "ElicitationCompleteNotification", description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nNotification sent by the agent when a URL-based elicitation is complete.", }), Schema.Unknown.annotate({ title: "ExtNotification", description: "Allows 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)", }), ]).annotate({ description: "All possible notifications that an agent can send to a client.\n\nThis enum is used internally for routing RPC notifications. You typically won't need\nto use this directly - use the notification methods on the [`Client`] trait instead.\n\nNotifications do not expect a response.", }), Schema.Null, ]), ), }); export type AgentRequest = { readonly id: RequestId; readonly method: string; readonly params?: | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly content: string; readonly path: string; readonly sessionId: string; } | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly limit?: number | null; readonly line?: number | null; readonly path: string; readonly sessionId: string; } | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly options: ReadonlyArray; readonly sessionId: string; readonly toolCall: { readonly _meta?: { readonly [x: string]: unknown } | null; readonly content?: ReadonlyArray | null; readonly kind?: ToolKind | null; readonly locations?: ReadonlyArray | null; readonly rawInput?: unknown; readonly rawOutput?: unknown; readonly status?: ToolCallStatus | null; readonly title?: string | null; readonly toolCallId: string; }; } | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly args?: ReadonlyArray; readonly command: string; readonly cwd?: string | null; readonly env?: ReadonlyArray; readonly outputByteLimit?: number | null; readonly sessionId: string; } | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly sessionId: string; readonly terminalId: string; } | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly sessionId: string; readonly terminalId: string; } | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly sessionId: string; readonly terminalId: string; } | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly sessionId: string; readonly terminalId: string; } | { readonly mode: "form"; readonly requestedSchema: { readonly description?: string | null; readonly properties?: { readonly [x: string]: ElicitationPropertySchema }; readonly required?: ReadonlyArray | null; readonly title?: string | null; readonly type?: "object"; }; readonly _meta?: { readonly [x: string]: unknown } | null; readonly message: string; readonly sessionId: string; } | { readonly mode: "url"; readonly elicitationId: string; readonly url: string; readonly _meta?: { readonly [x: string]: unknown } | null; readonly message: string; readonly sessionId: string; } | unknown | null; }; export const AgentRequest = Schema.Struct({ id: RequestId, method: Schema.String, params: Schema.optionalKey( Schema.Union([ Schema.Union([ Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), content: Schema.String.annotate({ description: "The text content to write to the file.", }), path: Schema.String.annotate({ description: "Absolute path to the file to write." }), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), }).annotate({ title: "WriteTextFileRequest", description: "Request to write content to a text file.\n\nOnly available if the client supports the `fs.writeTextFile` capability.", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), limit: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "Maximum number of lines to read.", format: "uint32", }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)), Schema.Null, ]), ), line: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "Line number to start reading from (1-based).", format: "uint32", }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)), Schema.Null, ]), ), path: Schema.String.annotate({ description: "Absolute path to the file to read." }), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), }).annotate({ title: "ReadTextFileRequest", description: "Request to read content from a text file.\n\nOnly available if the client supports the `fs.readTextFile` capability.", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), options: Schema.Array(PermissionOption).annotate({ description: "Available permission options for the user to choose from.", }), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), toolCall: Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), content: Schema.optionalKey( Schema.Union([ Schema.Array(ToolCallContent).annotate({ description: "Replace the content collection.", }), Schema.Null, ]), ), kind: Schema.optionalKey( Schema.Union([ToolKind, Schema.Null]).annotate({ description: "Update the tool kind.", }), ), locations: Schema.optionalKey( Schema.Union([ Schema.Array(ToolCallLocation).annotate({ description: "Replace the locations collection.", }), Schema.Null, ]), ), rawInput: Schema.optionalKey( Schema.Unknown.annotate({ description: "Update the raw input." }), ), rawOutput: Schema.optionalKey( Schema.Unknown.annotate({ description: "Update the raw output." }), ), status: Schema.optionalKey( Schema.Union([ToolCallStatus, Schema.Null]).annotate({ description: "Update the execution status.", }), ), title: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Update the human-readable title." }), Schema.Null, ]), ), toolCallId: Schema.String.annotate({ description: "Unique identifier for a tool call within a session.", }), }).annotate({ description: "An update to an existing tool call.\n\nUsed to report progress and results as tools execute. All fields except\nthe tool call ID are optional - only changed fields need to be included.\n\nSee protocol docs: [Updating](https://agentclientprotocol.com/protocol/tool-calls#updating)", }), }).annotate({ title: "RequestPermissionRequest", description: "Request for user permission to execute a tool call.\n\nSent when the agent needs authorization before performing a sensitive operation.\n\nSee protocol docs: [Requesting Permission](https://agentclientprotocol.com/protocol/tool-calls#requesting-permission)", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), args: Schema.optionalKey( Schema.Array(Schema.String).annotate({ description: "Array of command arguments." }), ), command: Schema.String.annotate({ description: "The command to execute." }), cwd: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Working directory for the command (absolute path).", }), Schema.Null, ]), ), env: Schema.optionalKey( Schema.Array(EnvVariable).annotate({ description: "Environment variables for the command.", }), ), outputByteLimit: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "Maximum number of output bytes to retain.\n\nWhen the limit is exceeded, the Client truncates from the beginning of the output\nto stay within the limit.\n\nThe Client MUST ensure truncation happens at a character boundary to maintain valid\nstring output, even if this means the retained output is slightly less than the\nspecified limit.", format: "uint64", }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)), Schema.Null, ]), ), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), }).annotate({ title: "CreateTerminalRequest", description: "Request to create a new terminal and execute a command.", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), terminalId: Schema.String.annotate({ description: "The ID of the terminal to get output from.", }), }).annotate({ title: "TerminalOutputRequest", description: "Request to get the current output and status of a terminal.", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), terminalId: Schema.String.annotate({ description: "The ID of the terminal to release." }), }).annotate({ title: "ReleaseTerminalRequest", description: "Request to release a terminal and free its resources.", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), terminalId: Schema.String.annotate({ description: "The ID of the terminal to wait for.", }), }).annotate({ title: "WaitForTerminalExitRequest", description: "Request to wait for a terminal command to exit.", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), terminalId: Schema.String.annotate({ description: "The ID of the terminal to kill." }), }).annotate({ title: "KillTerminalRequest", description: "Request to kill a terminal without releasing it.", }), Schema.Union([ Schema.Struct({ mode: Schema.Literal("form"), requestedSchema: Schema.Struct({ description: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Optional description of what this schema represents.", }), Schema.Null, ]), ), properties: Schema.optionalKey( Schema.Record(Schema.String, ElicitationPropertySchema).annotate({ description: "Property definitions (must be primitive types).", default: {}, }), ), required: Schema.optionalKey( Schema.Union([ Schema.Array(Schema.String).annotate({ description: "List of required property names.", }), Schema.Null, ]), ), title: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Optional title for the schema." }), Schema.Null, ]), ), type: Schema.optionalKey( Schema.Literal("object").annotate({ description: "Type discriminator for elicitation schemas.", default: "object", }), ), }).annotate({ description: "Type-safe elicitation schema for requesting structured user input.\n\nThis represents a JSON Schema object with primitive-typed properties,\nas required by the elicitation specification.", }), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), message: Schema.String.annotate({ description: "A human-readable message describing what input is needed.", }), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRequest from the agent to elicit structured user input.\n\nThe agent sends this to the client to request information from the user,\neither via a form or by directing them to a URL.", }), Schema.Struct({ mode: Schema.Literal("url"), elicitationId: Schema.String.annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nUnique identifier for an elicitation.", }), url: Schema.String.annotate({ description: "The URL to direct the user to.", format: "uri", }), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), message: Schema.String.annotate({ description: "A human-readable message describing what input is needed.", }), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRequest from the agent to elicit structured user input.\n\nThe agent sends this to the client to request information from the user,\neither via a form or by directing them to a URL.", }), ]).annotate({ title: "ElicitationRequest", description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRequests structured user input via a form or URL.", }), Schema.Unknown.annotate({ title: "ExtMethodRequest", description: "Allows for sending 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)", }), ]).annotate({ description: "All possible requests that an agent can send to a client.\n\nThis enum is used internally for routing RPC requests. You typically won't need\nto use this directly - instead, use the methods on the [`Client`] trait.\n\nThis enum encompasses all method calls from agent to client.", }), Schema.Null, ]), ), }); export type AgentResponse = | { readonly id: RequestId; readonly result: | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly agentCapabilities?: { readonly _meta?: { readonly [x: string]: unknown } | null; readonly auth?: { readonly _meta?: { readonly [x: string]: unknown } | null; readonly logout?: LogoutCapabilities | null; }; readonly loadSession?: boolean; readonly mcpCapabilities?: { readonly _meta?: { readonly [x: string]: unknown } | null; readonly http?: boolean; readonly sse?: boolean; }; readonly promptCapabilities?: { readonly _meta?: { readonly [x: string]: unknown } | null; readonly audio?: boolean; readonly embeddedContext?: boolean; readonly image?: boolean; }; readonly sessionCapabilities?: { readonly _meta?: { readonly [x: string]: unknown } | null; readonly close?: SessionCloseCapabilities | null; readonly fork?: SessionForkCapabilities | null; readonly list?: SessionListCapabilities | null; readonly resume?: SessionResumeCapabilities | null; }; }; readonly agentInfo?: Implementation | null; readonly authMethods?: ReadonlyArray; readonly protocolVersion: number; } | { readonly _meta?: { readonly [x: string]: unknown } | null } | { readonly _meta?: { readonly [x: string]: unknown } | null } | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly configOptions?: ReadonlyArray | null; readonly models?: SessionModelState | null; readonly modes?: SessionModeState | null; readonly sessionId: string; } | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly configOptions?: ReadonlyArray | null; readonly models?: SessionModelState | null; readonly modes?: SessionModeState | null; } | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly nextCursor?: string | null; readonly sessions: ReadonlyArray; } | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly configOptions?: ReadonlyArray | null; readonly models?: SessionModelState | null; readonly modes?: SessionModeState | null; readonly sessionId: string; } | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly configOptions?: ReadonlyArray | null; readonly models?: SessionModelState | null; readonly modes?: SessionModeState | null; } | { readonly _meta?: { readonly [x: string]: unknown } | null } | { readonly _meta?: { readonly [x: string]: unknown } | null } | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly configOptions: ReadonlyArray; } | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly stopReason: | "end_turn" | "max_tokens" | "max_turn_requests" | "refusal" | "cancelled"; readonly usage?: Usage | null; readonly userMessageId?: string | null; } | { readonly _meta?: { readonly [x: string]: unknown } | null } | unknown; } | { readonly error: Error; readonly id: RequestId }; export const AgentResponse = Schema.Union([ Schema.Struct({ id: RequestId, result: Schema.Union([ Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), agentCapabilities: Schema.optionalKey( Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), auth: Schema.optionalKey( Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), logout: Schema.optionalKey( Schema.Union([LogoutCapabilities, Schema.Null]).annotate({ description: "Whether the agent supports the logout method.\n\nBy supplying `{}` it means that the agent supports the logout method.", }), ), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nAuthentication-related capabilities supported by the agent.", default: {}, }), ), loadSession: Schema.optionalKey( Schema.Boolean.annotate({ description: "Whether the agent supports `session/load`.", default: false, }), ), mcpCapabilities: Schema.optionalKey( Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), http: Schema.optionalKey( Schema.Boolean.annotate({ description: "Agent supports [`McpServer::Http`].", default: false, }), ), sse: Schema.optionalKey( Schema.Boolean.annotate({ description: "Agent supports [`McpServer::Sse`].", default: false, }), ), }).annotate({ description: "MCP capabilities supported by the agent", default: { http: false, sse: false }, }), ), promptCapabilities: Schema.optionalKey( Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), audio: Schema.optionalKey( Schema.Boolean.annotate({ description: "Agent supports [`ContentBlock::Audio`].", default: false, }), ), embeddedContext: Schema.optionalKey( Schema.Boolean.annotate({ description: "Agent supports embedded context in `session/prompt` requests.\n\nWhen enabled, the Client is allowed to include [`ContentBlock::Resource`]\nin prompt requests for pieces of context that are referenced in the message.", default: false, }), ), image: Schema.optionalKey( Schema.Boolean.annotate({ description: "Agent supports [`ContentBlock::Image`].", default: false, }), ), }).annotate({ description: "Prompt capabilities supported by the agent in `session/prompt` requests.\n\nBaseline agent functionality requires support for [`ContentBlock::Text`]\nand [`ContentBlock::ResourceLink`] in prompt requests.\n\nOther variants must be explicitly opted in to.\nCapabilities for different types of content in prompt requests.\n\nIndicates which content types beyond the baseline (text and resource links)\nthe agent can process.\n\nSee protocol docs: [Prompt Capabilities](https://agentclientprotocol.com/protocol/initialization#prompt-capabilities)", default: { audio: false, embeddedContext: false, image: false }, }), ), sessionCapabilities: Schema.optionalKey( Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), close: Schema.optionalKey( Schema.Union([SessionCloseCapabilities, Schema.Null]).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nWhether the agent supports `session/close`.", }), ), fork: Schema.optionalKey( Schema.Union([SessionForkCapabilities, Schema.Null]).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nWhether the agent supports `session/fork`.", }), ), list: Schema.optionalKey( Schema.Union([SessionListCapabilities, Schema.Null]).annotate({ description: "Whether the agent supports `session/list`.", }), ), resume: Schema.optionalKey( Schema.Union([SessionResumeCapabilities, Schema.Null]).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nWhether the agent supports `session/resume`.", }), ), }).annotate({ default: {}, description: "Session capabilities supported by the agent.\n\nAs a baseline, all Agents **MUST** support `session/new`, `session/prompt`, `session/cancel`, and `session/update`.\n\nOptionally, they **MAY** support other session methods and notifications by specifying additional capabilities.\n\nNote: `session/load` is still handled by the top-level `load_session` capability. This will be unified in future versions of the protocol.\n\nSee protocol docs: [Session Capabilities](https://agentclientprotocol.com/protocol/initialization#session-capabilities)", }), ), }).annotate({ description: "Capabilities supported by the agent.\n\nAdvertised during initialization to inform the client about\navailable features and content types.\n\nSee protocol docs: [Agent Capabilities](https://agentclientprotocol.com/protocol/initialization#agent-capabilities)", default: { auth: {}, loadSession: false, mcpCapabilities: { http: false, sse: false }, promptCapabilities: { audio: false, embeddedContext: false, image: false }, sessionCapabilities: {}, }, }), ), agentInfo: Schema.optionalKey( Schema.Union([Implementation, Schema.Null]).annotate({ description: "Information about the Agent name and version sent to the Client.\n\nNote: in future versions of the protocol, this will be required.", }), ), authMethods: Schema.optionalKey( Schema.Array(AuthMethod).annotate({ description: "Authentication methods supported by the agent.", default: [], }), ), protocolVersion: Schema.Number.annotate({ description: "Protocol version identifier.\n\nThis version is only bumped for breaking changes.\nNon-breaking changes should be introduced via capabilities.", format: "uint16", }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)) .check(Schema.isLessThanOrEqualTo(65535)), }).annotate({ title: "InitializeResponse", description: "Response to the `initialize` method.\n\nContains the negotiated protocol version and agent capabilities.\n\nSee protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization)", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), }).annotate({ title: "AuthenticateResponse", description: "Response to the `authenticate` method.", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), }).annotate({ title: "LogoutResponse", description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse to the `logout` method.", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), configOptions: Schema.optionalKey( Schema.Union([ Schema.Array(SessionConfigOption).annotate({ description: "Initial session configuration options if supported by the Agent.", }), Schema.Null, ]), ), models: Schema.optionalKey( Schema.Union([SessionModelState, Schema.Null]).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial model state if supported by the Agent", }), ), modes: Schema.optionalKey( Schema.Union([SessionModeState, Schema.Null]).annotate({ description: "Initial mode state if supported by the Agent\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)", }), ), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), }).annotate({ title: "NewSessionResponse", description: "Response from creating a new session.\n\nSee protocol docs: [Creating a Session](https://agentclientprotocol.com/protocol/session-setup#creating-a-session)", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), configOptions: Schema.optionalKey( Schema.Union([ Schema.Array(SessionConfigOption).annotate({ description: "Initial session configuration options if supported by the Agent.", }), Schema.Null, ]), ), models: Schema.optionalKey( Schema.Union([SessionModelState, Schema.Null]).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial model state if supported by the Agent", }), ), modes: Schema.optionalKey( Schema.Union([SessionModeState, Schema.Null]).annotate({ description: "Initial mode state if supported by the Agent\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)", }), ), }).annotate({ title: "LoadSessionResponse", description: "Response from loading an existing session.", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), nextCursor: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Opaque cursor token. If present, pass this in the next request's cursor parameter\nto fetch the next page. If absent, there are no more results.", }), Schema.Null, ]), ), sessions: Schema.Array(SessionInfo).annotate({ description: "Array of session information objects", }), }).annotate({ title: "ListSessionsResponse", description: "Response from listing sessions.", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), configOptions: Schema.optionalKey( Schema.Union([ Schema.Array(SessionConfigOption).annotate({ description: "Initial session configuration options if supported by the Agent.", }), Schema.Null, ]), ), models: Schema.optionalKey( Schema.Union([SessionModelState, Schema.Null]).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial model state if supported by the Agent", }), ), modes: Schema.optionalKey( Schema.Union([SessionModeState, Schema.Null]).annotate({ description: "Initial mode state if supported by the Agent\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)", }), ), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), }).annotate({ title: "ForkSessionResponse", description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse from forking an existing session.", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), configOptions: Schema.optionalKey( Schema.Union([ Schema.Array(SessionConfigOption).annotate({ description: "Initial session configuration options if supported by the Agent.", }), Schema.Null, ]), ), models: Schema.optionalKey( Schema.Union([SessionModelState, Schema.Null]).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial model state if supported by the Agent", }), ), modes: Schema.optionalKey( Schema.Union([SessionModeState, Schema.Null]).annotate({ description: "Initial mode state if supported by the Agent\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)", }), ), }).annotate({ title: "ResumeSessionResponse", description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse from resuming an existing session.", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), }).annotate({ title: "CloseSessionResponse", description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse from closing a session.", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), }).annotate({ title: "SetSessionModeResponse", description: "Response to `session/set_mode` method.", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), configOptions: Schema.Array(SessionConfigOption).annotate({ description: "The full set of configuration options and their current values.", }), }).annotate({ title: "SetSessionConfigOptionResponse", description: "Response to `session/set_config_option` method.", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), stopReason: Schema.Literals([ "end_turn", "max_tokens", "max_turn_requests", "refusal", "cancelled", ]).annotate({ description: "Reasons why an agent stops processing a prompt turn.\n\nSee protocol docs: [Stop Reasons](https://agentclientprotocol.com/protocol/prompt-turn#stop-reasons)", }), usage: Schema.optionalKey( Schema.Union([Usage, Schema.Null]).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nToken usage for this turn (optional).", }), ), userMessageId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nThe acknowledged user message ID.\n\nIf the client provided a `messageId` in the [`PromptRequest`], the agent echoes it here\nto confirm it was recorded. If the client did not provide one, the agent MAY assign one\nand return it here. Absence of this field indicates the agent did not record a message ID.", }), Schema.Null, ]), ), }).annotate({ title: "PromptResponse", description: "Response from processing a user prompt.\n\nSee protocol docs: [Check for Completion](https://agentclientprotocol.com/protocol/prompt-turn#4-check-for-completion)", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), }).annotate({ title: "SetSessionModelResponse", description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse to `session/set_model` method.", }), Schema.Unknown.annotate({ title: "ExtMethodResponse", description: "Allows for sending an arbitrary response to an [`ExtRequest`] 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)", }), ]).annotate({ description: "All possible responses that an agent can send to a client.\n\nThis enum is used internally for routing RPC responses. You typically won't need\nto use this directly - the responses are handled automatically by the connection.\n\nThese are responses to the corresponding `ClientRequest` variants.", }), }).annotate({ title: "Result" }), Schema.Struct({ error: Error, id: RequestId }).annotate({ title: "Error" }), ]); export type AudioContent = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly data: string; readonly mimeType: string; }; export const AudioContent = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), data: Schema.String, mimeType: Schema.String, }).annotate({ description: "Audio provided to or from an LLM." }); export type AuthCapabilities = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly terminal?: boolean; }; export const AuthCapabilities = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), terminal: Schema.optionalKey( Schema.Boolean.annotate({ description: "Whether the client supports `terminal` authentication methods.\n\nWhen `true`, the agent may include `terminal` entries in its authentication methods.", default: false, }), ), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nAuthentication capabilities supported by the client.\n\nAdvertised during initialization to inform the agent which authentication\nmethod types the client can handle. This governs opt-in types that require\nadditional client-side support.", }); export type AuthenticateRequest = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly methodId: string; }; export const AuthenticateRequest = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), methodId: Schema.String.annotate({ description: "The ID of the authentication method to use.\nMust be one of the methods advertised in the initialize response.", }), }).annotate({ description: "Request parameters for the authenticate method.\n\nSpecifies which authentication method to use.", }); export type AuthenticateResponse = { readonly _meta?: { readonly [x: string]: unknown } | null }; export const AuthenticateResponse = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), }).annotate({ description: "Response to the `authenticate` method." }); export type AuthMethodAgent = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly description?: string | null; readonly id: string; readonly name: string; }; export const AuthMethodAgent = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), description: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Optional description providing more details about this authentication method.", }), Schema.Null, ]), ), id: Schema.String.annotate({ description: "Unique identifier for this authentication method." }), name: Schema.String.annotate({ description: "Human-readable name of the authentication method.", }), }).annotate({ description: "Agent handles authentication itself.\n\nThis is the default authentication method type.", }); export type AuthMethodEnvVar = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly description?: string | null; readonly id: string; readonly link?: string | null; readonly name: string; readonly vars: ReadonlyArray; }; export const AuthMethodEnvVar = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), description: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Optional description providing more details about this authentication method.", }), Schema.Null, ]), ), id: Schema.String.annotate({ description: "Unique identifier for this authentication method." }), link: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Optional link to a page where the user can obtain their credentials.", }), Schema.Null, ]), ), name: Schema.String.annotate({ description: "Human-readable name of the authentication method.", }), vars: Schema.Array(AuthEnvVar).annotate({ description: "The environment variables the client should set.", }), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nEnvironment variable authentication method.\n\nThe user provides credentials that the client passes to the agent as environment variables.", }); export type AuthMethodTerminal = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly args?: ReadonlyArray; readonly description?: string | null; readonly env?: { readonly [x: string]: string }; readonly id: string; readonly name: string; }; export const AuthMethodTerminal = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), args: Schema.optionalKey( Schema.Array(Schema.String).annotate({ description: "Additional arguments to pass when running the agent binary for terminal auth.", }), ), description: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Optional description providing more details about this authentication method.", }), Schema.Null, ]), ), env: Schema.optionalKey( Schema.Record(Schema.String, Schema.String).annotate({ description: "Additional environment variables to set when running the agent binary for terminal auth.", }), ), id: Schema.String.annotate({ description: "Unique identifier for this authentication method." }), name: Schema.String.annotate({ description: "Human-readable name of the authentication method.", }), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nTerminal-based authentication method.\n\nThe client runs an interactive terminal for the user to authenticate via a TUI.", }); export type AvailableCommandsUpdate = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly availableCommands: ReadonlyArray; }; export const AvailableCommandsUpdate = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), availableCommands: Schema.Array(AvailableCommand).annotate({ description: "Commands the agent can execute", }), }).annotate({ description: "Available commands are ready or have changed" }); export type BlobResourceContents = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly blob: string; readonly mimeType?: string | null; readonly uri: string; }; export const BlobResourceContents = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), blob: Schema.String, mimeType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), uri: Schema.String, }).annotate({ description: "Binary resource contents." }); export type BooleanPropertySchema = { readonly default?: boolean | null; readonly description?: string | null; readonly title?: string | null; }; export const BooleanPropertySchema = Schema.Struct({ default: Schema.optionalKey( Schema.Union([Schema.Boolean.annotate({ description: "Default value." }), Schema.Null]), ), description: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Human-readable description." }), Schema.Null, ]), ), title: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Optional title for the property." }), Schema.Null, ]), ), }).annotate({ description: "Schema for boolean properties in an elicitation form." }); export type CancelNotification = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly sessionId: string; }; export const CancelNotification = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), }).annotate({ description: "Notification to cancel ongoing operations for a session.\n\nSee protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/prompt-turn#cancellation)", }); export type CancelRequestNotification = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly requestId: null | number | string; }; export const CancelRequestNotification = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), requestId: Schema.Union([ Schema.Null.annotate({ title: "Null" }), Schema.Number.annotate({ title: "Number", format: "int64" }).check(Schema.isInt()), Schema.String.annotate({ title: "Str" }), ]).annotate({ description: "JSON RPC Request Id\n\nAn identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null [1] and Numbers SHOULD NOT contain fractional parts [2]\n\nThe Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects.\n\n[1] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling.\n\n[2] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions.", }), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nNotification to cancel an ongoing request.\n\nSee protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/cancellation)", }); export type ClientCapabilities = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly auth?: { readonly _meta?: { readonly [x: string]: unknown } | null; readonly terminal?: boolean; }; readonly elicitation?: ElicitationCapabilities | null; readonly fs?: { readonly _meta?: { readonly [x: string]: unknown } | null; readonly readTextFile?: boolean; readonly writeTextFile?: boolean; }; readonly terminal?: boolean; }; export const ClientCapabilities = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), auth: Schema.optionalKey( Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), terminal: Schema.optionalKey( Schema.Boolean.annotate({ description: "Whether the client supports `terminal` authentication methods.\n\nWhen `true`, the agent may include `terminal` entries in its authentication methods.", default: false, }), ), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nAuthentication capabilities supported by the client.\n\nAdvertised during initialization to inform the agent which authentication\nmethod types the client can handle. This governs opt-in types that require\nadditional client-side support.", default: { terminal: false }, }), ), elicitation: Schema.optionalKey( Schema.Union([ElicitationCapabilities, Schema.Null]).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nElicitation capabilities supported by the client.\nDetermines which elicitation modes the agent may use.", }), ), fs: Schema.optionalKey( Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), readTextFile: Schema.optionalKey( Schema.Boolean.annotate({ description: "Whether the Client supports `fs/read_text_file` requests.", default: false, }), ), writeTextFile: Schema.optionalKey( Schema.Boolean.annotate({ description: "Whether the Client supports `fs/write_text_file` requests.", default: false, }), ), }).annotate({ description: "File system capabilities that a client may support.\n\nSee protocol docs: [FileSystem](https://agentclientprotocol.com/protocol/initialization#filesystem)", default: { readTextFile: false, writeTextFile: false }, }), ), terminal: Schema.optionalKey( Schema.Boolean.annotate({ description: "Whether the Client support all `terminal/*` methods.", default: false, }), ), }).annotate({ description: "Capabilities supported by the client.\n\nAdvertised during initialization to inform the agent about\navailable features and methods.\n\nSee protocol docs: [Client Capabilities](https://agentclientprotocol.com/protocol/initialization#client-capabilities)", }); export type ClientNotification = { readonly method: string; readonly params?: | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly sessionId: string } | unknown | null; }; export const ClientNotification = Schema.Struct({ method: Schema.String, params: Schema.optionalKey( Schema.Union([ Schema.Union([ Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), }).annotate({ title: "CancelNotification", description: "Notification to cancel ongoing operations for a session.\n\nSee protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/prompt-turn#cancellation)", }), Schema.Unknown.annotate({ title: "ExtNotification", description: "Allows 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)", }), ]).annotate({ description: "All possible notifications that a client can send to an agent.\n\nThis enum is used internally for routing RPC notifications. You typically won't need\nto use this directly - use the notification methods on the [`Agent`] trait instead.\n\nNotifications do not expect a response.", }), Schema.Null, ]), ), }); export type ClientRequest = { readonly id: RequestId; readonly method: string; readonly params?: | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly clientCapabilities?: { readonly _meta?: { readonly [x: string]: unknown } | null; readonly auth?: { readonly _meta?: { readonly [x: string]: unknown } | null; readonly terminal?: boolean; }; readonly elicitation?: ElicitationCapabilities | null; readonly fs?: { readonly _meta?: { readonly [x: string]: unknown } | null; readonly readTextFile?: boolean; readonly writeTextFile?: boolean; }; readonly terminal?: boolean; }; readonly clientInfo?: Implementation | null; readonly protocolVersion: number; } | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly methodId: string } | { readonly _meta?: { readonly [x: string]: unknown } | null } | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly cwd: string; readonly mcpServers: ReadonlyArray; } | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly cwd: string; readonly mcpServers: ReadonlyArray; readonly sessionId: string; } | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly cursor?: string | null; readonly cwd?: string | null; } | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly cwd: string; readonly mcpServers?: ReadonlyArray; readonly sessionId: string; } | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly cwd: string; readonly mcpServers?: ReadonlyArray; readonly sessionId: string; } | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly sessionId: string } | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly modeId: string; readonly sessionId: string; } | { readonly type: "boolean"; readonly value: boolean; readonly _meta?: { readonly [x: string]: unknown } | null; readonly configId: string; readonly sessionId: string; } | { readonly value: string; readonly _meta?: { readonly [x: string]: unknown } | null; readonly configId: string; readonly sessionId: string; } | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly messageId?: string | null; readonly prompt: ReadonlyArray; readonly sessionId: string; } | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly modelId: string; readonly sessionId: string; } | unknown | null; }; export const ClientRequest = Schema.Struct({ id: RequestId, method: Schema.String, params: Schema.optionalKey( Schema.Union([ Schema.Union([ Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), clientCapabilities: Schema.optionalKey( Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), auth: Schema.optionalKey( Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), terminal: Schema.optionalKey( Schema.Boolean.annotate({ description: "Whether the client supports `terminal` authentication methods.\n\nWhen `true`, the agent may include `terminal` entries in its authentication methods.", default: false, }), ), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nAuthentication capabilities supported by the client.\n\nAdvertised during initialization to inform the agent which authentication\nmethod types the client can handle. This governs opt-in types that require\nadditional client-side support.", default: { terminal: false }, }), ), elicitation: Schema.optionalKey( Schema.Union([ElicitationCapabilities, Schema.Null]).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nElicitation capabilities supported by the client.\nDetermines which elicitation modes the agent may use.", }), ), fs: Schema.optionalKey( Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), readTextFile: Schema.optionalKey( Schema.Boolean.annotate({ description: "Whether the Client supports `fs/read_text_file` requests.", default: false, }), ), writeTextFile: Schema.optionalKey( Schema.Boolean.annotate({ description: "Whether the Client supports `fs/write_text_file` requests.", default: false, }), ), }).annotate({ description: "File system capabilities that a client may support.\n\nSee protocol docs: [FileSystem](https://agentclientprotocol.com/protocol/initialization#filesystem)", default: { readTextFile: false, writeTextFile: false }, }), ), terminal: Schema.optionalKey( Schema.Boolean.annotate({ description: "Whether the Client support all `terminal/*` methods.", default: false, }), ), }).annotate({ description: "Capabilities supported by the client.\n\nAdvertised during initialization to inform the agent about\navailable features and methods.\n\nSee protocol docs: [Client Capabilities](https://agentclientprotocol.com/protocol/initialization#client-capabilities)", default: { auth: { terminal: false }, fs: { readTextFile: false, writeTextFile: false }, terminal: false, }, }), ), clientInfo: Schema.optionalKey( Schema.Union([Implementation, Schema.Null]).annotate({ description: "Information about the Client name and version sent to the Agent.\n\nNote: in future versions of the protocol, this will be required.", }), ), protocolVersion: Schema.Number.annotate({ description: "Protocol version identifier.\n\nThis version is only bumped for breaking changes.\nNon-breaking changes should be introduced via capabilities.", format: "uint16", }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)) .check(Schema.isLessThanOrEqualTo(65535)), }).annotate({ title: "InitializeRequest", description: "Request parameters for the initialize method.\n\nSent by the client to establish connection and negotiate capabilities.\n\nSee protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization)", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), methodId: Schema.String.annotate({ description: "The ID of the authentication method to use.\nMust be one of the methods advertised in the initialize response.", }), }).annotate({ title: "AuthenticateRequest", description: "Request parameters for the authenticate method.\n\nSpecifies which authentication method to use.", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), }).annotate({ title: "LogoutRequest", description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRequest parameters for the logout method.\n\nTerminates the current authenticated session.", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), cwd: Schema.String.annotate({ description: "The working directory for this session. Must be an absolute path.", }), mcpServers: Schema.Array(McpServer).annotate({ description: "List of MCP (Model Context Protocol) servers the agent should connect to.", }), }).annotate({ title: "NewSessionRequest", description: "Request parameters for creating a new session.\n\nSee protocol docs: [Creating a Session](https://agentclientprotocol.com/protocol/session-setup#creating-a-session)", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), cwd: Schema.String.annotate({ description: "The working directory for this session." }), mcpServers: Schema.Array(McpServer).annotate({ description: "List of MCP servers to connect to for this session.", }), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), }).annotate({ title: "LoadSessionRequest", description: "Request parameters for loading an existing session.\n\nOnly available if the Agent supports the `loadSession` capability.\n\nSee protocol docs: [Loading Sessions](https://agentclientprotocol.com/protocol/session-setup#loading-sessions)", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), cursor: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Opaque cursor token from a previous response's nextCursor field for cursor-based pagination", }), Schema.Null, ]), ), cwd: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Filter sessions by working directory. Must be an absolute path.", }), Schema.Null, ]), ), }).annotate({ title: "ListSessionsRequest", description: "Request parameters for listing existing sessions.\n\nOnly available if the Agent supports the `sessionCapabilities.list` capability.", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), cwd: Schema.String.annotate({ description: "The working directory for this session." }), mcpServers: Schema.optionalKey( Schema.Array(McpServer).annotate({ description: "List of MCP servers to connect to for this session.", }), ), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), }).annotate({ title: "ForkSessionRequest", description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRequest parameters for forking an existing session.\n\nCreates a new session based on the context of an existing one, allowing\noperations like generating summaries without affecting the original session's history.\n\nOnly available if the Agent supports the `session.fork` capability.", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), cwd: Schema.String.annotate({ description: "The working directory for this session." }), mcpServers: Schema.optionalKey( Schema.Array(McpServer).annotate({ description: "List of MCP servers to connect to for this session.", }), ), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), }).annotate({ title: "ResumeSessionRequest", description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRequest parameters for resuming an existing session.\n\nResumes an existing session without returning previous messages (unlike `session/load`).\nThis is useful for agents that can resume sessions but don't implement full session loading.\n\nOnly available if the Agent supports the `session.resume` capability.", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), }).annotate({ title: "CloseSessionRequest", description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRequest parameters for closing an active session.\n\nIf supported, the agent **must** cancel any ongoing work related to the session\n(treat it as if `session/cancel` was called) and then free up any resources\nassociated with the session.\n\nOnly available if the Agent supports the `session.close` capability.", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), modeId: Schema.String.annotate({ description: "Unique identifier for a Session Mode." }), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), }).annotate({ title: "SetSessionModeRequest", description: "Request parameters for setting a session mode.", }), Schema.Union([ Schema.Struct({ type: Schema.Literal("boolean"), value: Schema.Boolean.annotate({ description: "The boolean value." }), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), configId: Schema.String.annotate({ description: "Unique identifier for a session configuration option.", }), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), }).annotate({ description: "Request parameters for setting a session configuration option.", }), Schema.Struct({ value: Schema.String.annotate({ description: "Unique identifier for a session configuration option value.", }), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), configId: Schema.String.annotate({ description: "Unique identifier for a session configuration option.", }), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), }).annotate({ title: "value_id", description: "Request parameters for setting a session configuration option.", }), ]).annotate({ title: "SetSessionConfigOptionRequest", description: "Sets the current value for a session configuration option.", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), messageId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA client-generated unique identifier for this user message.\n\nIf provided, the Agent SHOULD echo this value as `userMessageId` in the\n[`PromptResponse`] to confirm it was recorded.\nBoth clients and agents MUST use UUID format for message IDs.", }), Schema.Null, ]), ), prompt: Schema.Array(ContentBlock).annotate({ description: "The blocks of content that compose the user's message.\n\nAs a baseline, the Agent MUST support [`ContentBlock::Text`] and [`ContentBlock::ResourceLink`],\nwhile other variants are optionally enabled via [`PromptCapabilities`].\n\nThe Client MUST adapt its interface according to [`PromptCapabilities`].\n\nThe client MAY include referenced pieces of context as either\n[`ContentBlock::Resource`] or [`ContentBlock::ResourceLink`].\n\nWhen available, [`ContentBlock::Resource`] is preferred\nas it avoids extra round-trips and allows the message to include\npieces of context from sources the agent may not have access to.", }), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), }).annotate({ title: "PromptRequest", description: "Request parameters for sending a user prompt to the agent.\n\nContains the user's message and any additional context.\n\nSee protocol docs: [User Message](https://agentclientprotocol.com/protocol/prompt-turn#1-user-message)", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), modelId: Schema.String.annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA unique identifier for a model.", }), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), }).annotate({ title: "SetSessionModelRequest", description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRequest parameters for setting a session model.", }), Schema.Unknown.annotate({ title: "ExtMethodRequest", description: "Allows for sending 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)", }), ]).annotate({ description: "All possible requests that a client can send to an agent.\n\nThis enum is used internally for routing RPC requests. You typically won't need\nto use this directly - instead, use the methods on the [`Agent`] trait.\n\nThis enum encompasses all method calls from client to agent.", }), Schema.Null, ]), ), }); export type ClientResponse = | { readonly id: RequestId; readonly result: | { readonly _meta?: { readonly [x: string]: unknown } | null } | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly content: string } | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly outcome: | { readonly outcome: "cancelled" } | { readonly outcome: "selected"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly optionId: string; }; } | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly terminalId: string } | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly exitStatus?: TerminalExitStatus | null; readonly output: string; readonly truncated: boolean; } | { readonly _meta?: { readonly [x: string]: unknown } | null } | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly exitCode?: number | null; readonly signal?: string | null; } | { readonly _meta?: { readonly [x: string]: unknown } | null } | { readonly _meta?: { readonly [x: string]: unknown } | null; readonly action: | { readonly action: "accept"; readonly content?: { readonly [x: string]: ElicitationContentValue } | null; } | { readonly action: "decline" } | { readonly action: "cancel" }; } | unknown; } | { readonly error: Error; readonly id: RequestId }; export const ClientResponse = Schema.Union([ Schema.Struct({ id: RequestId, result: Schema.Union([ Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), }).annotate({ title: "WriteTextFileResponse", description: "Response to `fs/write_text_file`", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), content: Schema.String, }).annotate({ title: "ReadTextFileResponse", description: "Response containing the contents of a text file.", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), outcome: Schema.Union( [ Schema.Struct({ outcome: Schema.Literal("cancelled") }).annotate({ description: "The prompt turn was cancelled before the user responded.\n\nWhen a client sends a `session/cancel` notification to cancel an ongoing\nprompt turn, it MUST respond to all pending `session/request_permission`\nrequests with this `Cancelled` outcome.\n\nSee protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/prompt-turn#cancellation)", }), Schema.Struct({ outcome: Schema.Literal("selected"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), optionId: Schema.String.annotate({ description: "Unique identifier for a permission option.", }), }).annotate({ description: "The user selected one of the provided options." }), ], { mode: "oneOf" }, ).annotate({ description: "The outcome of a permission request." }), }).annotate({ title: "RequestPermissionResponse", description: "Response to a permission request.", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), terminalId: Schema.String.annotate({ description: "The unique identifier for the created terminal.", }), }).annotate({ title: "CreateTerminalResponse", description: "Response containing the ID of the created terminal.", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), exitStatus: Schema.optionalKey( Schema.Union([TerminalExitStatus, Schema.Null]).annotate({ description: "Exit status if the command has completed.", }), ), output: Schema.String.annotate({ description: "The terminal output captured so far." }), truncated: Schema.Boolean.annotate({ description: "Whether the output was truncated due to byte limits.", }), }).annotate({ title: "TerminalOutputResponse", description: "Response containing the terminal output and exit status.", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), }).annotate({ title: "ReleaseTerminalResponse", description: "Response to terminal/release method", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), exitCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "The process exit code (may be null if terminated by signal).", format: "uint32", }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)), Schema.Null, ]), ), signal: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "The signal that terminated the process (may be null if exited normally).", }), Schema.Null, ]), ), }).annotate({ title: "WaitForTerminalExitResponse", description: "Response containing the exit status of a terminal command.", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), }).annotate({ title: "KillTerminalResponse", description: "Response to `terminal/kill` method", }), Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), action: Schema.Union( [ Schema.Struct({ action: Schema.Literal("accept"), content: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, ElicitationContentValue).annotate({ description: "The user-provided content, if any, as an object matching the requested schema.", }), Schema.Null, ]), ), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nThe user accepted the elicitation and provided content.", }), Schema.Struct({ action: Schema.Literal("decline") }).annotate({ description: "The user declined the elicitation.", }), Schema.Struct({ action: Schema.Literal("cancel") }).annotate({ description: "The elicitation was cancelled.", }), ], { mode: "oneOf" }, ).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nThe user's action in response to an elicitation.", }), }).annotate({ title: "ElicitationResponse", description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse from the client to an elicitation request.", }), Schema.Unknown.annotate({ title: "ExtMethodResponse", description: "Allows for sending an arbitrary response to an [`ExtRequest`] 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)", }), ]).annotate({ description: "All possible responses that a client can send to an agent.\n\nThis enum is used internally for routing RPC responses. You typically won't need\nto use this directly - the responses are handled automatically by the connection.\n\nThese are responses to the corresponding `AgentRequest` variants.", }), }).annotate({ title: "Result" }), Schema.Struct({ error: Error, id: RequestId }).annotate({ title: "Error" }), ]); export type CloseSessionRequest = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly sessionId: string; }; export const CloseSessionRequest = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRequest parameters for closing an active session.\n\nIf supported, the agent **must** cancel any ongoing work related to the session\n(treat it as if `session/cancel` was called) and then free up any resources\nassociated with the session.\n\nOnly available if the Agent supports the `session.close` capability.", }); export type CloseSessionResponse = { readonly _meta?: { readonly [x: string]: unknown } | null }; export const CloseSessionResponse = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse from closing a session.", }); export type ConfigOptionUpdate = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly configOptions: ReadonlyArray; }; export const ConfigOptionUpdate = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), configOptions: Schema.Array(SessionConfigOption).annotate({ description: "The full set of configuration options and their current values.", }), }).annotate({ description: "Session configuration options have been updated." }); export type Content = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly content: | { readonly type: "text"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly text: string; } | { readonly type: "image"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly data: string; readonly mimeType: string; readonly uri?: string | null; } | { readonly type: "audio"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly data: string; readonly mimeType: string; } | { readonly type: "resource_link"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly description?: string | null; readonly mimeType?: string | null; readonly name: string; readonly size?: number | null; readonly title?: string | null; readonly uri: string; } | { readonly type: "resource"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly resource: EmbeddedResourceResource; }; }; export const Content = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), content: Schema.Union( [ Schema.Struct({ type: Schema.Literal("text"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), text: Schema.String, }).annotate({ description: "Text provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("image"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), data: Schema.String, mimeType: Schema.String, uri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), }).annotate({ description: "An image provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("audio"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), data: Schema.String, mimeType: Schema.String, }).annotate({ description: "Audio provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("resource_link"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), mimeType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), name: Schema.String, size: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null, ]), ), title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), uri: Schema.String, }).annotate({ description: "A resource that the server is capable of reading, included in a prompt or tool call result.", }), Schema.Struct({ type: Schema.Literal("resource"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), resource: EmbeddedResourceResource, }).annotate({ description: "The contents of a resource, embedded into a prompt or tool call result.", }), ], { mode: "oneOf" }, ).annotate({ description: "Content blocks represent displayable information in the Agent Client Protocol.\n\nThey provide a structured way to handle various types of user-facing content—whether\nit's text from language models, images for analysis, or embedded resources for context.\n\nContent blocks appear in:\n- User prompts sent via `session/prompt`\n- Language model output streamed through `session/update` notifications\n- Progress updates and results from tool calls\n\nThis structure is compatible with the Model Context Protocol (MCP), enabling\nagents to seamlessly forward content from MCP tool outputs without transformation.\n\nSee protocol docs: [Content](https://agentclientprotocol.com/protocol/content)", }), }).annotate({ description: "Standard content block (text, images, resources)." }); export type ContentChunk = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly content: | { readonly type: "text"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly text: string; } | { readonly type: "image"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly data: string; readonly mimeType: string; readonly uri?: string | null; } | { readonly type: "audio"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly data: string; readonly mimeType: string; } | { readonly type: "resource_link"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly description?: string | null; readonly mimeType?: string | null; readonly name: string; readonly size?: number | null; readonly title?: string | null; readonly uri: string; } | { readonly type: "resource"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly resource: EmbeddedResourceResource; }; readonly messageId?: string | null; }; export const ContentChunk = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), content: Schema.Union( [ Schema.Struct({ type: Schema.Literal("text"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), text: Schema.String, }).annotate({ description: "Text provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("image"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), data: Schema.String, mimeType: Schema.String, uri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), }).annotate({ description: "An image provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("audio"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), data: Schema.String, mimeType: Schema.String, }).annotate({ description: "Audio provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("resource_link"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), mimeType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), name: Schema.String, size: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null, ]), ), title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), uri: Schema.String, }).annotate({ description: "A resource that the server is capable of reading, included in a prompt or tool call result.", }), Schema.Struct({ type: Schema.Literal("resource"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), resource: EmbeddedResourceResource, }).annotate({ description: "The contents of a resource, embedded into a prompt or tool call result.", }), ], { mode: "oneOf" }, ).annotate({ description: "Content blocks represent displayable information in the Agent Client Protocol.\n\nThey provide a structured way to handle various types of user-facing content—whether\nit's text from language models, images for analysis, or embedded resources for context.\n\nContent blocks appear in:\n- User prompts sent via `session/prompt`\n- Language model output streamed through `session/update` notifications\n- Progress updates and results from tool calls\n\nThis structure is compatible with the Model Context Protocol (MCP), enabling\nagents to seamlessly forward content from MCP tool outputs without transformation.\n\nSee protocol docs: [Content](https://agentclientprotocol.com/protocol/content)", }), messageId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA unique identifier for the message this chunk belongs to.\n\nAll chunks belonging to the same message share the same `messageId`.\nA change in `messageId` indicates a new message has started.\nBoth clients and agents MUST use UUID format for message IDs.", }), Schema.Null, ]), ), }).annotate({ description: "A streamed item of content" }); export type CreateTerminalRequest = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly args?: ReadonlyArray; readonly command: string; readonly cwd?: string | null; readonly env?: ReadonlyArray; readonly outputByteLimit?: number | null; readonly sessionId: string; }; export const CreateTerminalRequest = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), args: Schema.optionalKey( Schema.Array(Schema.String).annotate({ description: "Array of command arguments." }), ), command: Schema.String.annotate({ description: "The command to execute." }), cwd: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Working directory for the command (absolute path)." }), Schema.Null, ]), ), env: Schema.optionalKey( Schema.Array(EnvVariable).annotate({ description: "Environment variables for the command." }), ), outputByteLimit: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "Maximum number of output bytes to retain.\n\nWhen the limit is exceeded, the Client truncates from the beginning of the output\nto stay within the limit.\n\nThe Client MUST ensure truncation happens at a character boundary to maintain valid\nstring output, even if this means the retained output is slightly less than the\nspecified limit.", format: "uint64", }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)), Schema.Null, ]), ), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), }).annotate({ description: "Request to create a new terminal and execute a command." }); export type CreateTerminalResponse = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly terminalId: string; }; export const CreateTerminalResponse = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), terminalId: Schema.String.annotate({ description: "The unique identifier for the created terminal.", }), }).annotate({ description: "Response containing the ID of the created terminal." }); export type CurrentModeUpdate = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly currentModeId: string; }; export const CurrentModeUpdate = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), currentModeId: Schema.String.annotate({ description: "Unique identifier for a Session Mode." }), }).annotate({ description: "The current mode of the session has changed\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)", }); export type Diff = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly newText: string; readonly oldText?: string | null; readonly path: string; }; export const Diff = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), newText: Schema.String.annotate({ description: "The new content after modification." }), oldText: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "The original content (None for new files)." }), Schema.Null, ]), ), path: Schema.String.annotate({ description: "The file path being modified." }), }).annotate({ description: "A diff representing file modifications.\n\nShows changes to files in a format suitable for display in the client UI.\n\nSee protocol docs: [Content](https://agentclientprotocol.com/protocol/tool-calls#content)", }); export type ElicitationAcceptAction = { readonly content?: { readonly [x: string]: ElicitationContentValue } | null; }; export const ElicitationAcceptAction = Schema.Struct({ content: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, ElicitationContentValue).annotate({ description: "The user-provided content, if any, as an object matching the requested schema.", }), Schema.Null, ]), ), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nThe user accepted the elicitation and provided content.", }); export type ElicitationAction = | { readonly action: "accept"; readonly content?: { readonly [x: string]: ElicitationContentValue } | null; } | { readonly action: "decline" } | { readonly action: "cancel" }; export const ElicitationAction = Schema.Union( [ Schema.Struct({ action: Schema.Literal("accept"), content: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, ElicitationContentValue).annotate({ description: "The user-provided content, if any, as an object matching the requested schema.", }), Schema.Null, ]), ), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nThe user accepted the elicitation and provided content.", }), Schema.Struct({ action: Schema.Literal("decline") }).annotate({ description: "The user declined the elicitation.", }), Schema.Struct({ action: Schema.Literal("cancel") }).annotate({ description: "The elicitation was cancelled.", }), ], { mode: "oneOf" }, ).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nThe user's action in response to an elicitation.", }); export type ElicitationCompleteNotification = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly elicitationId: string; }; export const ElicitationCompleteNotification = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), elicitationId: Schema.String.annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nUnique identifier for an elicitation.", }), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nNotification sent by the agent when a URL-based elicitation is complete.", }); export type ElicitationFormMode = { readonly requestedSchema: { readonly description?: string | null; readonly properties?: { readonly [x: string]: ElicitationPropertySchema }; readonly required?: ReadonlyArray | null; readonly title?: string | null; readonly type?: "object"; }; }; export const ElicitationFormMode = Schema.Struct({ requestedSchema: Schema.Struct({ description: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Optional description of what this schema represents.", }), Schema.Null, ]), ), properties: Schema.optionalKey( Schema.Record(Schema.String, ElicitationPropertySchema).annotate({ description: "Property definitions (must be primitive types).", default: {}, }), ), required: Schema.optionalKey( Schema.Union([ Schema.Array(Schema.String).annotate({ description: "List of required property names." }), Schema.Null, ]), ), title: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Optional title for the schema." }), Schema.Null, ]), ), type: Schema.optionalKey( Schema.Literal("object").annotate({ description: "Type discriminator for elicitation schemas.", default: "object", }), ), }).annotate({ description: "Type-safe elicitation schema for requesting structured user input.\n\nThis represents a JSON Schema object with primitive-typed properties,\nas required by the elicitation specification.", }), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nForm-based elicitation mode where the client renders a form from the provided schema.", }); export type ElicitationId = string; export const ElicitationId = Schema.String.annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nUnique identifier for an elicitation.", }); export type ElicitationRequest = | { readonly mode: "form"; readonly requestedSchema: { readonly description?: string | null; readonly properties?: { readonly [x: string]: ElicitationPropertySchema }; readonly required?: ReadonlyArray | null; readonly title?: string | null; readonly type?: "object"; }; readonly _meta?: { readonly [x: string]: unknown } | null; readonly message: string; readonly sessionId: string; } | { readonly mode: "url"; readonly elicitationId: string; readonly url: string; readonly _meta?: { readonly [x: string]: unknown } | null; readonly message: string; readonly sessionId: string; }; export const ElicitationRequest = Schema.Union([ Schema.Struct({ mode: Schema.Literal("form"), requestedSchema: Schema.Struct({ description: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Optional description of what this schema represents.", }), Schema.Null, ]), ), properties: Schema.optionalKey( Schema.Record(Schema.String, ElicitationPropertySchema).annotate({ description: "Property definitions (must be primitive types).", default: {}, }), ), required: Schema.optionalKey( Schema.Union([ Schema.Array(Schema.String).annotate({ description: "List of required property names." }), Schema.Null, ]), ), title: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Optional title for the schema." }), Schema.Null, ]), ), type: Schema.optionalKey( Schema.Literal("object").annotate({ description: "Type discriminator for elicitation schemas.", default: "object", }), ), }).annotate({ description: "Type-safe elicitation schema for requesting structured user input.\n\nThis represents a JSON Schema object with primitive-typed properties,\nas required by the elicitation specification.", }), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), message: Schema.String.annotate({ description: "A human-readable message describing what input is needed.", }), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRequest from the agent to elicit structured user input.\n\nThe agent sends this to the client to request information from the user,\neither via a form or by directing them to a URL.", }), Schema.Struct({ mode: Schema.Literal("url"), elicitationId: Schema.String.annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nUnique identifier for an elicitation.", }), url: Schema.String.annotate({ description: "The URL to direct the user to.", format: "uri" }), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), message: Schema.String.annotate({ description: "A human-readable message describing what input is needed.", }), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRequest from the agent to elicit structured user input.\n\nThe agent sends this to the client to request information from the user,\neither via a form or by directing them to a URL.", }), ]); export type ElicitationResponse = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly action: | { readonly action: "accept"; readonly content?: { readonly [x: string]: ElicitationContentValue } | null; } | { readonly action: "decline" } | { readonly action: "cancel" }; }; export const ElicitationResponse = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), action: Schema.Union( [ Schema.Struct({ action: Schema.Literal("accept"), content: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, ElicitationContentValue).annotate({ description: "The user-provided content, if any, as an object matching the requested schema.", }), Schema.Null, ]), ), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nThe user accepted the elicitation and provided content.", }), Schema.Struct({ action: Schema.Literal("decline") }).annotate({ description: "The user declined the elicitation.", }), Schema.Struct({ action: Schema.Literal("cancel") }).annotate({ description: "The elicitation was cancelled.", }), ], { mode: "oneOf" }, ).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nThe user's action in response to an elicitation.", }), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse from the client to an elicitation request.", }); export type ElicitationSchema = { readonly description?: string | null; readonly properties?: { readonly [x: string]: ElicitationPropertySchema }; readonly required?: ReadonlyArray | null; readonly title?: string | null; readonly type?: "object"; }; export const ElicitationSchema = Schema.Struct({ description: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Optional description of what this schema represents.", }), Schema.Null, ]), ), properties: Schema.optionalKey( Schema.Record(Schema.String, ElicitationPropertySchema).annotate({ description: "Property definitions (must be primitive types).", default: {}, }), ), required: Schema.optionalKey( Schema.Union([ Schema.Array(Schema.String).annotate({ description: "List of required property names." }), Schema.Null, ]), ), title: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Optional title for the schema." }), Schema.Null, ]), ), type: Schema.optionalKey( Schema.Literal("object").annotate({ description: "Type discriminator for elicitation schemas.", default: "object", }), ), }).annotate({ description: "Type-safe elicitation schema for requesting structured user input.\n\nThis represents a JSON Schema object with primitive-typed properties,\nas required by the elicitation specification.", }); export type ElicitationSchemaType = "object"; export const ElicitationSchemaType = Schema.Literal("object").annotate({ description: "Type discriminator for elicitation schemas.", }); export type ElicitationStringType = "string"; export const ElicitationStringType = Schema.Literal("string").annotate({ description: "Items definition for untitled multi-select enum properties.", }); export type ElicitationUrlMode = { readonly elicitationId: string; readonly url: string }; export const ElicitationUrlMode = Schema.Struct({ elicitationId: Schema.String.annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nUnique identifier for an elicitation.", }), url: Schema.String.annotate({ description: "The URL to direct the user to.", format: "uri" }), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nURL-based elicitation mode where the client directs the user to a URL.", }); export type EmbeddedResource = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly resource: EmbeddedResourceResource; }; export const EmbeddedResource = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), resource: EmbeddedResourceResource, }).annotate({ description: "The contents of a resource, embedded into a prompt or tool call result.", }); export type ErrorCode = | -32700 | -32600 | -32601 | -32602 | -32603 | -32800 | -32000 | -32002 | -32042 | number; export const ErrorCode = Schema.Union([ Schema.Literal(-32700).annotate({ title: "Parse error", description: "**Parse error**: Invalid JSON was received by the server.\nAn error occurred on the server while parsing the JSON text.", format: "int32", }), Schema.Literal(-32600).annotate({ title: "Invalid request", description: "**Invalid request**: The JSON sent is not a valid Request object.", format: "int32", }), Schema.Literal(-32601).annotate({ title: "Method not found", description: "**Method not found**: The method does not exist or is not available.", format: "int32", }), Schema.Literal(-32602).annotate({ title: "Invalid params", description: "**Invalid params**: Invalid method parameter(s).", format: "int32", }), Schema.Literal(-32603).annotate({ title: "Internal error", description: "**Internal error**: Internal JSON-RPC error.\nReserved for implementation-defined server errors.", format: "int32", }), Schema.Literal(-32800).annotate({ title: "Request cancelled", description: "**Request cancelled**: **UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nExecution of the method was aborted either due to a cancellation request from the caller or\nbecause of resource constraints or shutdown.", format: "int32", }), Schema.Literal(-32000).annotate({ title: "Authentication required", description: "**Authentication required**: Authentication is required before this operation can be performed.", format: "int32", }), Schema.Literal(-32002).annotate({ title: "Resource not found", description: "**Resource not found**: A given resource, such as a file, was not found.", format: "int32", }), Schema.Literal(-32042).annotate({ title: "URL elicitation required", description: "**URL elicitation required**: **UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nThe agent requires user input via a URL-based elicitation before it can proceed.", format: "int32", }), Schema.Number.annotate({ title: "Other", description: "Other undefined error code.", format: "int32", }).check(Schema.isInt()), ]).annotate({ description: "Predefined error codes for common JSON-RPC and ACP-specific errors.\n\nThese codes follow the JSON-RPC 2.0 specification for standard errors\nand use the reserved range (-32000 to -32099) for protocol-specific errors.", }); export type ExtNotification = unknown; export const ExtNotification = Schema.Unknown.annotate({ description: "Allows 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)", }); export type ExtRequest = unknown; export const ExtRequest = Schema.Unknown.annotate({ description: "Allows for sending 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)", }); export type ExtResponse = unknown; export const ExtResponse = Schema.Unknown.annotate({ description: "Allows for sending an arbitrary response to an [`ExtRequest`] 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)", }); export type FileSystemCapabilities = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly readTextFile?: boolean; readonly writeTextFile?: boolean; }; export const FileSystemCapabilities = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), readTextFile: Schema.optionalKey( Schema.Boolean.annotate({ description: "Whether the Client supports `fs/read_text_file` requests.", default: false, }), ), writeTextFile: Schema.optionalKey( Schema.Boolean.annotate({ description: "Whether the Client supports `fs/write_text_file` requests.", default: false, }), ), }).annotate({ description: "File system capabilities that a client may support.\n\nSee protocol docs: [FileSystem](https://agentclientprotocol.com/protocol/initialization#filesystem)", }); export type ForkSessionRequest = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly cwd: string; readonly mcpServers?: ReadonlyArray; readonly sessionId: string; }; export const ForkSessionRequest = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), cwd: Schema.String.annotate({ description: "The working directory for this session." }), mcpServers: Schema.optionalKey( Schema.Array(McpServer).annotate({ description: "List of MCP servers to connect to for this session.", }), ), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRequest parameters for forking an existing session.\n\nCreates a new session based on the context of an existing one, allowing\noperations like generating summaries without affecting the original session's history.\n\nOnly available if the Agent supports the `session.fork` capability.", }); export type ForkSessionResponse = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly configOptions?: ReadonlyArray | null; readonly models?: SessionModelState | null; readonly modes?: SessionModeState | null; readonly sessionId: string; }; export const ForkSessionResponse = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), configOptions: Schema.optionalKey( Schema.Union([ Schema.Array(SessionConfigOption).annotate({ description: "Initial session configuration options if supported by the Agent.", }), Schema.Null, ]), ), models: Schema.optionalKey( Schema.Union([SessionModelState, Schema.Null]).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial model state if supported by the Agent", }), ), modes: Schema.optionalKey( Schema.Union([SessionModeState, Schema.Null]).annotate({ description: "Initial mode state if supported by the Agent\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)", }), ), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse from forking an existing session.", }); export type ImageContent = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly data: string; readonly mimeType: string; readonly uri?: string | null; }; export const ImageContent = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), data: Schema.String, mimeType: Schema.String, uri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), }).annotate({ description: "An image provided to or from an LLM." }); export type InitializeRequest = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly clientCapabilities?: { readonly _meta?: { readonly [x: string]: unknown } | null; readonly auth?: { readonly _meta?: { readonly [x: string]: unknown } | null; readonly terminal?: boolean; }; readonly elicitation?: ElicitationCapabilities | null; readonly fs?: { readonly _meta?: { readonly [x: string]: unknown } | null; readonly readTextFile?: boolean; readonly writeTextFile?: boolean; }; readonly terminal?: boolean; }; readonly clientInfo?: Implementation | null; readonly protocolVersion: number; }; export const InitializeRequest = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), clientCapabilities: Schema.optionalKey( Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), auth: Schema.optionalKey( Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), terminal: Schema.optionalKey( Schema.Boolean.annotate({ description: "Whether the client supports `terminal` authentication methods.\n\nWhen `true`, the agent may include `terminal` entries in its authentication methods.", default: false, }), ), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nAuthentication capabilities supported by the client.\n\nAdvertised during initialization to inform the agent which authentication\nmethod types the client can handle. This governs opt-in types that require\nadditional client-side support.", default: { terminal: false }, }), ), elicitation: Schema.optionalKey( Schema.Union([ElicitationCapabilities, Schema.Null]).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nElicitation capabilities supported by the client.\nDetermines which elicitation modes the agent may use.", }), ), fs: Schema.optionalKey( Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), readTextFile: Schema.optionalKey( Schema.Boolean.annotate({ description: "Whether the Client supports `fs/read_text_file` requests.", default: false, }), ), writeTextFile: Schema.optionalKey( Schema.Boolean.annotate({ description: "Whether the Client supports `fs/write_text_file` requests.", default: false, }), ), }).annotate({ description: "File system capabilities that a client may support.\n\nSee protocol docs: [FileSystem](https://agentclientprotocol.com/protocol/initialization#filesystem)", default: { readTextFile: false, writeTextFile: false }, }), ), terminal: Schema.optionalKey( Schema.Boolean.annotate({ description: "Whether the Client support all `terminal/*` methods.", default: false, }), ), }).annotate({ description: "Capabilities supported by the client.\n\nAdvertised during initialization to inform the agent about\navailable features and methods.\n\nSee protocol docs: [Client Capabilities](https://agentclientprotocol.com/protocol/initialization#client-capabilities)", default: { auth: { terminal: false }, fs: { readTextFile: false, writeTextFile: false }, terminal: false, }, }), ), clientInfo: Schema.optionalKey( Schema.Union([Implementation, Schema.Null]).annotate({ description: "Information about the Client name and version sent to the Agent.\n\nNote: in future versions of the protocol, this will be required.", }), ), protocolVersion: Schema.Number.annotate({ description: "Protocol version identifier.\n\nThis version is only bumped for breaking changes.\nNon-breaking changes should be introduced via capabilities.", format: "uint16", }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)) .check(Schema.isLessThanOrEqualTo(65535)), }).annotate({ description: "Request parameters for the initialize method.\n\nSent by the client to establish connection and negotiate capabilities.\n\nSee protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization)", }); export type InitializeResponse = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly agentCapabilities?: { readonly _meta?: { readonly [x: string]: unknown } | null; readonly auth?: { readonly _meta?: { readonly [x: string]: unknown } | null; readonly logout?: LogoutCapabilities | null; }; readonly loadSession?: boolean; readonly mcpCapabilities?: { readonly _meta?: { readonly [x: string]: unknown } | null; readonly http?: boolean; readonly sse?: boolean; }; readonly promptCapabilities?: { readonly _meta?: { readonly [x: string]: unknown } | null; readonly audio?: boolean; readonly embeddedContext?: boolean; readonly image?: boolean; }; readonly sessionCapabilities?: { readonly _meta?: { readonly [x: string]: unknown } | null; readonly close?: SessionCloseCapabilities | null; readonly fork?: SessionForkCapabilities | null; readonly list?: SessionListCapabilities | null; readonly resume?: SessionResumeCapabilities | null; }; }; readonly agentInfo?: Implementation | null; readonly authMethods?: ReadonlyArray; readonly protocolVersion: number; }; export const InitializeResponse = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), agentCapabilities: Schema.optionalKey( Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), auth: Schema.optionalKey( Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), logout: Schema.optionalKey( Schema.Union([LogoutCapabilities, Schema.Null]).annotate({ description: "Whether the agent supports the logout method.\n\nBy supplying `{}` it means that the agent supports the logout method.", }), ), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nAuthentication-related capabilities supported by the agent.", default: {}, }), ), loadSession: Schema.optionalKey( Schema.Boolean.annotate({ description: "Whether the agent supports `session/load`.", default: false, }), ), mcpCapabilities: Schema.optionalKey( Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), http: Schema.optionalKey( Schema.Boolean.annotate({ description: "Agent supports [`McpServer::Http`].", default: false, }), ), sse: Schema.optionalKey( Schema.Boolean.annotate({ description: "Agent supports [`McpServer::Sse`].", default: false, }), ), }).annotate({ description: "MCP capabilities supported by the agent", default: { http: false, sse: false }, }), ), promptCapabilities: Schema.optionalKey( Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), audio: Schema.optionalKey( Schema.Boolean.annotate({ description: "Agent supports [`ContentBlock::Audio`].", default: false, }), ), embeddedContext: Schema.optionalKey( Schema.Boolean.annotate({ description: "Agent supports embedded context in `session/prompt` requests.\n\nWhen enabled, the Client is allowed to include [`ContentBlock::Resource`]\nin prompt requests for pieces of context that are referenced in the message.", default: false, }), ), image: Schema.optionalKey( Schema.Boolean.annotate({ description: "Agent supports [`ContentBlock::Image`].", default: false, }), ), }).annotate({ description: "Prompt capabilities supported by the agent in `session/prompt` requests.\n\nBaseline agent functionality requires support for [`ContentBlock::Text`]\nand [`ContentBlock::ResourceLink`] in prompt requests.\n\nOther variants must be explicitly opted in to.\nCapabilities for different types of content in prompt requests.\n\nIndicates which content types beyond the baseline (text and resource links)\nthe agent can process.\n\nSee protocol docs: [Prompt Capabilities](https://agentclientprotocol.com/protocol/initialization#prompt-capabilities)", default: { audio: false, embeddedContext: false, image: false }, }), ), sessionCapabilities: Schema.optionalKey( Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), close: Schema.optionalKey( Schema.Union([SessionCloseCapabilities, Schema.Null]).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nWhether the agent supports `session/close`.", }), ), fork: Schema.optionalKey( Schema.Union([SessionForkCapabilities, Schema.Null]).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nWhether the agent supports `session/fork`.", }), ), list: Schema.optionalKey( Schema.Union([SessionListCapabilities, Schema.Null]).annotate({ description: "Whether the agent supports `session/list`.", }), ), resume: Schema.optionalKey( Schema.Union([SessionResumeCapabilities, Schema.Null]).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nWhether the agent supports `session/resume`.", }), ), }).annotate({ default: {}, description: "Session capabilities supported by the agent.\n\nAs a baseline, all Agents **MUST** support `session/new`, `session/prompt`, `session/cancel`, and `session/update`.\n\nOptionally, they **MAY** support other session methods and notifications by specifying additional capabilities.\n\nNote: `session/load` is still handled by the top-level `load_session` capability. This will be unified in future versions of the protocol.\n\nSee protocol docs: [Session Capabilities](https://agentclientprotocol.com/protocol/initialization#session-capabilities)", }), ), }).annotate({ description: "Capabilities supported by the agent.\n\nAdvertised during initialization to inform the client about\navailable features and content types.\n\nSee protocol docs: [Agent Capabilities](https://agentclientprotocol.com/protocol/initialization#agent-capabilities)", default: { auth: {}, loadSession: false, mcpCapabilities: { http: false, sse: false }, promptCapabilities: { audio: false, embeddedContext: false, image: false }, sessionCapabilities: {}, }, }), ), agentInfo: Schema.optionalKey( Schema.Union([Implementation, Schema.Null]).annotate({ description: "Information about the Agent name and version sent to the Client.\n\nNote: in future versions of the protocol, this will be required.", }), ), authMethods: Schema.optionalKey( Schema.Array(AuthMethod).annotate({ description: "Authentication methods supported by the agent.", default: [], }), ), protocolVersion: Schema.Number.annotate({ description: "Protocol version identifier.\n\nThis version is only bumped for breaking changes.\nNon-breaking changes should be introduced via capabilities.", format: "uint16", }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)) .check(Schema.isLessThanOrEqualTo(65535)), }).annotate({ description: "Response to the `initialize` method.\n\nContains the negotiated protocol version and agent capabilities.\n\nSee protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization)", }); export type IntegerPropertySchema = { readonly default?: number | null; readonly description?: string | null; readonly maximum?: number | null; readonly minimum?: number | null; readonly title?: string | null; }; export const IntegerPropertySchema = Schema.Struct({ default: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "Default value.", format: "int64" }).check( Schema.isInt(), ), Schema.Null, ]), ), description: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Human-readable description." }), Schema.Null, ]), ), maximum: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "Maximum value (inclusive).", format: "int64" }).check( Schema.isInt(), ), Schema.Null, ]), ), minimum: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "Minimum value (inclusive).", format: "int64" }).check( Schema.isInt(), ), Schema.Null, ]), ), title: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Optional title for the property." }), Schema.Null, ]), ), }).annotate({ description: "Schema for integer properties in an elicitation form." }); export type KillTerminalRequest = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly sessionId: string; readonly terminalId: string; }; export const KillTerminalRequest = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), terminalId: Schema.String.annotate({ description: "The ID of the terminal to kill." }), }).annotate({ description: "Request to kill a terminal without releasing it." }); export type KillTerminalResponse = { readonly _meta?: { readonly [x: string]: unknown } | null }; export const KillTerminalResponse = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), }).annotate({ description: "Response to `terminal/kill` method" }); export type ListSessionsRequest = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly cursor?: string | null; readonly cwd?: string | null; }; export const ListSessionsRequest = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), cursor: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Opaque cursor token from a previous response's nextCursor field for cursor-based pagination", }), Schema.Null, ]), ), cwd: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Filter sessions by working directory. Must be an absolute path.", }), Schema.Null, ]), ), }).annotate({ description: "Request parameters for listing existing sessions.\n\nOnly available if the Agent supports the `sessionCapabilities.list` capability.", }); export type ListSessionsResponse = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly nextCursor?: string | null; readonly sessions: ReadonlyArray; }; export const ListSessionsResponse = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), nextCursor: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Opaque cursor token. If present, pass this in the next request's cursor parameter\nto fetch the next page. If absent, there are no more results.", }), Schema.Null, ]), ), sessions: Schema.Array(SessionInfo).annotate({ description: "Array of session information objects", }), }).annotate({ description: "Response from listing sessions." }); export type LoadSessionRequest = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly cwd: string; readonly mcpServers: ReadonlyArray; readonly sessionId: string; }; export const LoadSessionRequest = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), cwd: Schema.String.annotate({ description: "The working directory for this session." }), mcpServers: Schema.Array(McpServer).annotate({ description: "List of MCP servers to connect to for this session.", }), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), }).annotate({ description: "Request parameters for loading an existing session.\n\nOnly available if the Agent supports the `loadSession` capability.\n\nSee protocol docs: [Loading Sessions](https://agentclientprotocol.com/protocol/session-setup#loading-sessions)", }); export type LoadSessionResponse = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly configOptions?: ReadonlyArray | null; readonly models?: SessionModelState | null; readonly modes?: SessionModeState | null; }; export const LoadSessionResponse = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), configOptions: Schema.optionalKey( Schema.Union([ Schema.Array(SessionConfigOption).annotate({ description: "Initial session configuration options if supported by the Agent.", }), Schema.Null, ]), ), models: Schema.optionalKey( Schema.Union([SessionModelState, Schema.Null]).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial model state if supported by the Agent", }), ), modes: Schema.optionalKey( Schema.Union([SessionModeState, Schema.Null]).annotate({ description: "Initial mode state if supported by the Agent\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)", }), ), }).annotate({ description: "Response from loading an existing session." }); export type LogoutRequest = { readonly _meta?: { readonly [x: string]: unknown } | null }; export const LogoutRequest = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRequest parameters for the logout method.\n\nTerminates the current authenticated session.", }); export type LogoutResponse = { readonly _meta?: { readonly [x: string]: unknown } | null }; export const LogoutResponse = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse to the `logout` method.", }); export type McpCapabilities = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly http?: boolean; readonly sse?: boolean; }; export const McpCapabilities = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), http: Schema.optionalKey( Schema.Boolean.annotate({ description: "Agent supports [`McpServer::Http`].", default: false }), ), sse: Schema.optionalKey( Schema.Boolean.annotate({ description: "Agent supports [`McpServer::Sse`].", default: false }), ), }).annotate({ description: "MCP capabilities supported by the agent" }); export type McpServerHttp = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly headers: ReadonlyArray; readonly name: string; readonly url: string; }; export const McpServerHttp = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), headers: Schema.Array(HttpHeader).annotate({ description: "HTTP headers to set when making requests to the MCP server.", }), name: Schema.String.annotate({ description: "Human-readable name identifying this MCP server." }), url: Schema.String.annotate({ description: "URL to the MCP server." }), }).annotate({ description: "HTTP transport configuration for MCP." }); export type McpServerSse = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly headers: ReadonlyArray; readonly name: string; readonly url: string; }; export const McpServerSse = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), headers: Schema.Array(HttpHeader).annotate({ description: "HTTP headers to set when making requests to the MCP server.", }), name: Schema.String.annotate({ description: "Human-readable name identifying this MCP server." }), url: Schema.String.annotate({ description: "URL to the MCP server." }), }).annotate({ description: "SSE transport configuration for MCP." }); export type McpServerStdio = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly args: ReadonlyArray; readonly command: string; readonly env: ReadonlyArray; readonly name: string; }; export const McpServerStdio = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), args: Schema.Array(Schema.String).annotate({ description: "Command-line arguments to pass to the MCP server.", }), command: Schema.String.annotate({ description: "Path to the MCP server executable." }), env: Schema.Array(EnvVariable).annotate({ description: "Environment variables to set when launching the MCP server.", }), name: Schema.String.annotate({ description: "Human-readable name identifying this MCP server." }), }).annotate({ description: "Stdio transport configuration for MCP." }); export type ModelId = string; export const ModelId = Schema.String.annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA unique identifier for a model.", }); export type MultiSelectItems = | { readonly enum: ReadonlyArray; readonly type: "string" } | { readonly anyOf: ReadonlyArray }; export const MultiSelectItems = Schema.Union([ Schema.Struct({ enum: Schema.Array(Schema.String).annotate({ description: "Allowed enum values." }), type: Schema.Literal("string").annotate({ description: "Items definition for untitled multi-select enum properties.", }), }).annotate({ title: "Untitled", description: "Items definition for untitled multi-select enum properties.", }), Schema.Struct({ anyOf: Schema.Array(EnumOption).annotate({ description: "Titled enum options." }), }).annotate({ title: "Titled", description: "Items definition for titled multi-select enum properties.", }), ]).annotate({ description: "Items for a multi-select (array) property schema." }); export type MultiSelectPropertySchema = { readonly default?: ReadonlyArray | null; readonly description?: string | null; readonly items: | { readonly enum: ReadonlyArray; readonly type: "string" } | { readonly anyOf: ReadonlyArray }; readonly maxItems?: number | null; readonly minItems?: number | null; readonly title?: string | null; }; export const MultiSelectPropertySchema = Schema.Struct({ default: Schema.optionalKey( Schema.Union([ Schema.Array(Schema.String).annotate({ description: "Default selected values." }), Schema.Null, ]), ), description: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Human-readable description." }), Schema.Null, ]), ), items: Schema.Union([ Schema.Struct({ enum: Schema.Array(Schema.String).annotate({ description: "Allowed enum values." }), type: Schema.Literal("string").annotate({ description: "Items definition for untitled multi-select enum properties.", }), }).annotate({ title: "Untitled", description: "Items definition for untitled multi-select enum properties.", }), Schema.Struct({ anyOf: Schema.Array(EnumOption).annotate({ description: "Titled enum options." }), }).annotate({ title: "Titled", description: "Items definition for titled multi-select enum properties.", }), ]).annotate({ description: "Items for a multi-select (array) property schema." }), maxItems: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "Maximum number of items to select.", format: "uint64", }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)), Schema.Null, ]), ), minItems: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "Minimum number of items to select.", format: "uint64", }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)), Schema.Null, ]), ), title: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Optional title for the property." }), Schema.Null, ]), ), }).annotate({ description: "Schema for multi-select (array) properties in an elicitation form." }); export type NewSessionRequest = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly cwd: string; readonly mcpServers: ReadonlyArray; }; export const NewSessionRequest = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), cwd: Schema.String.annotate({ description: "The working directory for this session. Must be an absolute path.", }), mcpServers: Schema.Array(McpServer).annotate({ description: "List of MCP (Model Context Protocol) servers the agent should connect to.", }), }).annotate({ description: "Request parameters for creating a new session.\n\nSee protocol docs: [Creating a Session](https://agentclientprotocol.com/protocol/session-setup#creating-a-session)", }); export type NewSessionResponse = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly configOptions?: ReadonlyArray | null; readonly models?: SessionModelState | null; readonly modes?: SessionModeState | null; readonly sessionId: string; }; export const NewSessionResponse = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), configOptions: Schema.optionalKey( Schema.Union([ Schema.Array(SessionConfigOption).annotate({ description: "Initial session configuration options if supported by the Agent.", }), Schema.Null, ]), ), models: Schema.optionalKey( Schema.Union([SessionModelState, Schema.Null]).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial model state if supported by the Agent", }), ), modes: Schema.optionalKey( Schema.Union([SessionModeState, Schema.Null]).annotate({ description: "Initial mode state if supported by the Agent\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)", }), ), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), }).annotate({ description: "Response from creating a new session.\n\nSee protocol docs: [Creating a Session](https://agentclientprotocol.com/protocol/session-setup#creating-a-session)", }); export type NumberPropertySchema = { readonly default?: number | null; readonly description?: string | null; readonly maximum?: number | null; readonly minimum?: number | null; readonly title?: string | null; }; export const NumberPropertySchema = Schema.Struct({ default: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "Default value.", format: "double" }).check( Schema.isFinite(), ), Schema.Null, ]), ), description: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Human-readable description." }), Schema.Null, ]), ), maximum: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "Maximum value (inclusive).", format: "double" }).check( Schema.isFinite(), ), Schema.Null, ]), ), minimum: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "Minimum value (inclusive).", format: "double" }).check( Schema.isFinite(), ), Schema.Null, ]), ), title: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Optional title for the property." }), Schema.Null, ]), ), }).annotate({ description: "Schema for number (floating-point) properties in an elicitation form.", }); export type PermissionOptionId = string; export const PermissionOptionId = Schema.String.annotate({ description: "Unique identifier for a permission option.", }); export type PermissionOptionKind = "allow_once" | "allow_always" | "reject_once" | "reject_always"; export const PermissionOptionKind = Schema.Literals([ "allow_once", "allow_always", "reject_once", "reject_always", ]).annotate({ description: "The type of permission option being presented to the user.\n\nHelps clients choose appropriate icons and UI treatment.", }); export type Plan = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly entries: ReadonlyArray; }; export const Plan = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), entries: Schema.Array(PlanEntry).annotate({ description: "The list of tasks to be accomplished.\n\nWhen updating a plan, the agent must send a complete list of all entries\nwith their current status. The client replaces the entire plan with each update.", }), }).annotate({ description: "An execution plan for accomplishing complex tasks.\n\nPlans consist of multiple entries representing individual tasks or goals.\nAgents report plans to clients to provide visibility into their execution strategy.\nPlans can evolve during execution as the agent discovers new requirements or completes tasks.\n\nSee protocol docs: [Agent Plan](https://agentclientprotocol.com/protocol/agent-plan)", }); export type PlanEntryPriority = "high" | "medium" | "low"; export const PlanEntryPriority = Schema.Literals(["high", "medium", "low"]).annotate({ description: "Priority levels for plan entries.\n\nUsed to indicate the relative importance or urgency of different\ntasks in the execution plan.\nSee protocol docs: [Plan Entries](https://agentclientprotocol.com/protocol/agent-plan#plan-entries)", }); export type PlanEntryStatus = "pending" | "in_progress" | "completed"; export const PlanEntryStatus = Schema.Literals(["pending", "in_progress", "completed"]).annotate({ description: "Status of a plan entry in the execution flow.\n\nTracks the lifecycle of each task from planning through completion.\nSee protocol docs: [Plan Entries](https://agentclientprotocol.com/protocol/agent-plan#plan-entries)", }); export type PromptCapabilities = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly audio?: boolean; readonly embeddedContext?: boolean; readonly image?: boolean; }; export const PromptCapabilities = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), audio: Schema.optionalKey( Schema.Boolean.annotate({ description: "Agent supports [`ContentBlock::Audio`].", default: false, }), ), embeddedContext: Schema.optionalKey( Schema.Boolean.annotate({ description: "Agent supports embedded context in `session/prompt` requests.\n\nWhen enabled, the Client is allowed to include [`ContentBlock::Resource`]\nin prompt requests for pieces of context that are referenced in the message.", default: false, }), ), image: Schema.optionalKey( Schema.Boolean.annotate({ description: "Agent supports [`ContentBlock::Image`].", default: false, }), ), }).annotate({ description: "Prompt capabilities supported by the agent in `session/prompt` requests.\n\nBaseline agent functionality requires support for [`ContentBlock::Text`]\nand [`ContentBlock::ResourceLink`] in prompt requests.\n\nOther variants must be explicitly opted in to.\nCapabilities for different types of content in prompt requests.\n\nIndicates which content types beyond the baseline (text and resource links)\nthe agent can process.\n\nSee protocol docs: [Prompt Capabilities](https://agentclientprotocol.com/protocol/initialization#prompt-capabilities)", }); export type PromptRequest = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly messageId?: string | null; readonly prompt: ReadonlyArray; readonly sessionId: string; }; export const PromptRequest = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), messageId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA client-generated unique identifier for this user message.\n\nIf provided, the Agent SHOULD echo this value as `userMessageId` in the\n[`PromptResponse`] to confirm it was recorded.\nBoth clients and agents MUST use UUID format for message IDs.", }), Schema.Null, ]), ), prompt: Schema.Array(ContentBlock).annotate({ description: "The blocks of content that compose the user's message.\n\nAs a baseline, the Agent MUST support [`ContentBlock::Text`] and [`ContentBlock::ResourceLink`],\nwhile other variants are optionally enabled via [`PromptCapabilities`].\n\nThe Client MUST adapt its interface according to [`PromptCapabilities`].\n\nThe client MAY include referenced pieces of context as either\n[`ContentBlock::Resource`] or [`ContentBlock::ResourceLink`].\n\nWhen available, [`ContentBlock::Resource`] is preferred\nas it avoids extra round-trips and allows the message to include\npieces of context from sources the agent may not have access to.", }), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), }).annotate({ description: "Request parameters for sending a user prompt to the agent.\n\nContains the user's message and any additional context.\n\nSee protocol docs: [User Message](https://agentclientprotocol.com/protocol/prompt-turn#1-user-message)", }); export type PromptResponse = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly stopReason: "end_turn" | "max_tokens" | "max_turn_requests" | "refusal" | "cancelled"; readonly usage?: Usage | null; readonly userMessageId?: string | null; }; export const PromptResponse = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), stopReason: Schema.Literals([ "end_turn", "max_tokens", "max_turn_requests", "refusal", "cancelled", ]).annotate({ description: "Reasons why an agent stops processing a prompt turn.\n\nSee protocol docs: [Stop Reasons](https://agentclientprotocol.com/protocol/prompt-turn#stop-reasons)", }), usage: Schema.optionalKey( Schema.Union([Usage, Schema.Null]).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nToken usage for this turn (optional).", }), ), userMessageId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nThe acknowledged user message ID.\n\nIf the client provided a `messageId` in the [`PromptRequest`], the agent echoes it here\nto confirm it was recorded. If the client did not provide one, the agent MAY assign one\nand return it here. Absence of this field indicates the agent did not record a message ID.", }), Schema.Null, ]), ), }).annotate({ description: "Response from processing a user prompt.\n\nSee protocol docs: [Check for Completion](https://agentclientprotocol.com/protocol/prompt-turn#4-check-for-completion)", }); export type ProtocolVersion = number; export const ProtocolVersion = Schema.Number.annotate({ description: "Protocol version identifier.\n\nThis version is only bumped for breaking changes.\nNon-breaking changes should be introduced via capabilities.", format: "uint16", }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)) .check(Schema.isLessThanOrEqualTo(65535)); export type ReadTextFileRequest = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly limit?: number | null; readonly line?: number | null; readonly path: string; readonly sessionId: string; }; export const ReadTextFileRequest = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), limit: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "Maximum number of lines to read.", format: "uint32" }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)), Schema.Null, ]), ), line: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "Line number to start reading from (1-based).", format: "uint32", }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)), Schema.Null, ]), ), path: Schema.String.annotate({ description: "Absolute path to the file to read." }), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), }).annotate({ description: "Request to read content from a text file.\n\nOnly available if the client supports the `fs.readTextFile` capability.", }); export type ReadTextFileResponse = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly content: string; }; export const ReadTextFileResponse = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), content: Schema.String, }).annotate({ description: "Response containing the contents of a text file." }); export type ReleaseTerminalRequest = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly sessionId: string; readonly terminalId: string; }; export const ReleaseTerminalRequest = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), terminalId: Schema.String.annotate({ description: "The ID of the terminal to release." }), }).annotate({ description: "Request to release a terminal and free its resources." }); export type ReleaseTerminalResponse = { readonly _meta?: { readonly [x: string]: unknown } | null }; export const ReleaseTerminalResponse = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), }).annotate({ description: "Response to terminal/release method" }); export type RequestPermissionOutcome = | { readonly outcome: "cancelled" } | { readonly outcome: "selected"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly optionId: string; }; export const RequestPermissionOutcome = Schema.Union( [ Schema.Struct({ outcome: Schema.Literal("cancelled") }).annotate({ description: "The prompt turn was cancelled before the user responded.\n\nWhen a client sends a `session/cancel` notification to cancel an ongoing\nprompt turn, it MUST respond to all pending `session/request_permission`\nrequests with this `Cancelled` outcome.\n\nSee protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/prompt-turn#cancellation)", }), Schema.Struct({ outcome: Schema.Literal("selected"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), optionId: Schema.String.annotate({ description: "Unique identifier for a permission option.", }), }).annotate({ description: "The user selected one of the provided options." }), ], { mode: "oneOf" }, ).annotate({ description: "The outcome of a permission request." }); export type RequestPermissionRequest = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly options: ReadonlyArray; readonly sessionId: string; readonly toolCall: { readonly _meta?: { readonly [x: string]: unknown } | null; readonly content?: ReadonlyArray | null; readonly kind?: ToolKind | null; readonly locations?: ReadonlyArray | null; readonly rawInput?: unknown; readonly rawOutput?: unknown; readonly status?: ToolCallStatus | null; readonly title?: string | null; readonly toolCallId: string; }; }; export const RequestPermissionRequest = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), options: Schema.Array(PermissionOption).annotate({ description: "Available permission options for the user to choose from.", }), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), toolCall: Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), content: Schema.optionalKey( Schema.Union([ Schema.Array(ToolCallContent).annotate({ description: "Replace the content collection." }), Schema.Null, ]), ), kind: Schema.optionalKey( Schema.Union([ToolKind, Schema.Null]).annotate({ description: "Update the tool kind." }), ), locations: Schema.optionalKey( Schema.Union([ Schema.Array(ToolCallLocation).annotate({ description: "Replace the locations collection.", }), Schema.Null, ]), ), rawInput: Schema.optionalKey(Schema.Unknown.annotate({ description: "Update the raw input." })), rawOutput: Schema.optionalKey( Schema.Unknown.annotate({ description: "Update the raw output." }), ), status: Schema.optionalKey( Schema.Union([ToolCallStatus, Schema.Null]).annotate({ description: "Update the execution status.", }), ), title: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Update the human-readable title." }), Schema.Null, ]), ), toolCallId: Schema.String.annotate({ description: "Unique identifier for a tool call within a session.", }), }).annotate({ description: "An update to an existing tool call.\n\nUsed to report progress and results as tools execute. All fields except\nthe tool call ID are optional - only changed fields need to be included.\n\nSee protocol docs: [Updating](https://agentclientprotocol.com/protocol/tool-calls#updating)", }), }).annotate({ description: "Request for user permission to execute a tool call.\n\nSent when the agent needs authorization before performing a sensitive operation.\n\nSee protocol docs: [Requesting Permission](https://agentclientprotocol.com/protocol/tool-calls#requesting-permission)", }); export type RequestPermissionResponse = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly outcome: | { readonly outcome: "cancelled" } | { readonly outcome: "selected"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly optionId: string; }; }; export const RequestPermissionResponse = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), outcome: Schema.Union( [ Schema.Struct({ outcome: Schema.Literal("cancelled") }).annotate({ description: "The prompt turn was cancelled before the user responded.\n\nWhen a client sends a `session/cancel` notification to cancel an ongoing\nprompt turn, it MUST respond to all pending `session/request_permission`\nrequests with this `Cancelled` outcome.\n\nSee protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/prompt-turn#cancellation)", }), Schema.Struct({ outcome: Schema.Literal("selected"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), optionId: Schema.String.annotate({ description: "Unique identifier for a permission option.", }), }).annotate({ description: "The user selected one of the provided options." }), ], { mode: "oneOf" }, ).annotate({ description: "The outcome of a permission request." }), }).annotate({ description: "Response to a permission request." }); export type ResourceLink = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly description?: string | null; readonly mimeType?: string | null; readonly name: string; readonly size?: number | null; readonly title?: string | null; readonly uri: string; }; export const ResourceLink = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), mimeType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), name: Schema.String, size: Schema.optionalKey( Schema.Union([Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null]), ), title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), uri: Schema.String, }).annotate({ description: "A resource that the server is capable of reading, included in a prompt or tool call result.", }); export type ResumeSessionRequest = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly cwd: string; readonly mcpServers?: ReadonlyArray; readonly sessionId: string; }; export const ResumeSessionRequest = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), cwd: Schema.String.annotate({ description: "The working directory for this session." }), mcpServers: Schema.optionalKey( Schema.Array(McpServer).annotate({ description: "List of MCP servers to connect to for this session.", }), ), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRequest parameters for resuming an existing session.\n\nResumes an existing session without returning previous messages (unlike `session/load`).\nThis is useful for agents that can resume sessions but don't implement full session loading.\n\nOnly available if the Agent supports the `session.resume` capability.", }); export type ResumeSessionResponse = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly configOptions?: ReadonlyArray | null; readonly models?: SessionModelState | null; readonly modes?: SessionModeState | null; }; export const ResumeSessionResponse = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), configOptions: Schema.optionalKey( Schema.Union([ Schema.Array(SessionConfigOption).annotate({ description: "Initial session configuration options if supported by the Agent.", }), Schema.Null, ]), ), models: Schema.optionalKey( Schema.Union([SessionModelState, Schema.Null]).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial model state if supported by the Agent", }), ), modes: Schema.optionalKey( Schema.Union([SessionModeState, Schema.Null]).annotate({ description: "Initial mode state if supported by the Agent\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)", }), ), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse from resuming an existing session.", }); export type SelectedPermissionOutcome = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly optionId: string; }; export const SelectedPermissionOutcome = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), optionId: Schema.String.annotate({ description: "Unique identifier for a permission option." }), }).annotate({ description: "The user selected one of the provided options." }); export type SessionCapabilities = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly close?: SessionCloseCapabilities | null; readonly fork?: SessionForkCapabilities | null; readonly list?: SessionListCapabilities | null; readonly resume?: SessionResumeCapabilities | null; }; export const SessionCapabilities = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), close: Schema.optionalKey( Schema.Union([SessionCloseCapabilities, Schema.Null]).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nWhether the agent supports `session/close`.", }), ), fork: Schema.optionalKey( Schema.Union([SessionForkCapabilities, Schema.Null]).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nWhether the agent supports `session/fork`.", }), ), list: Schema.optionalKey( Schema.Union([SessionListCapabilities, Schema.Null]).annotate({ description: "Whether the agent supports `session/list`.", }), ), resume: Schema.optionalKey( Schema.Union([SessionResumeCapabilities, Schema.Null]).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nWhether the agent supports `session/resume`.", }), ), }).annotate({ description: "Session capabilities supported by the agent.\n\nAs a baseline, all Agents **MUST** support `session/new`, `session/prompt`, `session/cancel`, and `session/update`.\n\nOptionally, they **MAY** support other session methods and notifications by specifying additional capabilities.\n\nNote: `session/load` is still handled by the top-level `load_session` capability. This will be unified in future versions of the protocol.\n\nSee protocol docs: [Session Capabilities](https://agentclientprotocol.com/protocol/initialization#session-capabilities)", }); export type SessionConfigBoolean = { readonly currentValue: boolean }; export const SessionConfigBoolean = Schema.Struct({ currentValue: Schema.Boolean.annotate({ description: "The current value of the boolean option.", }), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA boolean on/off toggle session configuration option payload.", }); export type SessionConfigGroupId = string; export const SessionConfigGroupId = Schema.String.annotate({ description: "Unique identifier for a session configuration option value group.", }); export type SessionConfigId = string; export const SessionConfigId = Schema.String.annotate({ description: "Unique identifier for a session configuration option.", }); export type SessionConfigSelect = { readonly currentValue: string; readonly options: | ReadonlyArray | ReadonlyArray; }; export const SessionConfigSelect = Schema.Struct({ currentValue: Schema.String.annotate({ description: "Unique identifier for a session configuration option value.", }), options: Schema.Union([ Schema.Array(SessionConfigSelectOption).annotate({ title: "Ungrouped", description: "A flat list of options with no grouping.", }), Schema.Array(SessionConfigSelectGroup).annotate({ title: "Grouped", description: "A list of options grouped under headers.", }), ]).annotate({ description: "Possible values for a session configuration option." }), }).annotate({ description: "A single-value selector (dropdown) session configuration option payload.", }); export type SessionConfigSelectOptions = | ReadonlyArray | ReadonlyArray; export const SessionConfigSelectOptions = Schema.Union([ Schema.Array(SessionConfigSelectOption).annotate({ title: "Ungrouped", description: "A flat list of options with no grouping.", }), Schema.Array(SessionConfigSelectGroup).annotate({ title: "Grouped", description: "A list of options grouped under headers.", }), ]).annotate({ description: "Possible values for a session configuration option." }); export type SessionConfigValueId = string; export const SessionConfigValueId = Schema.String.annotate({ description: "Unique identifier for a session configuration option value.", }); export type SessionId = string; export const SessionId = Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }); export type SessionInfoUpdate = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly title?: string | null; readonly updatedAt?: string | null; }; export const SessionInfoUpdate = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), title: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Human-readable title for the session. Set to null to clear.", }), Schema.Null, ]), ), updatedAt: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "ISO 8601 timestamp of last activity. Set to null to clear.", }), Schema.Null, ]), ), }).annotate({ description: "Update to session metadata. All fields are optional to support partial updates.\n\nAgents send this notification to update session information like title or custom metadata.\nThis allows clients to display dynamic session names and track session state changes.", }); export type SessionNotification = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly sessionId: string; readonly update: | { readonly sessionUpdate: "user_message_chunk"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly content: | { readonly type: "text"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly text: string; } | { readonly type: "image"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly data: string; readonly mimeType: string; readonly uri?: string | null; } | { readonly type: "audio"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly data: string; readonly mimeType: string; } | { readonly type: "resource_link"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly description?: string | null; readonly mimeType?: string | null; readonly name: string; readonly size?: number | null; readonly title?: string | null; readonly uri: string; } | { readonly type: "resource"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly resource: EmbeddedResourceResource; }; readonly messageId?: string | null; } | { readonly sessionUpdate: "agent_message_chunk"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly content: | { readonly type: "text"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly text: string; } | { readonly type: "image"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly data: string; readonly mimeType: string; readonly uri?: string | null; } | { readonly type: "audio"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly data: string; readonly mimeType: string; } | { readonly type: "resource_link"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly description?: string | null; readonly mimeType?: string | null; readonly name: string; readonly size?: number | null; readonly title?: string | null; readonly uri: string; } | { readonly type: "resource"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly resource: EmbeddedResourceResource; }; readonly messageId?: string | null; } | { readonly sessionUpdate: "agent_thought_chunk"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly content: | { readonly type: "text"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly text: string; } | { readonly type: "image"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly data: string; readonly mimeType: string; readonly uri?: string | null; } | { readonly type: "audio"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly data: string; readonly mimeType: string; } | { readonly type: "resource_link"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly description?: string | null; readonly mimeType?: string | null; readonly name: string; readonly size?: number | null; readonly title?: string | null; readonly uri: string; } | { readonly type: "resource"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly resource: EmbeddedResourceResource; }; readonly messageId?: string | null; } | { readonly sessionUpdate: "tool_call"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly content?: ReadonlyArray; readonly kind?: | "read" | "edit" | "delete" | "move" | "search" | "execute" | "think" | "fetch" | "switch_mode" | "other"; readonly locations?: ReadonlyArray; readonly rawInput?: unknown; readonly rawOutput?: unknown; readonly status?: "pending" | "in_progress" | "completed" | "failed"; readonly title: string; readonly toolCallId: string; } | { readonly sessionUpdate: "tool_call_update"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly content?: ReadonlyArray | null; readonly kind?: ToolKind | null; readonly locations?: ReadonlyArray | null; readonly rawInput?: unknown; readonly rawOutput?: unknown; readonly status?: ToolCallStatus | null; readonly title?: string | null; readonly toolCallId: string; } | { readonly sessionUpdate: "plan"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly entries: ReadonlyArray; } | { readonly sessionUpdate: "available_commands_update"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly availableCommands: ReadonlyArray; } | { readonly sessionUpdate: "current_mode_update"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly currentModeId: string; } | { readonly sessionUpdate: "config_option_update"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly configOptions: ReadonlyArray; } | { readonly sessionUpdate: "session_info_update"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly title?: string | null; readonly updatedAt?: string | null; } | { readonly sessionUpdate: "usage_update"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly cost?: Cost | null; readonly size: number; readonly used: number; }; }; export const SessionNotification = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), update: Schema.Union( [ Schema.Struct({ sessionUpdate: Schema.Literal("user_message_chunk"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), content: Schema.Union( [ Schema.Struct({ type: Schema.Literal("text"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), text: Schema.String, }).annotate({ description: "Text provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("image"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), data: Schema.String, mimeType: Schema.String, uri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), }).annotate({ description: "An image provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("audio"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), data: Schema.String, mimeType: Schema.String, }).annotate({ description: "Audio provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("resource_link"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), mimeType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), name: Schema.String, size: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null, ]), ), title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), uri: Schema.String, }).annotate({ description: "A resource that the server is capable of reading, included in a prompt or tool call result.", }), Schema.Struct({ type: Schema.Literal("resource"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), resource: EmbeddedResourceResource, }).annotate({ description: "The contents of a resource, embedded into a prompt or tool call result.", }), ], { mode: "oneOf" }, ).annotate({ description: "Content blocks represent displayable information in the Agent Client Protocol.\n\nThey provide a structured way to handle various types of user-facing content—whether\nit's text from language models, images for analysis, or embedded resources for context.\n\nContent blocks appear in:\n- User prompts sent via `session/prompt`\n- Language model output streamed through `session/update` notifications\n- Progress updates and results from tool calls\n\nThis structure is compatible with the Model Context Protocol (MCP), enabling\nagents to seamlessly forward content from MCP tool outputs without transformation.\n\nSee protocol docs: [Content](https://agentclientprotocol.com/protocol/content)", }), messageId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA unique identifier for the message this chunk belongs to.\n\nAll chunks belonging to the same message share the same `messageId`.\nA change in `messageId` indicates a new message has started.\nBoth clients and agents MUST use UUID format for message IDs.", }), Schema.Null, ]), ), }).annotate({ description: "A streamed item of content" }), Schema.Struct({ sessionUpdate: Schema.Literal("agent_message_chunk"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), content: Schema.Union( [ Schema.Struct({ type: Schema.Literal("text"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), text: Schema.String, }).annotate({ description: "Text provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("image"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), data: Schema.String, mimeType: Schema.String, uri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), }).annotate({ description: "An image provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("audio"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), data: Schema.String, mimeType: Schema.String, }).annotate({ description: "Audio provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("resource_link"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), mimeType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), name: Schema.String, size: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null, ]), ), title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), uri: Schema.String, }).annotate({ description: "A resource that the server is capable of reading, included in a prompt or tool call result.", }), Schema.Struct({ type: Schema.Literal("resource"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), resource: EmbeddedResourceResource, }).annotate({ description: "The contents of a resource, embedded into a prompt or tool call result.", }), ], { mode: "oneOf" }, ).annotate({ description: "Content blocks represent displayable information in the Agent Client Protocol.\n\nThey provide a structured way to handle various types of user-facing content—whether\nit's text from language models, images for analysis, or embedded resources for context.\n\nContent blocks appear in:\n- User prompts sent via `session/prompt`\n- Language model output streamed through `session/update` notifications\n- Progress updates and results from tool calls\n\nThis structure is compatible with the Model Context Protocol (MCP), enabling\nagents to seamlessly forward content from MCP tool outputs without transformation.\n\nSee protocol docs: [Content](https://agentclientprotocol.com/protocol/content)", }), messageId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA unique identifier for the message this chunk belongs to.\n\nAll chunks belonging to the same message share the same `messageId`.\nA change in `messageId` indicates a new message has started.\nBoth clients and agents MUST use UUID format for message IDs.", }), Schema.Null, ]), ), }).annotate({ description: "A streamed item of content" }), Schema.Struct({ sessionUpdate: Schema.Literal("agent_thought_chunk"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), content: Schema.Union( [ Schema.Struct({ type: Schema.Literal("text"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), text: Schema.String, }).annotate({ description: "Text provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("image"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), data: Schema.String, mimeType: Schema.String, uri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), }).annotate({ description: "An image provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("audio"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), data: Schema.String, mimeType: Schema.String, }).annotate({ description: "Audio provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("resource_link"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), mimeType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), name: Schema.String, size: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null, ]), ), title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), uri: Schema.String, }).annotate({ description: "A resource that the server is capable of reading, included in a prompt or tool call result.", }), Schema.Struct({ type: Schema.Literal("resource"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), resource: EmbeddedResourceResource, }).annotate({ description: "The contents of a resource, embedded into a prompt or tool call result.", }), ], { mode: "oneOf" }, ).annotate({ description: "Content blocks represent displayable information in the Agent Client Protocol.\n\nThey provide a structured way to handle various types of user-facing content—whether\nit's text from language models, images for analysis, or embedded resources for context.\n\nContent blocks appear in:\n- User prompts sent via `session/prompt`\n- Language model output streamed through `session/update` notifications\n- Progress updates and results from tool calls\n\nThis structure is compatible with the Model Context Protocol (MCP), enabling\nagents to seamlessly forward content from MCP tool outputs without transformation.\n\nSee protocol docs: [Content](https://agentclientprotocol.com/protocol/content)", }), messageId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA unique identifier for the message this chunk belongs to.\n\nAll chunks belonging to the same message share the same `messageId`.\nA change in `messageId` indicates a new message has started.\nBoth clients and agents MUST use UUID format for message IDs.", }), Schema.Null, ]), ), }).annotate({ description: "A streamed item of content" }), Schema.Struct({ sessionUpdate: Schema.Literal("tool_call"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), content: Schema.optionalKey( Schema.Array(ToolCallContent).annotate({ description: "Content produced by the tool call.", }), ), kind: Schema.optionalKey( Schema.Literals([ "read", "edit", "delete", "move", "search", "execute", "think", "fetch", "switch_mode", "other", ]).annotate({ description: "Categories of tools that can be invoked.\n\nTool kinds help clients choose appropriate icons and optimize how they\ndisplay tool execution progress.\n\nSee protocol docs: [Creating](https://agentclientprotocol.com/protocol/tool-calls#creating)", }), ), locations: Schema.optionalKey( Schema.Array(ToolCallLocation).annotate({ description: 'File locations affected by this tool call.\nEnables "follow-along" features in clients.', }), ), rawInput: Schema.optionalKey( Schema.Unknown.annotate({ description: "Raw input parameters sent to the tool." }), ), rawOutput: Schema.optionalKey( Schema.Unknown.annotate({ description: "Raw output returned by the tool." }), ), status: Schema.optionalKey( Schema.Literals(["pending", "in_progress", "completed", "failed"]).annotate({ description: "Execution status of a tool call.\n\nTool calls progress through different statuses during their lifecycle.\n\nSee protocol docs: [Status](https://agentclientprotocol.com/protocol/tool-calls#status)", }), ), title: Schema.String.annotate({ description: "Human-readable title describing what the tool is doing.", }), toolCallId: Schema.String.annotate({ description: "Unique identifier for a tool call within a session.", }), }).annotate({ description: "Represents a tool call that the language model has requested.\n\nTool calls are actions that the agent executes on behalf of the language model,\nsuch as reading files, executing code, or fetching data from external sources.\n\nSee protocol docs: [Tool Calls](https://agentclientprotocol.com/protocol/tool-calls)", }), Schema.Struct({ sessionUpdate: Schema.Literal("tool_call_update"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), content: Schema.optionalKey( Schema.Union([ Schema.Array(ToolCallContent).annotate({ description: "Replace the content collection.", }), Schema.Null, ]), ), kind: Schema.optionalKey( Schema.Union([ToolKind, Schema.Null]).annotate({ description: "Update the tool kind." }), ), locations: Schema.optionalKey( Schema.Union([ Schema.Array(ToolCallLocation).annotate({ description: "Replace the locations collection.", }), Schema.Null, ]), ), rawInput: Schema.optionalKey( Schema.Unknown.annotate({ description: "Update the raw input." }), ), rawOutput: Schema.optionalKey( Schema.Unknown.annotate({ description: "Update the raw output." }), ), status: Schema.optionalKey( Schema.Union([ToolCallStatus, Schema.Null]).annotate({ description: "Update the execution status.", }), ), title: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Update the human-readable title." }), Schema.Null, ]), ), toolCallId: Schema.String.annotate({ description: "Unique identifier for a tool call within a session.", }), }).annotate({ description: "An update to an existing tool call.\n\nUsed to report progress and results as tools execute. All fields except\nthe tool call ID are optional - only changed fields need to be included.\n\nSee protocol docs: [Updating](https://agentclientprotocol.com/protocol/tool-calls#updating)", }), Schema.Struct({ sessionUpdate: Schema.Literal("plan"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), entries: Schema.Array(PlanEntry).annotate({ description: "The list of tasks to be accomplished.\n\nWhen updating a plan, the agent must send a complete list of all entries\nwith their current status. The client replaces the entire plan with each update.", }), }).annotate({ description: "An execution plan for accomplishing complex tasks.\n\nPlans consist of multiple entries representing individual tasks or goals.\nAgents report plans to clients to provide visibility into their execution strategy.\nPlans can evolve during execution as the agent discovers new requirements or completes tasks.\n\nSee protocol docs: [Agent Plan](https://agentclientprotocol.com/protocol/agent-plan)", }), Schema.Struct({ sessionUpdate: Schema.Literal("available_commands_update"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), availableCommands: Schema.Array(AvailableCommand).annotate({ description: "Commands the agent can execute", }), }).annotate({ description: "Available commands are ready or have changed" }), Schema.Struct({ sessionUpdate: Schema.Literal("current_mode_update"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), currentModeId: Schema.String.annotate({ description: "Unique identifier for a Session Mode.", }), }).annotate({ description: "The current mode of the session has changed\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)", }), Schema.Struct({ sessionUpdate: Schema.Literal("config_option_update"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), configOptions: Schema.Array(SessionConfigOption).annotate({ description: "The full set of configuration options and their current values.", }), }).annotate({ description: "Session configuration options have been updated." }), Schema.Struct({ sessionUpdate: Schema.Literal("session_info_update"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), title: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Human-readable title for the session. Set to null to clear.", }), Schema.Null, ]), ), updatedAt: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "ISO 8601 timestamp of last activity. Set to null to clear.", }), Schema.Null, ]), ), }).annotate({ description: "Update to session metadata. All fields are optional to support partial updates.\n\nAgents send this notification to update session information like title or custom metadata.\nThis allows clients to display dynamic session names and track session state changes.", }), Schema.Struct({ sessionUpdate: Schema.Literal("usage_update"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), cost: Schema.optionalKey( Schema.Union([Cost, Schema.Null]).annotate({ description: "Cumulative session cost (optional).", }), ), size: Schema.Number.annotate({ description: "Total context window size in tokens.", format: "uint64", }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)), used: Schema.Number.annotate({ description: "Tokens currently in context.", format: "uint64", }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nContext window and cost update for a session.", }), ], { mode: "oneOf" }, ).annotate({ description: "Different types of updates that can be sent during session processing.\n\nThese updates provide real-time feedback about the agent's progress.\n\nSee protocol docs: [Agent Reports Output](https://agentclientprotocol.com/protocol/prompt-turn#3-agent-reports-output)", }), }).annotate({ description: "Notification containing a session update from the agent.\n\nUsed to stream real-time progress and results during prompt processing.\n\nSee protocol docs: [Agent Reports Output](https://agentclientprotocol.com/protocol/prompt-turn#3-agent-reports-output)", }); export type SessionUpdate = | { readonly sessionUpdate: "user_message_chunk"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly content: | { readonly type: "text"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly text: string; } | { readonly type: "image"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly data: string; readonly mimeType: string; readonly uri?: string | null; } | { readonly type: "audio"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly data: string; readonly mimeType: string; } | { readonly type: "resource_link"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly description?: string | null; readonly mimeType?: string | null; readonly name: string; readonly size?: number | null; readonly title?: string | null; readonly uri: string; } | { readonly type: "resource"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly resource: EmbeddedResourceResource; }; readonly messageId?: string | null; } | { readonly sessionUpdate: "agent_message_chunk"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly content: | { readonly type: "text"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly text: string; } | { readonly type: "image"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly data: string; readonly mimeType: string; readonly uri?: string | null; } | { readonly type: "audio"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly data: string; readonly mimeType: string; } | { readonly type: "resource_link"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly description?: string | null; readonly mimeType?: string | null; readonly name: string; readonly size?: number | null; readonly title?: string | null; readonly uri: string; } | { readonly type: "resource"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly resource: EmbeddedResourceResource; }; readonly messageId?: string | null; } | { readonly sessionUpdate: "agent_thought_chunk"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly content: | { readonly type: "text"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly text: string; } | { readonly type: "image"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly data: string; readonly mimeType: string; readonly uri?: string | null; } | { readonly type: "audio"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly data: string; readonly mimeType: string; } | { readonly type: "resource_link"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly description?: string | null; readonly mimeType?: string | null; readonly name: string; readonly size?: number | null; readonly title?: string | null; readonly uri: string; } | { readonly type: "resource"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly resource: EmbeddedResourceResource; }; readonly messageId?: string | null; } | { readonly sessionUpdate: "tool_call"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly content?: ReadonlyArray; readonly kind?: | "read" | "edit" | "delete" | "move" | "search" | "execute" | "think" | "fetch" | "switch_mode" | "other"; readonly locations?: ReadonlyArray; readonly rawInput?: unknown; readonly rawOutput?: unknown; readonly status?: "pending" | "in_progress" | "completed" | "failed"; readonly title: string; readonly toolCallId: string; } | { readonly sessionUpdate: "tool_call_update"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly content?: ReadonlyArray | null; readonly kind?: ToolKind | null; readonly locations?: ReadonlyArray | null; readonly rawInput?: unknown; readonly rawOutput?: unknown; readonly status?: ToolCallStatus | null; readonly title?: string | null; readonly toolCallId: string; } | { readonly sessionUpdate: "plan"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly entries: ReadonlyArray; } | { readonly sessionUpdate: "available_commands_update"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly availableCommands: ReadonlyArray; } | { readonly sessionUpdate: "current_mode_update"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly currentModeId: string; } | { readonly sessionUpdate: "config_option_update"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly configOptions: ReadonlyArray; } | { readonly sessionUpdate: "session_info_update"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly title?: string | null; readonly updatedAt?: string | null; } | { readonly sessionUpdate: "usage_update"; readonly _meta?: { readonly [x: string]: unknown } | null; readonly cost?: Cost | null; readonly size: number; readonly used: number; }; export const SessionUpdate = Schema.Union( [ Schema.Struct({ sessionUpdate: Schema.Literal("user_message_chunk"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), content: Schema.Union( [ Schema.Struct({ type: Schema.Literal("text"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), text: Schema.String, }).annotate({ description: "Text provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("image"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), data: Schema.String, mimeType: Schema.String, uri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), }).annotate({ description: "An image provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("audio"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), data: Schema.String, mimeType: Schema.String, }).annotate({ description: "Audio provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("resource_link"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), mimeType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), name: Schema.String, size: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null, ]), ), title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), uri: Schema.String, }).annotate({ description: "A resource that the server is capable of reading, included in a prompt or tool call result.", }), Schema.Struct({ type: Schema.Literal("resource"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), resource: EmbeddedResourceResource, }).annotate({ description: "The contents of a resource, embedded into a prompt or tool call result.", }), ], { mode: "oneOf" }, ).annotate({ description: "Content blocks represent displayable information in the Agent Client Protocol.\n\nThey provide a structured way to handle various types of user-facing content—whether\nit's text from language models, images for analysis, or embedded resources for context.\n\nContent blocks appear in:\n- User prompts sent via `session/prompt`\n- Language model output streamed through `session/update` notifications\n- Progress updates and results from tool calls\n\nThis structure is compatible with the Model Context Protocol (MCP), enabling\nagents to seamlessly forward content from MCP tool outputs without transformation.\n\nSee protocol docs: [Content](https://agentclientprotocol.com/protocol/content)", }), messageId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA unique identifier for the message this chunk belongs to.\n\nAll chunks belonging to the same message share the same `messageId`.\nA change in `messageId` indicates a new message has started.\nBoth clients and agents MUST use UUID format for message IDs.", }), Schema.Null, ]), ), }).annotate({ description: "A streamed item of content" }), Schema.Struct({ sessionUpdate: Schema.Literal("agent_message_chunk"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), content: Schema.Union( [ Schema.Struct({ type: Schema.Literal("text"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), text: Schema.String, }).annotate({ description: "Text provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("image"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), data: Schema.String, mimeType: Schema.String, uri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), }).annotate({ description: "An image provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("audio"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), data: Schema.String, mimeType: Schema.String, }).annotate({ description: "Audio provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("resource_link"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), mimeType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), name: Schema.String, size: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null, ]), ), title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), uri: Schema.String, }).annotate({ description: "A resource that the server is capable of reading, included in a prompt or tool call result.", }), Schema.Struct({ type: Schema.Literal("resource"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), resource: EmbeddedResourceResource, }).annotate({ description: "The contents of a resource, embedded into a prompt or tool call result.", }), ], { mode: "oneOf" }, ).annotate({ description: "Content blocks represent displayable information in the Agent Client Protocol.\n\nThey provide a structured way to handle various types of user-facing content—whether\nit's text from language models, images for analysis, or embedded resources for context.\n\nContent blocks appear in:\n- User prompts sent via `session/prompt`\n- Language model output streamed through `session/update` notifications\n- Progress updates and results from tool calls\n\nThis structure is compatible with the Model Context Protocol (MCP), enabling\nagents to seamlessly forward content from MCP tool outputs without transformation.\n\nSee protocol docs: [Content](https://agentclientprotocol.com/protocol/content)", }), messageId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA unique identifier for the message this chunk belongs to.\n\nAll chunks belonging to the same message share the same `messageId`.\nA change in `messageId` indicates a new message has started.\nBoth clients and agents MUST use UUID format for message IDs.", }), Schema.Null, ]), ), }).annotate({ description: "A streamed item of content" }), Schema.Struct({ sessionUpdate: Schema.Literal("agent_thought_chunk"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), content: Schema.Union( [ Schema.Struct({ type: Schema.Literal("text"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), text: Schema.String, }).annotate({ description: "Text provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("image"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), data: Schema.String, mimeType: Schema.String, uri: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), }).annotate({ description: "An image provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("audio"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), data: Schema.String, mimeType: Schema.String, }).annotate({ description: "Audio provided to or from an LLM." }), Schema.Struct({ type: Schema.Literal("resource_link"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), mimeType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), name: Schema.String, size: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ format: "int64" }).check(Schema.isInt()), Schema.Null, ]), ), title: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), uri: Schema.String, }).annotate({ description: "A resource that the server is capable of reading, included in a prompt or tool call result.", }), Schema.Struct({ type: Schema.Literal("resource"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), resource: EmbeddedResourceResource, }).annotate({ description: "The contents of a resource, embedded into a prompt or tool call result.", }), ], { mode: "oneOf" }, ).annotate({ description: "Content blocks represent displayable information in the Agent Client Protocol.\n\nThey provide a structured way to handle various types of user-facing content—whether\nit's text from language models, images for analysis, or embedded resources for context.\n\nContent blocks appear in:\n- User prompts sent via `session/prompt`\n- Language model output streamed through `session/update` notifications\n- Progress updates and results from tool calls\n\nThis structure is compatible with the Model Context Protocol (MCP), enabling\nagents to seamlessly forward content from MCP tool outputs without transformation.\n\nSee protocol docs: [Content](https://agentclientprotocol.com/protocol/content)", }), messageId: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA unique identifier for the message this chunk belongs to.\n\nAll chunks belonging to the same message share the same `messageId`.\nA change in `messageId` indicates a new message has started.\nBoth clients and agents MUST use UUID format for message IDs.", }), Schema.Null, ]), ), }).annotate({ description: "A streamed item of content" }), Schema.Struct({ sessionUpdate: Schema.Literal("tool_call"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), content: Schema.optionalKey( Schema.Array(ToolCallContent).annotate({ description: "Content produced by the tool call.", }), ), kind: Schema.optionalKey( Schema.Literals([ "read", "edit", "delete", "move", "search", "execute", "think", "fetch", "switch_mode", "other", ]).annotate({ description: "Categories of tools that can be invoked.\n\nTool kinds help clients choose appropriate icons and optimize how they\ndisplay tool execution progress.\n\nSee protocol docs: [Creating](https://agentclientprotocol.com/protocol/tool-calls#creating)", }), ), locations: Schema.optionalKey( Schema.Array(ToolCallLocation).annotate({ description: 'File locations affected by this tool call.\nEnables "follow-along" features in clients.', }), ), rawInput: Schema.optionalKey( Schema.Unknown.annotate({ description: "Raw input parameters sent to the tool." }), ), rawOutput: Schema.optionalKey( Schema.Unknown.annotate({ description: "Raw output returned by the tool." }), ), status: Schema.optionalKey( Schema.Literals(["pending", "in_progress", "completed", "failed"]).annotate({ description: "Execution status of a tool call.\n\nTool calls progress through different statuses during their lifecycle.\n\nSee protocol docs: [Status](https://agentclientprotocol.com/protocol/tool-calls#status)", }), ), title: Schema.String.annotate({ description: "Human-readable title describing what the tool is doing.", }), toolCallId: Schema.String.annotate({ description: "Unique identifier for a tool call within a session.", }), }).annotate({ description: "Represents a tool call that the language model has requested.\n\nTool calls are actions that the agent executes on behalf of the language model,\nsuch as reading files, executing code, or fetching data from external sources.\n\nSee protocol docs: [Tool Calls](https://agentclientprotocol.com/protocol/tool-calls)", }), Schema.Struct({ sessionUpdate: Schema.Literal("tool_call_update"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), content: Schema.optionalKey( Schema.Union([ Schema.Array(ToolCallContent).annotate({ description: "Replace the content collection.", }), Schema.Null, ]), ), kind: Schema.optionalKey( Schema.Union([ToolKind, Schema.Null]).annotate({ description: "Update the tool kind." }), ), locations: Schema.optionalKey( Schema.Union([ Schema.Array(ToolCallLocation).annotate({ description: "Replace the locations collection.", }), Schema.Null, ]), ), rawInput: Schema.optionalKey( Schema.Unknown.annotate({ description: "Update the raw input." }), ), rawOutput: Schema.optionalKey( Schema.Unknown.annotate({ description: "Update the raw output." }), ), status: Schema.optionalKey( Schema.Union([ToolCallStatus, Schema.Null]).annotate({ description: "Update the execution status.", }), ), title: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Update the human-readable title." }), Schema.Null, ]), ), toolCallId: Schema.String.annotate({ description: "Unique identifier for a tool call within a session.", }), }).annotate({ description: "An update to an existing tool call.\n\nUsed to report progress and results as tools execute. All fields except\nthe tool call ID are optional - only changed fields need to be included.\n\nSee protocol docs: [Updating](https://agentclientprotocol.com/protocol/tool-calls#updating)", }), Schema.Struct({ sessionUpdate: Schema.Literal("plan"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), entries: Schema.Array(PlanEntry).annotate({ description: "The list of tasks to be accomplished.\n\nWhen updating a plan, the agent must send a complete list of all entries\nwith their current status. The client replaces the entire plan with each update.", }), }).annotate({ description: "An execution plan for accomplishing complex tasks.\n\nPlans consist of multiple entries representing individual tasks or goals.\nAgents report plans to clients to provide visibility into their execution strategy.\nPlans can evolve during execution as the agent discovers new requirements or completes tasks.\n\nSee protocol docs: [Agent Plan](https://agentclientprotocol.com/protocol/agent-plan)", }), Schema.Struct({ sessionUpdate: Schema.Literal("available_commands_update"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), availableCommands: Schema.Array(AvailableCommand).annotate({ description: "Commands the agent can execute", }), }).annotate({ description: "Available commands are ready or have changed" }), Schema.Struct({ sessionUpdate: Schema.Literal("current_mode_update"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), currentModeId: Schema.String.annotate({ description: "Unique identifier for a Session Mode.", }), }).annotate({ description: "The current mode of the session has changed\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)", }), Schema.Struct({ sessionUpdate: Schema.Literal("config_option_update"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), configOptions: Schema.Array(SessionConfigOption).annotate({ description: "The full set of configuration options and their current values.", }), }).annotate({ description: "Session configuration options have been updated." }), Schema.Struct({ sessionUpdate: Schema.Literal("session_info_update"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), title: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Human-readable title for the session. Set to null to clear.", }), Schema.Null, ]), ), updatedAt: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "ISO 8601 timestamp of last activity. Set to null to clear.", }), Schema.Null, ]), ), }).annotate({ description: "Update to session metadata. All fields are optional to support partial updates.\n\nAgents send this notification to update session information like title or custom metadata.\nThis allows clients to display dynamic session names and track session state changes.", }), Schema.Struct({ sessionUpdate: Schema.Literal("usage_update"), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), cost: Schema.optionalKey( Schema.Union([Cost, Schema.Null]).annotate({ description: "Cumulative session cost (optional).", }), ), size: Schema.Number.annotate({ description: "Total context window size in tokens.", format: "uint64", }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)), used: Schema.Number.annotate({ description: "Tokens currently in context.", format: "uint64", }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nContext window and cost update for a session.", }), ], { mode: "oneOf" }, ).annotate({ description: "Different types of updates that can be sent during session processing.\n\nThese updates provide real-time feedback about the agent's progress.\n\nSee protocol docs: [Agent Reports Output](https://agentclientprotocol.com/protocol/prompt-turn#3-agent-reports-output)", }); export type SetSessionConfigOptionRequest = | { readonly type: "boolean"; readonly value: boolean; readonly _meta?: { readonly [x: string]: unknown } | null; readonly configId: string; readonly sessionId: string; } | { readonly value: string; readonly _meta?: { readonly [x: string]: unknown } | null; readonly configId: string; readonly sessionId: string; }; export const SetSessionConfigOptionRequest = Schema.Union([ Schema.Struct({ type: Schema.Literal("boolean"), value: Schema.Boolean.annotate({ description: "The boolean value." }), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), configId: Schema.String.annotate({ description: "Unique identifier for a session configuration option.", }), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), }).annotate({ description: "Request parameters for setting a session configuration option." }), Schema.Struct({ value: Schema.String.annotate({ description: "Unique identifier for a session configuration option value.", }), _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), configId: Schema.String.annotate({ description: "Unique identifier for a session configuration option.", }), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), }).annotate({ title: "value_id", description: "Request parameters for setting a session configuration option.", }), ]); export type SetSessionConfigOptionResponse = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly configOptions: ReadonlyArray; }; export const SetSessionConfigOptionResponse = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), configOptions: Schema.Array(SessionConfigOption).annotate({ description: "The full set of configuration options and their current values.", }), }).annotate({ description: "Response to `session/set_config_option` method." }); export type SetSessionModelRequest = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly modelId: string; readonly sessionId: string; }; export const SetSessionModelRequest = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), modelId: Schema.String.annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA unique identifier for a model.", }), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nRequest parameters for setting a session model.", }); export type SetSessionModelResponse = { readonly _meta?: { readonly [x: string]: unknown } | null }; export const SetSessionModelResponse = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nResponse to `session/set_model` method.", }); export type SetSessionModeRequest = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly modeId: string; readonly sessionId: string; }; export const SetSessionModeRequest = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), modeId: Schema.String.annotate({ description: "Unique identifier for a Session Mode." }), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), }).annotate({ description: "Request parameters for setting a session mode." }); export type SetSessionModeResponse = { readonly _meta?: { readonly [x: string]: unknown } | null }; export const SetSessionModeResponse = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), }).annotate({ description: "Response to `session/set_mode` method." }); export type StopReason = "end_turn" | "max_tokens" | "max_turn_requests" | "refusal" | "cancelled"; export const StopReason = Schema.Literals([ "end_turn", "max_tokens", "max_turn_requests", "refusal", "cancelled", ]).annotate({ description: "Reasons why an agent stops processing a prompt turn.\n\nSee protocol docs: [Stop Reasons](https://agentclientprotocol.com/protocol/prompt-turn#stop-reasons)", }); export type StringPropertySchema = { readonly default?: string | null; readonly description?: string | null; readonly enum?: ReadonlyArray | null; readonly format?: StringFormat | null; readonly maxLength?: number | null; readonly minLength?: number | null; readonly oneOf?: ReadonlyArray | null; readonly pattern?: string | null; readonly title?: string | null; }; export const StringPropertySchema = Schema.Struct({ default: Schema.optionalKey( Schema.Union([Schema.String.annotate({ description: "Default value." }), Schema.Null]), ), description: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Human-readable description." }), Schema.Null, ]), ), enum: Schema.optionalKey( Schema.Union([ Schema.Array(Schema.String).annotate({ description: "Enum values for untitled single-select enums.", }), Schema.Null, ]), ), format: Schema.optionalKey( Schema.Union([StringFormat, Schema.Null]).annotate({ description: "String format." }), ), maxLength: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "Maximum string length.", format: "uint32" }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)), Schema.Null, ]), ), minLength: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "Minimum string length.", format: "uint32" }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)), Schema.Null, ]), ), oneOf: Schema.optionalKey( Schema.Union([ Schema.Array(EnumOption).annotate({ description: "Titled enum options for titled single-select enums.", }), Schema.Null, ]), ), pattern: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Pattern the string must match." }), Schema.Null, ]), ), title: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Optional title for the property." }), Schema.Null, ]), ), }).annotate({ description: 'Schema for string properties in an elicitation form.\n\nWhen `enum` or `oneOf` is set, this represents a single-select enum\nwith `"type": "string"`.', }); export type Terminal = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly terminalId: string; }; export const Terminal = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), terminalId: Schema.String, }).annotate({ description: "Embed a terminal created with `terminal/create` by its id.\n\nThe terminal must be added before calling `terminal/release`.\n\nSee protocol docs: [Terminal](https://agentclientprotocol.com/protocol/terminals)", }); export type TerminalOutputRequest = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly sessionId: string; readonly terminalId: string; }; export const TerminalOutputRequest = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), terminalId: Schema.String.annotate({ description: "The ID of the terminal to get output from." }), }).annotate({ description: "Request to get the current output and status of a terminal." }); export type TerminalOutputResponse = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly exitStatus?: TerminalExitStatus | null; readonly output: string; readonly truncated: boolean; }; export const TerminalOutputResponse = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), exitStatus: Schema.optionalKey( Schema.Union([TerminalExitStatus, Schema.Null]).annotate({ description: "Exit status if the command has completed.", }), ), output: Schema.String.annotate({ description: "The terminal output captured so far." }), truncated: Schema.Boolean.annotate({ description: "Whether the output was truncated due to byte limits.", }), }).annotate({ description: "Response containing the terminal output and exit status." }); export type TextContent = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly annotations?: Annotations | null; readonly text: string; }; export const TextContent = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), annotations: Schema.optionalKey(Schema.Union([Annotations, Schema.Null])), text: Schema.String, }).annotate({ description: "Text provided to or from an LLM." }); export type TextResourceContents = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly mimeType?: string | null; readonly text: string; readonly uri: string; }; export const TextResourceContents = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), mimeType: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), text: Schema.String, uri: Schema.String, }).annotate({ description: "Text-based resource contents." }); export type TitledMultiSelectItems = { readonly anyOf: ReadonlyArray }; export const TitledMultiSelectItems = Schema.Struct({ anyOf: Schema.Array(EnumOption).annotate({ description: "Titled enum options." }), }).annotate({ description: "Items definition for titled multi-select enum properties." }); export type ToolCall = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly content?: ReadonlyArray; readonly kind?: | "read" | "edit" | "delete" | "move" | "search" | "execute" | "think" | "fetch" | "switch_mode" | "other"; readonly locations?: ReadonlyArray; readonly rawInput?: unknown; readonly rawOutput?: unknown; readonly status?: "pending" | "in_progress" | "completed" | "failed"; readonly title: string; readonly toolCallId: string; }; export const ToolCall = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), content: Schema.optionalKey( Schema.Array(ToolCallContent).annotate({ description: "Content produced by the tool call." }), ), kind: Schema.optionalKey( Schema.Literals([ "read", "edit", "delete", "move", "search", "execute", "think", "fetch", "switch_mode", "other", ]).annotate({ description: "Categories of tools that can be invoked.\n\nTool kinds help clients choose appropriate icons and optimize how they\ndisplay tool execution progress.\n\nSee protocol docs: [Creating](https://agentclientprotocol.com/protocol/tool-calls#creating)", }), ), locations: Schema.optionalKey( Schema.Array(ToolCallLocation).annotate({ description: 'File locations affected by this tool call.\nEnables "follow-along" features in clients.', }), ), rawInput: Schema.optionalKey( Schema.Unknown.annotate({ description: "Raw input parameters sent to the tool." }), ), rawOutput: Schema.optionalKey( Schema.Unknown.annotate({ description: "Raw output returned by the tool." }), ), status: Schema.optionalKey( Schema.Literals(["pending", "in_progress", "completed", "failed"]).annotate({ description: "Execution status of a tool call.\n\nTool calls progress through different statuses during their lifecycle.\n\nSee protocol docs: [Status](https://agentclientprotocol.com/protocol/tool-calls#status)", }), ), title: Schema.String.annotate({ description: "Human-readable title describing what the tool is doing.", }), toolCallId: Schema.String.annotate({ description: "Unique identifier for a tool call within a session.", }), }).annotate({ description: "Represents a tool call that the language model has requested.\n\nTool calls are actions that the agent executes on behalf of the language model,\nsuch as reading files, executing code, or fetching data from external sources.\n\nSee protocol docs: [Tool Calls](https://agentclientprotocol.com/protocol/tool-calls)", }); export type ToolCallId = string; export const ToolCallId = Schema.String.annotate({ description: "Unique identifier for a tool call within a session.", }); export type ToolCallUpdate = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly content?: ReadonlyArray | null; readonly kind?: ToolKind | null; readonly locations?: ReadonlyArray | null; readonly rawInput?: unknown; readonly rawOutput?: unknown; readonly status?: ToolCallStatus | null; readonly title?: string | null; readonly toolCallId: string; }; export const ToolCallUpdate = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), content: Schema.optionalKey( Schema.Union([ Schema.Array(ToolCallContent).annotate({ description: "Replace the content collection." }), Schema.Null, ]), ), kind: Schema.optionalKey( Schema.Union([ToolKind, Schema.Null]).annotate({ description: "Update the tool kind." }), ), locations: Schema.optionalKey( Schema.Union([ Schema.Array(ToolCallLocation).annotate({ description: "Replace the locations collection." }), Schema.Null, ]), ), rawInput: Schema.optionalKey(Schema.Unknown.annotate({ description: "Update the raw input." })), rawOutput: Schema.optionalKey(Schema.Unknown.annotate({ description: "Update the raw output." })), status: Schema.optionalKey( Schema.Union([ToolCallStatus, Schema.Null]).annotate({ description: "Update the execution status.", }), ), title: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "Update the human-readable title." }), Schema.Null, ]), ), toolCallId: Schema.String.annotate({ description: "Unique identifier for a tool call within a session.", }), }).annotate({ description: "An update to an existing tool call.\n\nUsed to report progress and results as tools execute. All fields except\nthe tool call ID are optional - only changed fields need to be included.\n\nSee protocol docs: [Updating](https://agentclientprotocol.com/protocol/tool-calls#updating)", }); export type UnstructuredCommandInput = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly hint: string; }; export const UnstructuredCommandInput = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), hint: Schema.String.annotate({ description: "A hint to display when the input hasn't been provided yet", }), }).annotate({ description: "All text that was typed after the command name is provided as input.", }); export type UntitledMultiSelectItems = { readonly enum: ReadonlyArray; readonly type: "string"; }; export const UntitledMultiSelectItems = Schema.Struct({ enum: Schema.Array(Schema.String).annotate({ description: "Allowed enum values." }), type: Schema.Literal("string").annotate({ description: "Items definition for untitled multi-select enum properties.", }), }).annotate({ description: "Items definition for untitled multi-select enum properties." }); export type UsageUpdate = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly cost?: Cost | null; readonly size: number; readonly used: number; }; export const UsageUpdate = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), cost: Schema.optionalKey( Schema.Union([Cost, Schema.Null]).annotate({ description: "Cumulative session cost (optional).", }), ), size: Schema.Number.annotate({ description: "Total context window size in tokens.", format: "uint64", }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)), used: Schema.Number.annotate({ description: "Tokens currently in context.", format: "uint64" }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)), }).annotate({ description: "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nContext window and cost update for a session.", }); export type WaitForTerminalExitRequest = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly sessionId: string; readonly terminalId: string; }; export const WaitForTerminalExitRequest = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), terminalId: Schema.String.annotate({ description: "The ID of the terminal to wait for." }), }).annotate({ description: "Request to wait for a terminal command to exit." }); export type WaitForTerminalExitResponse = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly exitCode?: number | null; readonly signal?: string | null; }; export const WaitForTerminalExitResponse = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), exitCode: Schema.optionalKey( Schema.Union([ Schema.Number.annotate({ description: "The process exit code (may be null if terminated by signal).", format: "uint32", }) .check(Schema.isInt()) .check(Schema.isGreaterThanOrEqualTo(0)), Schema.Null, ]), ), signal: Schema.optionalKey( Schema.Union([ Schema.String.annotate({ description: "The signal that terminated the process (may be null if exited normally).", }), Schema.Null, ]), ), }).annotate({ description: "Response containing the exit status of a terminal command." }); export type WriteTextFileRequest = { readonly _meta?: { readonly [x: string]: unknown } | null; readonly content: string; readonly path: string; readonly sessionId: string; }; export const WriteTextFileRequest = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), content: Schema.String.annotate({ description: "The text content to write to the file." }), path: Schema.String.annotate({ description: "Absolute path to the file to write." }), sessionId: Schema.String.annotate({ description: "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)", }), }).annotate({ description: "Request to write content to a text file.\n\nOnly available if the client supports the `fs.writeTextFile` capability.", }); export type WriteTextFileResponse = { readonly _meta?: { readonly [x: string]: unknown } | null }; export const WriteTextFileResponse = Schema.Struct({ _meta: Schema.optionalKey( Schema.Union([ Schema.Record(Schema.String, Schema.Unknown).annotate({ description: "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", }), Schema.Null, ]), ), }).annotate({ description: "Response to `fs/write_text_file`" });