Skip to main content

Overview

Response types represent messages sent from agents to clients in reply to requests. Each response corresponds to a specific request type.

Initialize

InitializeResponse

Response to an initialization request.
protocolVersion
int
required
The protocol version the agent will use
agentInfo
Implementation
Information about the agent implementation
agentCapabilities
AgentCapabilities
Capabilities advertised by the agent
authMethods
List<AuthMethod>
default:"[]"
Available authentication methods
_meta
Map<String, dynamic>
Optional metadata

Authentication

AuthenticateResponse

Response to an authentication request.
_meta
Map<String, dynamic>
Optional metadata

Session Management

NewSessionResponse

Response to a new session request.
sessionId
String
required
The unique identifier for the created session
modes
SessionModeState
Available modes and current mode for the session
models
SessionModelState
Available models and current model for the session
configOptions
List<SessionConfigOption>
Available configuration options for the session
_meta
Map<String, dynamic>
Optional metadata

LoadSessionResponse

Response to a load session request.
modes
SessionModeState
Available modes and current mode for the session
models
SessionModelState
Available models and current model for the session
configOptions
List<SessionConfigOption>
Available configuration options for the session
_meta
Map<String, dynamic>
Optional metadata

ListSessionsResponse

UNSTABLE: This capability is not part of the spec yet, and may be removed or changed at any point.
Response containing a list of sessions.
sessions
List<SessionInfo>
required
List of session information
nextCursor
String
Pagination cursor for fetching the next page
_meta
Map<String, dynamic>
Optional metadata

ForkSessionResponse

UNSTABLE: This capability is not part of the spec yet, and may be removed or changed at any point.
Response to a fork session request.
sessionId
SessionId
required
The unique identifier for the forked session
modes
SessionModeState
Available modes and current mode
models
SessionModelState
Available models and current model
configOptions
List<SessionConfigOption>
Available configuration options
_meta
Map<String, dynamic>
Optional metadata

ResumeSessionResponse

UNSTABLE: This capability is not part of the spec yet, and may be removed or changed at any point.
Response to a resume session request.
modes
SessionModeState
Available modes and current mode
models
SessionModelState
Available models and current model
configOptions
List<SessionConfigOption>
Available configuration options
_meta
Map<String, dynamic>
Optional metadata

SetSessionModeResponse

Response to a set session mode request.
_meta
Map<String, dynamic>
Optional metadata

SetSessionConfigOptionResponse

Response to a set session config option request.
configOptions
List<SessionConfigOption>
required
The updated configuration options
_meta
Map<String, dynamic>
Optional metadata

SetSessionModelResponse

UNSTABLE: This capability is not part of the spec yet, and may be removed or changed at any point.
Response to a set session model request.
_meta
Map<String, dynamic>
Optional metadata

Prompt

PromptResponse

Response to a prompt request. See Stop Reasons.
stopReason
StopReason
required
Indicates why the agent stopped processing the turn:
  • end_turn - The turn ended successfully
  • max_tokens - Reached the maximum number of tokens
  • max_turn_requests - Reached the maximum number of allowed agent requests
  • refusal - The agent refused to continue
  • cancelled - The turn was cancelled via session/cancel
usage
Usage
Token usage information for this prompt
_meta
Map<String, dynamic>
Optional metadata

File System

WriteTextFileResponse

Response to a write text file request.
_meta
Map<String, dynamic>
Optional metadata

ReadTextFileResponse

Response to a read text file request.
content
String
required
The text content read from the file
_meta
Map<String, dynamic>
Optional metadata

Permissions

RequestPermissionResponse

Response to a permission request.
outcome
RequestPermissionOutcome
required
The user’s decision, either CancelledOutcome or SelectedOutcome
_meta
Map<String, dynamic>
Optional metadata

Terminal

CreateTerminalResponse

Response to a create terminal request.
terminalId
String
required
The unique identifier for the created terminal
_meta
Map<String, dynamic>
Optional metadata

TerminalOutputResponse

Response containing terminal output.
output
String
required
The terminal output (stdout and stderr combined)
truncated
bool
required
Whether the output was truncated due to size limits
exitStatus
TerminalExitStatus
The exit status if the command has completed
_meta
Map<String, dynamic>
Optional metadata

ReleaseTerminalResponse

Response to a release terminal request.
_meta
Map<String, dynamic>
Optional metadata

WaitForTerminalExitResponse

Response containing terminal exit information.
exitCode
int
The exit code of the command
signal
String
The signal that terminated the command (if applicable)
_meta
Map<String, dynamic>
Optional metadata

KillTerminalCommandResponse

Response to a kill terminal command request.
_meta
Map<String, dynamic>
Optional metadata

Build docs developers (and LLMs) love