Documentation
¶
Overview ¶
Package acp implements Agent Client Protocol v1 over newline-delimited JSON-RPC 2.0.
Index ¶
- Constants
- Variables
- type AgentAuthCapabilities
- type AgentCaller
- func (a *AgentCaller) Authenticate(ctx context.Context, req *AuthenticateRequest) (*AuthenticateResponse, error)
- func (a *AgentCaller) Call(ctx context.Context, method string, params, result any) error
- func (a *AgentCaller) Cancel(ctx context.Context, notification *CancelNotification) error
- func (a *AgentCaller) CloseSession(ctx context.Context, req *CloseSessionRequest) (*CloseSessionResponse, error)
- func (a *AgentCaller) DeleteSession(ctx context.Context, req *DeleteSessionRequest) (*DeleteSessionResponse, error)
- func (a *AgentCaller) Initialize(ctx context.Context, req *InitializeRequest) (*InitializeResponse, error)
- func (a *AgentCaller) ListSessions(ctx context.Context, req *ListSessionsRequest) (*ListSessionsResponse, error)
- func (a *AgentCaller) LoadSession(ctx context.Context, req *LoadSessionRequest) (*LoadSessionResponse, error)
- func (a *AgentCaller) Logout(ctx context.Context, req *LogoutRequest) (*LogoutResponse, error)
- func (a *AgentCaller) NewSession(ctx context.Context, req *NewSessionRequest) (*NewSessionResponse, error)
- func (a *AgentCaller) Notify(ctx context.Context, method string, params any) error
- func (a *AgentCaller) Prompt(ctx context.Context, req *PromptRequest) (*PromptResponse, error)
- func (a *AgentCaller) ResumeSession(ctx context.Context, req *ResumeSessionRequest) (*ResumeSessionResponse, error)
- func (a *AgentCaller) SetSessionConfigOption(ctx context.Context, req *SetSessionConfigOptionRequest) (*SetSessionConfigOptionResponse, error)
- func (a *AgentCaller) SetSessionMode(ctx context.Context, req *SetSessionModeRequest) (*SetSessionModeResponse, error)
- type AgentCapabilities
- type AgentHandler
- type Annotations
- type AudioContent
- type AuthMethod
- type AuthMethodAgent
- type AuthMethodID
- type AuthenticateHandler
- type AuthenticateRequest
- type AuthenticateResponse
- type AvailableCommand
- type AvailableCommandInput
- type AvailableCommandsUpdate
- type BlobResourceContents
- type BooleanConfigOptionCapabilities
- type BooleanPropertySchema
- type CancelNotification
- type CancelRequestNotification
- type ClientCaller
- func (c *ClientCaller) Call(ctx context.Context, method string, params, result any) error
- func (c *ClientCaller) CompleteElicitation(ctx context.Context, notification *CompleteElicitationNotification) error
- func (c *ClientCaller) CreateElicitation(ctx context.Context, req *CreateElicitationRequest) (*CreateElicitationResponse, error)
- func (c *ClientCaller) CreateTerminal(ctx context.Context, req *CreateTerminalRequest) (*CreateTerminalResponse, error)
- func (c *ClientCaller) KillTerminal(ctx context.Context, req *KillTerminalRequest) (*KillTerminalResponse, error)
- func (c *ClientCaller) Notify(ctx context.Context, method string, params any) error
- func (c *ClientCaller) ReadTextFile(ctx context.Context, req *ReadTextFileRequest) (*ReadTextFileResponse, error)
- func (c *ClientCaller) ReleaseTerminal(ctx context.Context, req *ReleaseTerminalRequest) (*ReleaseTerminalResponse, error)
- func (c *ClientCaller) RequestPermission(ctx context.Context, req *RequestPermissionRequest) (*RequestPermissionResponse, error)
- func (c *ClientCaller) TerminalOutput(ctx context.Context, req *TerminalOutputRequest) (*TerminalOutputResponse, error)
- func (c *ClientCaller) Update(ctx context.Context, notification *SessionNotification) error
- func (c *ClientCaller) WaitForTerminalExit(ctx context.Context, req *WaitForTerminalExitRequest) (*WaitForTerminalExitResponse, error)
- func (c *ClientCaller) WriteTextFile(ctx context.Context, req *WriteTextFileRequest) (*WriteTextFileResponse, error)
- type ClientCapabilities
- type ClientHandler
- type ClientSessionCapabilities
- type CloseSessionHandler
- type CloseSessionRequest
- type CloseSessionResponse
- type CompleteElicitationHandler
- type CompleteElicitationNotification
- type ConfigOptionUpdate
- type Conn
- type Content
- type ContentBlock
- func AudioContentBlock(data string, mimeType string) ContentBlock
- func ImageContentBlock(data string, mimeType string) ContentBlock
- func ResourceContentBlock(resource EmbeddedResourceContents) ContentBlock
- func ResourceLinkContentBlock(name string, uri string) ContentBlock
- func TextContentBlock(text string) ContentBlock
- type ContentBlockType
- type ContentChunk
- type Cost
- type CreateElicitationHandler
- type CreateElicitationRequest
- func RequestFormCreateElicitationRequest(message string, requestedSchema ElicitationSchema, requestID RequestID) CreateElicitationRequest
- func RequestOtherCreateElicitationRequest(message string, mode string, requestID RequestID, ...) CreateElicitationRequest
- func RequestURLCreateElicitationRequest(message string, elicitationID ElicitationID, url string, requestID RequestID) CreateElicitationRequest
- func SessionFormCreateElicitationRequest(message string, requestedSchema ElicitationSchema, sessionID SessionID) CreateElicitationRequest
- func SessionOtherCreateElicitationRequest(message string, mode string, sessionID SessionID, ...) CreateElicitationRequest
- func SessionURLCreateElicitationRequest(message string, elicitationID ElicitationID, url string, sessionID SessionID) CreateElicitationRequest
- type CreateElicitationRequestType
- type CreateElicitationResponse
- func AcceptCreateElicitationResponse() CreateElicitationResponse
- func CancelCreateElicitationResponse() CreateElicitationResponse
- func DeclineCreateElicitationResponse() CreateElicitationResponse
- func OtherCreateElicitationResponse(action string, fields map[string]json.RawMessage) CreateElicitationResponse
- type CreateElicitationResponseType
- type CreateTerminalRequest
- type CreateTerminalResponse
- type CurrentModeUpdate
- type DeleteSessionHandler
- type DeleteSessionRequest
- type DeleteSessionResponse
- type Diff
- type ElicitationAcceptAction
- type ElicitationCapabilities
- type ElicitationContentValue
- type ElicitationFormCapabilities
- type ElicitationFormMode
- type ElicitationID
- type ElicitationPropertySchema
- func ArrayElicitationPropertySchema(items MultiSelectItems) ElicitationPropertySchema
- func BooleanElicitationPropertySchema() ElicitationPropertySchema
- func IntegerElicitationPropertySchema() ElicitationPropertySchema
- func NumberElicitationPropertySchema() ElicitationPropertySchema
- func OtherElicitationPropertySchema(typeName string, fields map[string]json.RawMessage) ElicitationPropertySchema
- func StringElicitationPropertySchema() ElicitationPropertySchema
- type ElicitationPropertySchemaType
- type ElicitationRequestScope
- type ElicitationSchema
- type ElicitationSchemaType
- type ElicitationSessionScope
- type ElicitationURLCapabilities
- type ElicitationURLMode
- type EmbeddedResource
- type EmbeddedResourceContents
- type EnumOption
- type EnvVariable
- type Error
- type ErrorCode
- type ExtNotification
- type ExtRequest
- type ExtResponse
- type ExtensionNotificationHandler
- type ExtensionRequestHandler
- type FileSystemCapabilities
- type GroupedSessionConfigSelectOptions
- type HTTPHeader
- type Handler
- type ImageContent
- type Implementation
- type InitializeRequest
- type InitializeResponse
- type IntegerPropertySchema
- type KillTerminalRequest
- type KillTerminalResponse
- type ListSessionsHandler
- type ListSessionsRequest
- type ListSessionsResponse
- type LoadSessionHandler
- type LoadSessionRequest
- type LoadSessionResponse
- type LogoutCapabilities
- type LogoutHandler
- type LogoutRequest
- type LogoutResponse
- type MCPCapabilities
- type MCPServer
- type MCPServerHTTP
- type MCPServerSSE
- type MCPServerStdio
- type MCPServerType
- type MessageID
- type Meta
- type MultiSelectItems
- type MultiSelectItemsType
- type MultiSelectPropertySchema
- type NewSessionRequest
- type NewSessionResponse
- type NumberPropertySchema
- type Option
- type PermissionOption
- type PermissionOptionID
- type PermissionOptionKind
- type Plan
- type PlanEntry
- type PlanEntryPriority
- type PlanEntryStatus
- type PromptCapabilities
- type PromptRequest
- type PromptResponse
- type ProtocolVersion
- type ReadTextFileHandler
- type ReadTextFileRequest
- type ReadTextFileResponse
- type ReleaseTerminalRequest
- type ReleaseTerminalResponse
- type RequestID
- type RequestPermissionOutcome
- type RequestPermissionOutcomeType
- type RequestPermissionRequest
- type RequestPermissionResponse
- type ResourceLink
- type ResumeSessionHandler
- type ResumeSessionRequest
- type ResumeSessionResponse
- type Role
- type SelectedPermissionOutcome
- type SessionAdditionalDirectoriesCapabilities
- type SessionCapabilities
- type SessionCloseCapabilities
- type SessionConfigBoolean
- type SessionConfigGroupID
- type SessionConfigID
- type SessionConfigOption
- type SessionConfigOptionCategory
- type SessionConfigOptionType
- type SessionConfigOptionsCapabilities
- type SessionConfigSelect
- type SessionConfigSelectGroup
- type SessionConfigSelectOption
- type SessionConfigSelectOptions
- type SessionConfigValueID
- type SessionDeleteCapabilities
- type SessionID
- type SessionInfo
- type SessionInfoUpdate
- type SessionListCapabilities
- type SessionMode
- type SessionModeID
- type SessionModeState
- type SessionNotification
- type SessionResumeCapabilities
- type SessionUpdate
- func AgentMessageChunkSessionUpdate(content ContentBlock) SessionUpdate
- func AgentThoughtChunkSessionUpdate(content ContentBlock) SessionUpdate
- func AvailableCommandsUpdateSessionUpdate(availableCommands []AvailableCommand) SessionUpdate
- func ConfigOptionUpdateSessionUpdate(configOptions []SessionConfigOption) SessionUpdate
- func CurrentModeUpdateSessionUpdate(currentModeID SessionModeID) SessionUpdate
- func PlanSessionUpdate(entries []PlanEntry) SessionUpdate
- func SessionInfoSessionUpdate() SessionUpdate
- func ToolCallSessionUpdate(toolCallID ToolCallID, title string) SessionUpdate
- func ToolCallUpdateSessionUpdate(toolCallID ToolCallID) SessionUpdate
- func UsageUpdateSessionUpdate(used uint64, size uint64) SessionUpdate
- func UserMessageChunkSessionUpdate(content ContentBlock) SessionUpdate
- type SessionUpdateType
- type SetSessionConfigOptionHandler
- type SetSessionConfigOptionRequest
- type SetSessionConfigOptionRequestType
- type SetSessionConfigOptionResponse
- type SetSessionModeHandler
- type SetSessionModeRequest
- type SetSessionModeResponse
- type StopReason
- type StringFormat
- type StringMultiSelectItems
- type StringPropertySchema
- type Terminal
- type TerminalExitStatus
- type TerminalHandler
- type TerminalID
- type TerminalOutputRequest
- type TerminalOutputResponse
- type TextContent
- type TextResourceContents
- type TitledMultiSelectItems
- type ToolCall
- type ToolCallContent
- type ToolCallContentType
- type ToolCallID
- type ToolCallLocation
- type ToolCallStatus
- type ToolCallUpdate
- type ToolKind
- type UngroupedSessionConfigSelectOptions
- type UnstructuredCommandInput
- type Usage
- type UsageUpdate
- type WaitForTerminalExitRequest
- type WaitForTerminalExitResponse
- type WriteTextFileHandler
- type WriteTextFileRequest
- type WriteTextFileResponse
Examples ¶
Constants ¶
const ( // MethodInitialize names the protocol negotiation request. MethodInitialize = "initialize" // MethodAuthenticate names the agent authentication request. MethodAuthenticate = "authenticate" // MethodLogout names the agent logout request. MethodLogout = "logout" // MethodSessionNew names the session creation request. MethodSessionNew = "session/new" // MethodSessionLoad names the session load request. MethodSessionLoad = "session/load" // MethodSessionSetMode names the session mode change request. MethodSessionSetMode = "session/set_mode" // MethodSessionSetConfigOption names the session configuration request. MethodSessionSetConfigOption = "session/set_config_option" // MethodSessionPrompt names the prompt request. MethodSessionPrompt = "session/prompt" // MethodSessionCancel names the prompt cancellation notification. MethodSessionCancel = "session/cancel" // MethodSessionList names the session listing request. MethodSessionList = "session/list" // MethodSessionDelete names the session deletion request. MethodSessionDelete = "session/delete" // MethodSessionResume names the session resume request. MethodSessionResume = "session/resume" // MethodSessionClose names the session close request. MethodSessionClose = "session/close" // MethodSessionRequestPermission names the client permission request. MethodSessionRequestPermission = "session/request_permission" // MethodSessionUpdate names the client session update notification. MethodSessionUpdate = "session/update" // MethodFSWriteTextFile names the client file-write request. MethodFSWriteTextFile = "fs/write_text_file" // MethodFSReadTextFile names the client file-read request. MethodFSReadTextFile = "fs/read_text_file" // MethodTerminalCreate names the client terminal creation request. MethodTerminalCreate = "terminal/create" // MethodTerminalOutput names the client terminal output request. MethodTerminalOutput = "terminal/output" // MethodTerminalRelease names the client terminal release request. MethodTerminalRelease = "terminal/release" // MethodTerminalWaitForExit names the client terminal wait request. MethodTerminalWaitForExit = "terminal/wait_for_exit" // MethodTerminalKill names the client terminal kill request. MethodTerminalKill = "terminal/kill" // MethodElicitationCreate names the client elicitation request. MethodElicitationCreate = "elicitation/create" // MethodElicitationComplete names the client elicitation completion notification. MethodElicitationComplete = "elicitation/complete" // MethodCancelRequest is the protocol-level cancellation notification. MethodCancelRequest = "$/cancel_request" )
Variables ¶
var ( // ErrClosed indicates an explicitly closed connection. ErrClosed = errors.New("acp: connection closed") // ErrBufferFull indicates that retained inbound payloads reached their byte limit. ErrBufferFull = errors.New("acp: buffered message limit exceeded") // ErrFrameTooLarge indicates an inbound or outbound frame over its size limit. ErrFrameTooLarge = errors.New("acp: frame too large") // ErrInvalidResponse indicates a malformed or schema-invalid peer response. ErrInvalidResponse = errors.New("acp: invalid response") // ErrQueueFull indicates that the ordered notification backlog is full. ErrQueueFull = errors.New("acp: notification queue full") // ErrTooManyRequests indicates that the inbound request concurrency limit was reached. ErrTooManyRequests = errors.New("acp: too many concurrent requests") )
Functions ¶
This section is empty.
Types ¶
type AgentAuthCapabilities ¶
type AgentAuthCapabilities struct {
Meta Meta `json:"_meta,omitzero"`
Logout *LogoutCapabilities `json:"logout,omitempty"`
}
AgentAuthCapabilities: Authentication-related capabilities supported by the agent.
func (*AgentAuthCapabilities) UnmarshalJSON ¶
func (c *AgentAuthCapabilities) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type AgentCaller ¶
type AgentCaller struct {
// contains filtered or unexported fields
}
AgentCaller invokes agent-side ACP methods from a client handler. Values are supplied by NewClient; the zero value is not usable.
func (*AgentCaller) Authenticate ¶
func (a *AgentCaller) Authenticate(ctx context.Context, req *AuthenticateRequest) (*AuthenticateResponse, error)
Authenticate completes an advertised authentication method.
func (*AgentCaller) Cancel ¶
func (a *AgentCaller) Cancel(ctx context.Context, notification *CancelNotification) error
Cancel cancels the active prompt turn for a session.
func (*AgentCaller) CloseSession ¶
func (a *AgentCaller) CloseSession(ctx context.Context, req *CloseSessionRequest) (*CloseSessionResponse, error)
CloseSession closes an active session.
func (*AgentCaller) DeleteSession ¶
func (a *AgentCaller) DeleteSession(ctx context.Context, req *DeleteSessionRequest) (*DeleteSessionResponse, error)
DeleteSession deletes a saved session.
func (*AgentCaller) Initialize ¶
func (a *AgentCaller) Initialize(ctx context.Context, req *InitializeRequest) (*InitializeResponse, error)
Initialize negotiates the ACP protocol version and capabilities.
func (*AgentCaller) ListSessions ¶
func (a *AgentCaller) ListSessions(ctx context.Context, req *ListSessionsRequest) (*ListSessionsResponse, error)
ListSessions lists saved sessions.
func (*AgentCaller) LoadSession ¶
func (a *AgentCaller) LoadSession(ctx context.Context, req *LoadSessionRequest) (*LoadSessionResponse, error)
LoadSession loads a session.
func (*AgentCaller) Logout ¶
func (a *AgentCaller) Logout(ctx context.Context, req *LogoutRequest) (*LogoutResponse, error)
Logout clears agent authentication state.
func (*AgentCaller) NewSession ¶
func (a *AgentCaller) NewSession(ctx context.Context, req *NewSessionRequest) (*NewSessionResponse, error)
NewSession creates a session.
func (*AgentCaller) Prompt ¶
func (a *AgentCaller) Prompt(ctx context.Context, req *PromptRequest) (*PromptResponse, error)
Prompt starts a prompt turn.
func (*AgentCaller) ResumeSession ¶
func (a *AgentCaller) ResumeSession(ctx context.Context, req *ResumeSessionRequest) (*ResumeSessionResponse, error)
ResumeSession resumes an existing session.
func (*AgentCaller) SetSessionConfigOption ¶
func (a *AgentCaller) SetSessionConfigOption(ctx context.Context, req *SetSessionConfigOptionRequest) (*SetSessionConfigOptionResponse, error)
SetSessionConfigOption changes a session configuration value.
func (*AgentCaller) SetSessionMode ¶
func (a *AgentCaller) SetSessionMode(ctx context.Context, req *SetSessionModeRequest) (*SetSessionModeResponse, error)
SetSessionMode changes the active session mode.
type AgentCapabilities ¶
type AgentCapabilities struct {
Meta Meta `json:"_meta,omitzero"`
Auth *AgentAuthCapabilities `json:"auth,omitempty"`
LoadSession bool `json:"loadSession,omitempty"`
MCPCapabilities *MCPCapabilities `json:"mcpCapabilities,omitempty"`
PromptCapabilities *PromptCapabilities `json:"promptCapabilities,omitempty"`
SessionCapabilities *SessionCapabilities `json:"sessionCapabilities,omitempty"`
}
AgentCapabilities: Capabilities supported by the agent.
Advertised during initialization to inform the client about available features and content types.
See protocol docs: [Agent Capabilities](https://agentclientprotocol.com/protocol/initialization#agent-capabilities)
func (*AgentCapabilities) UnmarshalJSON ¶
func (c *AgentCapabilities) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type AgentHandler ¶
type AgentHandler interface {
Initialize(context.Context, *InitializeRequest) (*InitializeResponse, error)
NewSession(context.Context, *NewSessionRequest) (*NewSessionResponse, error)
Prompt(context.Context, *PromptRequest) (*PromptResponse, error)
Cancel(context.Context, *CancelNotification) error
}
AgentHandler defines the baseline methods every ACP agent implements.
type Annotations ¶
type Annotations struct {
Meta Meta `json:"_meta,omitzero"`
Audience *[]Role `json:"audience,omitempty"`
LastModified *string `json:"lastModified,omitempty"`
Priority *float64 `json:"priority,omitempty"`
}
Annotations: Optional annotations for the client. The client can use annotations to inform how objects are used or displayed
func (*Annotations) UnmarshalJSON ¶
func (a *Annotations) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type AudioContent ¶
type AudioContent struct {
Meta Meta `json:"_meta,omitzero"`
Annotations *Annotations `json:"annotations,omitempty"`
Data string `json:"data"`
MIMEType string `json:"mimeType"`
}
AudioContent: Audio provided to or from an LLM.
func (*AudioContent) UnmarshalJSON ¶
func (c *AudioContent) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type AuthMethod ¶
type AuthMethod struct {
Meta Meta `json:"_meta,omitzero"`
Description *string `json:"description,omitempty"`
ID AuthMethodID `json:"id"`
Name string `json:"name"`
}
AuthMethod: Describes an available authentication method.
The `type` field acts as the discriminator in the serialized JSON form. When no `type` is present, the method is treated as `agent`.
func AgentAuthMethod ¶
func AgentAuthMethod(id AuthMethodID, name string) AuthMethod
AgentAuthMethod creates an AuthMethod variant: Agent handles authentication itself through `authenticate`.
This is the default when no `type` is specified.
func (*AuthMethod) UnmarshalJSON ¶
func (m *AuthMethod) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type AuthMethodAgent ¶
type AuthMethodAgent struct {
Meta Meta `json:"_meta,omitzero"`
Description *string `json:"description,omitempty"`
ID AuthMethodID `json:"id"`
Name string `json:"name"`
}
AuthMethodAgent: Agent handles authentication itself through `authenticate`.
This is the default authentication method type.
func (*AuthMethodAgent) UnmarshalJSON ¶
func (a *AuthMethodAgent) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type AuthMethodID ¶
type AuthMethodID string
AuthMethodID: Typed identifier used for auth method values on the wire.
type AuthenticateHandler ¶
type AuthenticateHandler interface {
Authenticate(context.Context, *AuthenticateRequest) (*AuthenticateResponse, error)
}
AuthenticateHandler optionally handles authenticate requests.
type AuthenticateRequest ¶
type AuthenticateRequest struct {
Meta Meta `json:"_meta,omitzero"`
MethodID AuthMethodID `json:"methodId"`
}
AuthenticateRequest: Request parameters for the authenticate method.
Specifies which authentication method to use.
type AuthenticateResponse ¶
type AuthenticateResponse struct {
Meta Meta `json:"_meta,omitzero"`
}
AuthenticateResponse: Response to the `authenticate` method.
type AvailableCommand ¶
type AvailableCommand struct {
Meta Meta `json:"_meta,omitzero"`
Description string `json:"description"`
Input *AvailableCommandInput `json:"input,omitempty"`
Name string `json:"name"`
}
AvailableCommand: Information about a command.
func (*AvailableCommand) UnmarshalJSON ¶
func (c *AvailableCommand) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type AvailableCommandInput ¶
AvailableCommandInput: The input specification for a command.
func UnstructuredAvailableCommandInput ¶
func UnstructuredAvailableCommandInput(hint string) AvailableCommandInput
UnstructuredAvailableCommandInput creates an AvailableCommandInput variant: All text that was typed after the command name is provided as input.
func (*AvailableCommandInput) UnmarshalJSON ¶
func (i *AvailableCommandInput) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type AvailableCommandsUpdate ¶
type AvailableCommandsUpdate struct {
Meta Meta `json:"_meta,omitzero"`
AvailableCommands []AvailableCommand `json:"availableCommands"`
}
AvailableCommandsUpdate: Available commands are ready or have changed
func (AvailableCommandsUpdate) MarshalJSON ¶
func (u AvailableCommandsUpdate) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*AvailableCommandsUpdate) UnmarshalJSON ¶
func (u *AvailableCommandsUpdate) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type BlobResourceContents ¶
type BlobResourceContents struct {
Meta Meta `json:"_meta,omitzero"`
Blob string `json:"blob"`
MIMEType *string `json:"mimeType,omitempty"`
URI string `json:"uri"`
}
BlobResourceContents: Binary resource contents.
func (*BlobResourceContents) UnmarshalJSON ¶
func (c *BlobResourceContents) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type BooleanConfigOptionCapabilities ¶
type BooleanConfigOptionCapabilities struct {
Meta Meta `json:"_meta,omitzero"`
}
BooleanConfigOptionCapabilities: Capabilities for boolean session configuration options.
Supplying `{}` means the client supports boolean session configuration options.
type BooleanPropertySchema ¶
type BooleanPropertySchema struct {
Meta Meta `json:"_meta,omitzero"`
Default *bool `json:"default,omitempty"`
Description *string `json:"description,omitempty"`
Title *string `json:"title,omitempty"`
}
BooleanPropertySchema: Schema for boolean properties in an elicitation form.
func (*BooleanPropertySchema) UnmarshalJSON ¶
func (s *BooleanPropertySchema) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type CancelNotification ¶
type CancelNotification struct {
Meta Meta `json:"_meta,omitzero"`
SessionID SessionID `json:"sessionId"`
}
CancelNotification: Notification to cancel ongoing operations for a session.
See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/prompt-turn#cancellation)
type CancelRequestNotification ¶
type CancelRequestNotification struct {
Meta Meta `json:"_meta,omitzero"`
RequestID RequestID `json:"requestId"`
}
CancelRequestNotification carries the JSON-RPC request ID to cancel.
type ClientCaller ¶
type ClientCaller struct {
// contains filtered or unexported fields
}
ClientCaller invokes client-side ACP methods from an agent handler. Values are supplied by NewAgent; the zero value is not usable.
func (*ClientCaller) CompleteElicitation ¶
func (c *ClientCaller) CompleteElicitation(ctx context.Context, notification *CompleteElicitationNotification) error
CompleteElicitation tells the client that a URL elicitation has completed.
func (*ClientCaller) CreateElicitation ¶
func (c *ClientCaller) CreateElicitation(ctx context.Context, req *CreateElicitationRequest) (*CreateElicitationResponse, error)
CreateElicitation asks the client to collect structured input from the user.
func (*ClientCaller) CreateTerminal ¶
func (c *ClientCaller) CreateTerminal(ctx context.Context, req *CreateTerminalRequest) (*CreateTerminalResponse, error)
CreateTerminal asks the client to create a terminal.
func (*ClientCaller) KillTerminal ¶
func (c *ClientCaller) KillTerminal(ctx context.Context, req *KillTerminalRequest) (*KillTerminalResponse, error)
KillTerminal asks the client to kill a terminal command.
func (*ClientCaller) ReadTextFile ¶
func (c *ClientCaller) ReadTextFile(ctx context.Context, req *ReadTextFileRequest) (*ReadTextFileResponse, error)
ReadTextFile asks the client to read a text file.
func (*ClientCaller) ReleaseTerminal ¶
func (c *ClientCaller) ReleaseTerminal(ctx context.Context, req *ReleaseTerminalRequest) (*ReleaseTerminalResponse, error)
ReleaseTerminal releases a terminal owned by the client.
func (*ClientCaller) RequestPermission ¶
func (c *ClientCaller) RequestPermission(ctx context.Context, req *RequestPermissionRequest) (*RequestPermissionResponse, error)
RequestPermission asks the client to approve a tool call.
func (*ClientCaller) TerminalOutput ¶
func (c *ClientCaller) TerminalOutput(ctx context.Context, req *TerminalOutputRequest) (*TerminalOutputResponse, error)
TerminalOutput reads terminal output from the client.
func (*ClientCaller) Update ¶
func (c *ClientCaller) Update(ctx context.Context, notification *SessionNotification) error
Update sends a session update notification to the client.
func (*ClientCaller) WaitForTerminalExit ¶
func (c *ClientCaller) WaitForTerminalExit(ctx context.Context, req *WaitForTerminalExitRequest) (*WaitForTerminalExitResponse, error)
WaitForTerminalExit waits for a client terminal to exit.
func (*ClientCaller) WriteTextFile ¶
func (c *ClientCaller) WriteTextFile(ctx context.Context, req *WriteTextFileRequest) (*WriteTextFileResponse, error)
WriteTextFile asks the client to write a text file.
type ClientCapabilities ¶
type ClientCapabilities struct {
Meta Meta `json:"_meta,omitzero"`
Elicitation *ElicitationCapabilities `json:"elicitation,omitempty"`
Fs *FileSystemCapabilities `json:"fs,omitempty"`
Session *ClientSessionCapabilities `json:"session,omitempty"`
Terminal bool `json:"terminal,omitempty"`
}
ClientCapabilities: Capabilities supported by the client.
Advertised during initialization to inform the agent about available features and methods.
See protocol docs: [Client Capabilities](https://agentclientprotocol.com/protocol/initialization#client-capabilities)
func (*ClientCapabilities) UnmarshalJSON ¶
func (c *ClientCapabilities) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ClientHandler ¶
type ClientHandler interface {
RequestPermission(context.Context, *RequestPermissionRequest) (*RequestPermissionResponse, error)
Update(context.Context, *SessionNotification) error
}
ClientHandler defines the baseline methods every ACP client implements.
type ClientSessionCapabilities ¶
type ClientSessionCapabilities struct {
Meta Meta `json:"_meta,omitzero"`
ConfigOptions *SessionConfigOptionsCapabilities `json:"configOptions,omitempty"`
}
ClientSessionCapabilities: Session-related capabilities supported by the client.
func (*ClientSessionCapabilities) UnmarshalJSON ¶
func (c *ClientSessionCapabilities) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type CloseSessionHandler ¶
type CloseSessionHandler interface {
CloseSession(context.Context, *CloseSessionRequest) (*CloseSessionResponse, error)
}
CloseSessionHandler optionally closes a session.
type CloseSessionRequest ¶
type CloseSessionRequest struct {
Meta Meta `json:"_meta,omitzero"`
SessionID SessionID `json:"sessionId"`
}
CloseSessionRequest: Request parameters for closing an active session.
If supported, the agent **must** cancel any ongoing work related to the session (treat it as if `session/cancel` was called) and then free up any resources associated with the session.
Only available if the Agent supports the `sessionCapabilities.close` capability.
type CloseSessionResponse ¶
type CloseSessionResponse struct {
Meta Meta `json:"_meta,omitzero"`
}
CloseSessionResponse: Response from closing a session.
type CompleteElicitationHandler ¶
type CompleteElicitationHandler interface {
CompleteElicitation(context.Context, *CompleteElicitationNotification) error
}
CompleteElicitationHandler optionally handles completion of a URL elicitation.
type CompleteElicitationNotification ¶
type CompleteElicitationNotification struct {
Meta Meta `json:"_meta,omitzero"`
ElicitationID ElicitationID `json:"elicitationId"`
}
CompleteElicitationNotification: Notification sent by the agent when a URL-based elicitation is complete.
func (*CompleteElicitationNotification) UnmarshalJSON ¶
func (n *CompleteElicitationNotification) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ConfigOptionUpdate ¶
type ConfigOptionUpdate struct {
Meta Meta `json:"_meta,omitzero"`
ConfigOptions []SessionConfigOption `json:"configOptions"`
}
ConfigOptionUpdate: Session configuration options have been updated.
func (ConfigOptionUpdate) MarshalJSON ¶
func (u ConfigOptionUpdate) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*ConfigOptionUpdate) UnmarshalJSON ¶
func (u *ConfigOptionUpdate) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn is a bidirectional newline-delimited JSON-RPC 2.0 connection. Its methods are safe for concurrent use.
func New ¶
New starts a generic bidirectional connection for ACP extensions. A nil handler accepts notifications and responds to requests with Method Not Found.
func NewAgent ¶
func NewAgent(input io.ReadCloser, output io.Writer, factory func(*ClientCaller) AgentHandler, opts ...Option) (*Conn, error)
NewAgent starts the agent side of an ACP connection. The factory receives the caller used for reverse client requests and notifications. It must return without performing protocol I/O; the connection starts after it returns.
Example ¶
package main
import (
"context"
"fmt"
"net"
"github.com/gopact-ai/acp"
)
type exampleAgent struct{}
func (*exampleAgent) Initialize(context.Context, *acp.InitializeRequest) (*acp.InitializeResponse, error) {
return &acp.InitializeResponse{ProtocolVersion: acp.ProtocolVersionV1}, nil
}
func (*exampleAgent) NewSession(context.Context, *acp.NewSessionRequest) (*acp.NewSessionResponse, error) {
return &acp.NewSessionResponse{SessionID: "session-1"}, nil
}
func (*exampleAgent) Prompt(context.Context, *acp.PromptRequest) (*acp.PromptResponse, error) {
return &acp.PromptResponse{StopReason: acp.StopReasonEndTurn}, nil
}
func (*exampleAgent) Cancel(context.Context, *acp.CancelNotification) error { return nil }
type exampleClient struct{}
func (*exampleClient) RequestPermission(context.Context, *acp.RequestPermissionRequest) (*acp.RequestPermissionResponse, error) {
return &acp.RequestPermissionResponse{Outcome: acp.CanceledRequestPermissionOutcome()}, nil
}
func (*exampleClient) Update(context.Context, *acp.SessionNotification) error { return nil }
func main() {
agentTransport, clientTransport := net.Pipe()
agentConn, err := acp.NewAgent(agentTransport, agentTransport, func(*acp.ClientCaller) acp.AgentHandler { return &exampleAgent{} })
if err != nil {
panic(err)
}
defer func() { _ = agentConn.Close() }()
var agent *acp.AgentCaller
clientConn, err := acp.NewClient(clientTransport, clientTransport, func(caller *acp.AgentCaller) acp.ClientHandler {
agent = caller
return &exampleClient{}
})
if err != nil {
panic(err)
}
defer func() { _ = clientConn.Close() }()
response, err := agent.Initialize(context.Background(), &acp.InitializeRequest{ProtocolVersion: acp.ProtocolVersionV1})
if err != nil {
panic(err)
}
fmt.Println(response.ProtocolVersion)
}
Output: 1
func NewClient ¶
func NewClient(input io.ReadCloser, output io.Writer, factory func(*AgentCaller) ClientHandler, opts ...Option) (*Conn, error)
NewClient starts the client side of an ACP connection. The factory receives the caller used for agent requests and notifications. It must return without performing protocol I/O; the connection starts after it returns.
func (*Conn) Call ¶
Call sends a request and decodes its result. Cancelling ctx makes a best-effort $/cancel_request notification to the peer.
func (*Conn) Close ¶
Close stops the connection and closes its input. It does not separately close output; closing an input that shares the same transport may affect it.
func (*Conn) Done ¶
func (c *Conn) Done() <-chan struct{}
Done is closed after the reader, notification dispatcher, and active request handlers stop.
type Content ¶
type Content struct {
Meta Meta `json:"_meta,omitzero"`
Content ContentBlock `json:"content"`
}
Content: Standard content block (text, images, resources).
type ContentBlock ¶
type ContentBlock struct {
Type ContentBlockType `json:"type"`
Meta Meta `json:"_meta,omitzero"`
Annotations *Annotations `json:"annotations,omitempty"`
Data string `json:"data,omitempty"`
Description *string `json:"description,omitempty"`
MIMEType *string `json:"mimeType,omitempty"`
Name string `json:"name,omitempty"`
Resource EmbeddedResourceContents `json:"resource,omitzero"`
Size *int64 `json:"size,omitempty"`
Text string `json:"text,omitempty"`
Title *string `json:"title,omitempty"`
URI *string `json:"uri,omitempty"`
}
ContentBlock: Content blocks represent displayable information in the Agent Client Protocol.
They provide a structured way to handle various types of user-facing content—whether it's text from language models, images for analysis, or embedded resources for context.
Content blocks appear in: - User prompts sent via `session/prompt` - Language model output streamed through `session/update` notifications - Progress updates and results from tool calls
This structure is compatible with the Model Context Protocol (MCP), enabling agents to seamlessly forward content from MCP tool outputs without transformation.
See protocol docs: Content(https://agentclientprotocol.com/protocol/content)
func AudioContentBlock ¶
func AudioContentBlock(data string, mimeType string) ContentBlock
AudioContentBlock creates an ContentBlock variant: Audio data for transcription or analysis.
Requires the `audio` prompt capability when included in prompts.
func ImageContentBlock ¶
func ImageContentBlock(data string, mimeType string) ContentBlock
ImageContentBlock creates an ContentBlock variant: Images for visual context or analysis.
Requires the `image` prompt capability when included in prompts.
func ResourceContentBlock ¶
func ResourceContentBlock(resource EmbeddedResourceContents) ContentBlock
ResourceContentBlock creates an ContentBlock variant: Complete resource contents embedded directly in the message.
Preferred for including context as it avoids extra round-trips.
Requires the `embeddedContext` prompt capability when included in prompts.
func ResourceLinkContentBlock ¶
func ResourceLinkContentBlock(name string, uri string) ContentBlock
ResourceLinkContentBlock creates an ContentBlock variant: References to resources that the agent can access.
All agents MUST support resource links in prompts.
func TextContentBlock ¶
func TextContentBlock(text string) ContentBlock
TextContentBlock creates an ContentBlock variant: Text content. May be plain text or formatted with Markdown.
All agents MUST support text content blocks in prompts. Clients SHOULD render this text as Markdown.
func (ContentBlock) MarshalJSON ¶
func (b ContentBlock) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*ContentBlock) UnmarshalJSON ¶
func (b *ContentBlock) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ContentBlockType ¶
type ContentBlockType string
ContentBlockType is the discriminator for ContentBlock variants.
const ( ContentBlockTypeText ContentBlockType = "text" ContentBlockTypeImage ContentBlockType = "image" ContentBlockTypeAudio ContentBlockType = "audio" ContentBlockTypeResourceLink ContentBlockType = "resource_link" ContentBlockTypeResource ContentBlockType = "resource" )
func (*ContentBlockType) UnmarshalJSON ¶
func (t *ContentBlockType) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ContentChunk ¶
type ContentChunk struct {
Meta Meta `json:"_meta,omitzero"`
Content ContentBlock `json:"content"`
MessageID *MessageID `json:"messageId,omitempty"`
}
ContentChunk: A streamed item of content
func (*ContentChunk) UnmarshalJSON ¶
func (c *ContentChunk) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type Cost ¶
type Cost struct {
Meta Meta `json:"_meta,omitzero"`
Amount float64 `json:"amount"`
Currency string `json:"currency"`
}
Cost: Cost information for a session.
func (*Cost) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type CreateElicitationHandler ¶
type CreateElicitationHandler interface {
CreateElicitation(context.Context, *CreateElicitationRequest) (*CreateElicitationResponse, error)
}
CreateElicitationHandler optionally collects structured input from the user.
type CreateElicitationRequest ¶
type CreateElicitationRequest struct {
Mode CreateElicitationRequestType `json:"mode"`
Meta Meta `json:"_meta,omitzero"`
Fields map[string]json.RawMessage `json:"-"`
ElicitationID ElicitationID `json:"elicitationId,omitempty"`
Message string `json:"message"`
RequestID RequestID `json:"requestId,omitempty"`
RequestedSchema ElicitationSchema `json:"requestedSchema,omitzero"`
SessionID SessionID `json:"sessionId,omitempty"`
ToolCallID *ToolCallID `json:"toolCallId,omitempty"`
URL string `json:"url,omitempty"`
}
CreateElicitationRequest: Request from the agent to elicit structured user input.
The agent sends this to the client to request information from the user, either via a form or by directing them to a URL. Elicitations are tied to a session (optionally a tool call) or a request.
func RequestFormCreateElicitationRequest ¶
func RequestFormCreateElicitationRequest(message string, requestedSchema ElicitationSchema, requestID RequestID) CreateElicitationRequest
RequestFormCreateElicitationRequest creates a request-scoped form elicitation.
func RequestOtherCreateElicitationRequest ¶
func RequestOtherCreateElicitationRequest(message string, mode string, requestID RequestID, fields map[string]json.RawMessage) CreateElicitationRequest
RequestOtherCreateElicitationRequest creates a request-scoped custom or future elicitation mode.
func RequestURLCreateElicitationRequest ¶
func RequestURLCreateElicitationRequest(message string, elicitationID ElicitationID, url string, requestID RequestID) CreateElicitationRequest
RequestURLCreateElicitationRequest creates a request-scoped URL elicitation.
func SessionFormCreateElicitationRequest ¶
func SessionFormCreateElicitationRequest(message string, requestedSchema ElicitationSchema, sessionID SessionID) CreateElicitationRequest
SessionFormCreateElicitationRequest creates a session-scoped form elicitation.
func SessionOtherCreateElicitationRequest ¶
func SessionOtherCreateElicitationRequest(message string, mode string, sessionID SessionID, fields map[string]json.RawMessage) CreateElicitationRequest
SessionOtherCreateElicitationRequest creates a session-scoped custom or future elicitation mode.
Values beginning with `_` are reserved for implementation-specific extensions. Unknown values that do not begin with `_` are reserved for future ACP variants.
Clients that do not understand this mode should preserve the raw payload when storing, replaying, proxying, or forwarding elicitation requests. They MUST NOT render it as a known elicitation mode.
func SessionURLCreateElicitationRequest ¶
func SessionURLCreateElicitationRequest(message string, elicitationID ElicitationID, url string, sessionID SessionID) CreateElicitationRequest
SessionURLCreateElicitationRequest creates a session-scoped URL elicitation.
func (CreateElicitationRequest) MarshalJSON ¶
func (r CreateElicitationRequest) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*CreateElicitationRequest) UnmarshalJSON ¶
func (r *CreateElicitationRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type CreateElicitationRequestType ¶
type CreateElicitationRequestType string
CreateElicitationRequestType is the discriminator for CreateElicitationRequest variants.
const ( CreateElicitationRequestTypeForm CreateElicitationRequestType = "form" CreateElicitationRequestTypeURL CreateElicitationRequestType = "url" )
type CreateElicitationResponse ¶
type CreateElicitationResponse struct {
Action CreateElicitationResponseType `json:"action"`
Meta Meta `json:"_meta,omitzero"`
Fields map[string]json.RawMessage `json:"-"`
Content *map[string]ElicitationContentValue `json:"content,omitempty"`
}
CreateElicitationResponse: Response from the client to an elicitation request.
func AcceptCreateElicitationResponse ¶
func AcceptCreateElicitationResponse() CreateElicitationResponse
AcceptCreateElicitationResponse creates a CreateElicitationResponse accept variant.
func CancelCreateElicitationResponse ¶
func CancelCreateElicitationResponse() CreateElicitationResponse
CancelCreateElicitationResponse creates a CreateElicitationResponse cancel variant.
func DeclineCreateElicitationResponse ¶
func DeclineCreateElicitationResponse() CreateElicitationResponse
DeclineCreateElicitationResponse creates a CreateElicitationResponse decline variant.
func OtherCreateElicitationResponse ¶
func OtherCreateElicitationResponse(action string, fields map[string]json.RawMessage) CreateElicitationResponse
OtherCreateElicitationResponse creates a custom or future CreateElicitationResponse action.
Values beginning with `_` are reserved for implementation-specific extensions. Unknown values that do not begin with `_` are reserved for future ACP variants.
Agents that do not understand this action should preserve the raw payload when storing, replaying, proxying, or forwarding elicitation responses. They MUST NOT treat it as a known elicitation action.
func (CreateElicitationResponse) MarshalJSON ¶
func (r CreateElicitationResponse) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*CreateElicitationResponse) UnmarshalJSON ¶
func (r *CreateElicitationResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type CreateElicitationResponseType ¶
type CreateElicitationResponseType string
CreateElicitationResponseType is the discriminator for CreateElicitationResponse variants.
const ( CreateElicitationResponseTypeAccept CreateElicitationResponseType = "accept" CreateElicitationResponseTypeDecline CreateElicitationResponseType = "decline" CreateElicitationResponseTypeCancel CreateElicitationResponseType = "cancel" )
type CreateTerminalRequest ¶
type CreateTerminalRequest struct {
Meta Meta `json:"_meta,omitzero"`
Args []string `json:"args,omitempty"`
Command string `json:"command"`
Cwd *string `json:"cwd,omitempty"`
Env []EnvVariable `json:"env,omitempty"`
OutputByteLimit *uint64 `json:"outputByteLimit,omitempty"`
SessionID SessionID `json:"sessionId"`
}
CreateTerminalRequest: Request to create a new terminal and execute a command.
func (*CreateTerminalRequest) UnmarshalJSON ¶
func (r *CreateTerminalRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type CreateTerminalResponse ¶
type CreateTerminalResponse struct {
Meta Meta `json:"_meta,omitzero"`
TerminalID TerminalID `json:"terminalId"`
}
CreateTerminalResponse: Response containing the ID of the created terminal.
type CurrentModeUpdate ¶
type CurrentModeUpdate struct {
Meta Meta `json:"_meta,omitzero"`
CurrentModeID SessionModeID `json:"currentModeId"`
}
CurrentModeUpdate: The current mode of the session has changed
See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)
type DeleteSessionHandler ¶
type DeleteSessionHandler interface {
DeleteSession(context.Context, *DeleteSessionRequest) (*DeleteSessionResponse, error)
}
DeleteSessionHandler optionally deletes a session.
type DeleteSessionRequest ¶
type DeleteSessionRequest struct {
Meta Meta `json:"_meta,omitzero"`
SessionID SessionID `json:"sessionId"`
}
DeleteSessionRequest: Request parameters for deleting an existing session from `session/list`.
Only available if the Agent supports the `sessionCapabilities.delete` capability.
type DeleteSessionResponse ¶
type DeleteSessionResponse struct {
Meta Meta `json:"_meta,omitzero"`
}
DeleteSessionResponse: Response from deleting a session.
type Diff ¶
type Diff struct {
Meta Meta `json:"_meta,omitzero"`
NewText string `json:"newText"`
OldText *string `json:"oldText,omitempty"`
Path string `json:"path"`
}
Diff: A diff representing file modifications.
Shows changes to files in a format suitable for display in the client UI.
See protocol docs: Content(https://agentclientprotocol.com/protocol/tool-calls#content)
func (*Diff) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type ElicitationAcceptAction ¶
type ElicitationAcceptAction struct {
Content *map[string]ElicitationContentValue `json:"content,omitempty"`
}
ElicitationAcceptAction: The user accepted the elicitation and provided content.
type ElicitationCapabilities ¶
type ElicitationCapabilities struct {
Meta Meta `json:"_meta,omitzero"`
Form *ElicitationFormCapabilities `json:"form,omitempty"`
URL *ElicitationURLCapabilities `json:"url,omitempty"`
}
ElicitationCapabilities: Elicitation capabilities supported by the client.
func (*ElicitationCapabilities) SupportsForm ¶
func (c *ElicitationCapabilities) SupportsForm() bool
SupportsForm reports whether form-based elicitation is advertised.
func (*ElicitationCapabilities) SupportsURL ¶
func (c *ElicitationCapabilities) SupportsURL() bool
SupportsURL reports whether URL-based elicitation is advertised.
func (*ElicitationCapabilities) UnmarshalJSON ¶
func (c *ElicitationCapabilities) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ElicitationContentValue ¶
type ElicitationContentValue json.RawMessage
ElicitationContentValue: Allowed wire representations for [`ElicitationContentValue`].
func NewElicitationContentValue ¶
func NewElicitationContentValue(value any) (ElicitationContentValue, error)
NewElicitationContentValue converts a supported Go value to its wire representation.
func (ElicitationContentValue) MarshalJSON ¶
func (v ElicitationContentValue) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*ElicitationContentValue) UnmarshalJSON ¶
func (v *ElicitationContentValue) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ElicitationFormCapabilities ¶
type ElicitationFormCapabilities struct {
Meta Meta `json:"_meta,omitzero"`
}
ElicitationFormCapabilities: Form-based elicitation capabilities.
Supplying `{}` means the client supports form-based elicitation.
type ElicitationFormMode ¶
type ElicitationFormMode struct {
RequestID *RequestID `json:"requestId,omitempty"`
RequestedSchema ElicitationSchema `json:"requestedSchema"`
SessionID *SessionID `json:"sessionId,omitempty"`
ToolCallID *ToolCallID `json:"toolCallId,omitempty"`
}
ElicitationFormMode: Form-based elicitation mode where the client renders a form from the provided schema.
func RequestElicitationFormMode ¶
func RequestElicitationFormMode(requestedSchema ElicitationSchema, requestID RequestID) ElicitationFormMode
RequestElicitationFormMode creates an ElicitationFormMode tied to a specific JSON-RPC request outside of a session (e.g., during auth/configuration phases before any session is started).
func SessionElicitationFormMode ¶
func SessionElicitationFormMode(requestedSchema ElicitationSchema, sessionID SessionID) ElicitationFormMode
SessionElicitationFormMode creates an ElicitationFormMode tied to a session, optionally to a specific tool call within that session.
func (*ElicitationFormMode) UnmarshalJSON ¶
func (m *ElicitationFormMode) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ElicitationPropertySchema ¶
type ElicitationPropertySchema struct {
Type ElicitationPropertySchemaType `json:"type"`
Meta Meta `json:"_meta,omitzero"`
Fields map[string]json.RawMessage `json:"-"`
Default any `json:"default,omitempty"`
Description *string `json:"description,omitempty"`
Enum *[]string `json:"enum,omitempty"`
Format *StringFormat `json:"format,omitempty"`
Items MultiSelectItems `json:"items,omitzero"`
MaxItems *uint64 `json:"maxItems,omitempty"`
MaxLength *uint32 `json:"maxLength,omitempty"`
Maximum any `json:"maximum,omitempty"`
MinItems *uint64 `json:"minItems,omitempty"`
MinLength *uint32 `json:"minLength,omitempty"`
Minimum any `json:"minimum,omitempty"`
OneOf *[]EnumOption `json:"oneOf,omitempty"`
Pattern *string `json:"pattern,omitempty"`
Title *string `json:"title,omitempty"`
}
ElicitationPropertySchema: Property schema for elicitation form fields.
Each variant corresponds to a JSON Schema `"type"` value. Single-select enums use the `String` variant with `enum` or `oneOf` set. Multi-select enums use the `Array` variant.
func ArrayElicitationPropertySchema ¶
func ArrayElicitationPropertySchema(items MultiSelectItems) ElicitationPropertySchema
ArrayElicitationPropertySchema creates a multi-select array ElicitationPropertySchema.
func BooleanElicitationPropertySchema ¶
func BooleanElicitationPropertySchema() ElicitationPropertySchema
BooleanElicitationPropertySchema creates a boolean ElicitationPropertySchema.
func IntegerElicitationPropertySchema ¶
func IntegerElicitationPropertySchema() ElicitationPropertySchema
IntegerElicitationPropertySchema creates an integer ElicitationPropertySchema.
func NumberElicitationPropertySchema ¶
func NumberElicitationPropertySchema() ElicitationPropertySchema
NumberElicitationPropertySchema creates a number ElicitationPropertySchema.
func OtherElicitationPropertySchema ¶
func OtherElicitationPropertySchema(typeName string, fields map[string]json.RawMessage) ElicitationPropertySchema
OtherElicitationPropertySchema creates a custom or future ElicitationPropertySchema.
Values beginning with `_` are reserved for implementation-specific extensions. Unknown values that do not begin with `_` are reserved for future ACP variants.
Clients that do not understand this property schema type should preserve the raw schema when storing, replaying, proxying, or forwarding elicitation requests. They MUST NOT render it as a known input control.
func StringElicitationPropertySchema ¶
func StringElicitationPropertySchema() ElicitationPropertySchema
StringElicitationPropertySchema creates a string ElicitationPropertySchema.
func (ElicitationPropertySchema) MarshalJSON ¶
func (s ElicitationPropertySchema) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*ElicitationPropertySchema) UnmarshalJSON ¶
func (s *ElicitationPropertySchema) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ElicitationPropertySchemaType ¶
type ElicitationPropertySchemaType string
ElicitationPropertySchemaType is the discriminator for ElicitationPropertySchema variants.
const ( ElicitationPropertySchemaTypeString ElicitationPropertySchemaType = "string" ElicitationPropertySchemaTypeNumber ElicitationPropertySchemaType = "number" ElicitationPropertySchemaTypeInteger ElicitationPropertySchemaType = "integer" ElicitationPropertySchemaTypeBoolean ElicitationPropertySchemaType = "boolean" ElicitationPropertySchemaTypeArray ElicitationPropertySchemaType = "array" )
type ElicitationRequestScope ¶
type ElicitationRequestScope struct {
RequestID RequestID `json:"requestId"`
}
ElicitationRequestScope: Request-scoped elicitation, tied to a specific JSON-RPC request outside of a session (e.g., during auth/configuration phases before any session is started).
func (*ElicitationRequestScope) UnmarshalJSON ¶
func (s *ElicitationRequestScope) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ElicitationSchema ¶
type ElicitationSchema struct {
Meta Meta `json:"_meta,omitzero"`
Description *string `json:"description,omitempty"`
Properties map[string]ElicitationPropertySchema `json:"properties,omitempty"`
Required *[]string `json:"required,omitempty"`
Title *string `json:"title,omitempty"`
Type ElicitationSchemaType `json:"type,omitempty"`
}
ElicitationSchema: Type-safe elicitation schema for requesting structured user input.
This represents a JSON Schema object with primitive-typed properties, as required by the elicitation specification.
func (ElicitationSchema) MarshalJSON ¶
func (s ElicitationSchema) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*ElicitationSchema) UnmarshalJSON ¶
func (s *ElicitationSchema) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ElicitationSchemaType ¶
type ElicitationSchemaType string
ElicitationSchemaType: Type discriminator for elicitation schemas.
const ( // ElicitationSchemaTypeObject: Object schema type. ElicitationSchemaTypeObject ElicitationSchemaType = "object" )
type ElicitationSessionScope ¶
type ElicitationSessionScope struct {
SessionID SessionID `json:"sessionId"`
ToolCallID *ToolCallID `json:"toolCallId,omitempty"`
}
ElicitationSessionScope: Session-scoped elicitation, optionally tied to a specific tool call.
When `tool_call_id` is set, the elicitation is tied to a specific tool call. This is useful when an agent receives an elicitation from an MCP server during a tool call and needs to redirect it to the user.
func (*ElicitationSessionScope) UnmarshalJSON ¶
func (s *ElicitationSessionScope) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ElicitationURLCapabilities ¶
type ElicitationURLCapabilities struct {
Meta Meta `json:"_meta,omitzero"`
}
ElicitationURLCapabilities: URL-based elicitation capabilities.
Supplying `{}` means the client supports URL-based elicitation.
type ElicitationURLMode ¶
type ElicitationURLMode struct {
ElicitationID ElicitationID `json:"elicitationId"`
RequestID *RequestID `json:"requestId,omitempty"`
SessionID *SessionID `json:"sessionId,omitempty"`
ToolCallID *ToolCallID `json:"toolCallId,omitempty"`
URL string `json:"url"`
}
ElicitationURLMode: URL-based elicitation mode where the client directs the user to a URL.
func RequestElicitationURLMode ¶
func RequestElicitationURLMode(elicitationID ElicitationID, url string, requestID RequestID) ElicitationURLMode
RequestElicitationURLMode creates an ElicitationURLMode variant tied to a specific JSON-RPC request outside of a session (e.g., during auth/configuration phases before any session is started).
func SessionElicitationURLMode ¶
func SessionElicitationURLMode(elicitationID ElicitationID, url string, sessionID SessionID) ElicitationURLMode
SessionElicitationURLMode creates an ElicitationURLMode variant tied to a session, optionally to a specific tool call within that session.
func (*ElicitationURLMode) UnmarshalJSON ¶
func (m *ElicitationURLMode) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type EmbeddedResource ¶
type EmbeddedResource struct {
Meta Meta `json:"_meta,omitzero"`
Annotations *Annotations `json:"annotations,omitempty"`
Resource EmbeddedResourceContents `json:"resource"`
}
EmbeddedResource: The contents of a resource, embedded into a prompt or tool call result.
func (*EmbeddedResource) UnmarshalJSON ¶
func (r *EmbeddedResource) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type EmbeddedResourceContents ¶
type EmbeddedResourceContents struct {
Meta Meta `json:"_meta,omitzero"`
Blob *string `json:"blob,omitempty"`
MIMEType *string `json:"mimeType,omitempty"`
Text *string `json:"text,omitempty"`
URI string `json:"uri"`
}
EmbeddedResourceContents: Resource content that can be embedded in a message.
func BlobEmbeddedResourceContents ¶
func BlobEmbeddedResourceContents(blob string, uri string) EmbeddedResourceContents
BlobEmbeddedResourceContents creates an EmbeddedResourceContents variant: Binary resource contents embedded directly in the message.
func TextEmbeddedResourceContents ¶
func TextEmbeddedResourceContents(text string, uri string) EmbeddedResourceContents
TextEmbeddedResourceContents creates an EmbeddedResourceContents variant: Text resource contents embedded directly in the message.
func (*EmbeddedResourceContents) UnmarshalJSON ¶
func (r *EmbeddedResourceContents) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type EnumOption ¶
type EnumOption struct {
Meta Meta `json:"_meta,omitzero"`
Const string `json:"const"`
Description *string `json:"description,omitempty"`
Title string `json:"title"`
}
EnumOption: A titled enum option with a const value, human-readable title, and optional description.
func (*EnumOption) UnmarshalJSON ¶
func (o *EnumOption) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type EnvVariable ¶
type EnvVariable struct {
Meta Meta `json:"_meta,omitzero"`
Name string `json:"name"`
Value string `json:"value"`
}
EnvVariable: An environment variable to set when launching an MCP server.
func (*EnvVariable) UnmarshalJSON ¶
func (e *EnvVariable) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type Error ¶
type Error struct {
Code ErrorCode `json:"code"`
Data any `json:"data,omitempty"`
Message string `json:"message"`
}
Error: JSON-RPC error object.
Represents an error that occurred during method execution, following the JSON-RPC 2.0 error object specification with optional additional data.
See protocol docs: [JSON-RPC Error Object](https://www.jsonrpc.org/specification#error_object)
func (*Error) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type ErrorCode ¶
type ErrorCode int32
ErrorCode: Predefined error codes for common JSON-RPC and ACP-specific errors.
These codes follow the JSON-RPC 2.0 specification for standard errors and use the reserved range (-32000 to -32099) for protocol-specific errors.
const ( // ErrorCodeParseError: **Parse error**: Invalid JSON was received by the server. // An error occurred on the server while parsing the JSON text. ErrorCodeParseError ErrorCode = -32700 // ErrorCodeInvalidRequest: **Invalid request**: The JSON sent is not a valid Request object. ErrorCodeInvalidRequest ErrorCode = -32600 // ErrorCodeMethodNotFound: **Method not found**: The method does not exist or is not available. ErrorCodeMethodNotFound ErrorCode = -32601 // ErrorCodeInvalidParams: **Invalid params**: Invalid method parameter(s). ErrorCodeInvalidParams ErrorCode = -32602 // ErrorCodeInternalError: **Internal error**: Internal JSON-RPC error. // Reserved for implementation-defined server errors. ErrorCodeInternalError ErrorCode = -32603 // ErrorCodeRequestCanceled: **Request cancelled**: Execution of the method was aborted either due to a cancellation request from the caller or // because of resource constraints or shutdown. ErrorCodeRequestCanceled ErrorCode = -32800 // ErrorCodeAuthenticationRequired: **Authentication required**: Authentication is required before this operation can be performed. ErrorCodeAuthenticationRequired ErrorCode = -32000 // ErrorCodeResourceNotFound: **Resource not found**: A given resource, such as a file, was not found. ErrorCodeResourceNotFound ErrorCode = -32002 )
type ExtNotification ¶
type ExtNotification any
ExtNotification: Allows the Agent to send an arbitrary notification that is not part of the ACP spec. Extension notifications provide a way to send one-way messages for custom functionality while maintaining protocol compatibility.
See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
type ExtRequest ¶
type ExtRequest any
ExtRequest: Allows for sending an arbitrary request that is not part of the ACP spec. Extension methods provide a way to add custom functionality while maintaining protocol compatibility.
See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
type ExtResponse ¶
type ExtResponse any
ExtResponse: Allows for sending an arbitrary response to an [`ExtRequest`] that is not part of the ACP spec. Extension methods provide a way to add custom functionality while maintaining protocol compatibility.
See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
type ExtensionNotificationHandler ¶
type ExtensionNotificationHandler interface {
HandleNotification(context.Context, string, json.RawMessage) error
}
ExtensionNotificationHandler handles extension notifications not defined by stable ACP v1.
type ExtensionRequestHandler ¶
type ExtensionRequestHandler interface {
HandleRequest(context.Context, string, json.RawMessage) (any, error)
}
ExtensionRequestHandler handles extension requests not defined by stable ACP v1.
type FileSystemCapabilities ¶
type FileSystemCapabilities struct {
Meta Meta `json:"_meta,omitzero"`
ReadTextFile bool `json:"readTextFile,omitempty"`
WriteTextFile bool `json:"writeTextFile,omitempty"`
}
FileSystemCapabilities: File system capabilities that a client may support.
See protocol docs: [FileSystem](https://agentclientprotocol.com/protocol/initialization#filesystem)
func (*FileSystemCapabilities) UnmarshalJSON ¶
func (c *FileSystemCapabilities) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type GroupedSessionConfigSelectOptions ¶
type GroupedSessionConfigSelectOptions []SessionConfigSelectGroup
GroupedSessionConfigSelectOptions is the grouped variant of SessionConfigSelectOptions.
type HTTPHeader ¶
type HTTPHeader struct {
Meta Meta `json:"_meta,omitzero"`
Name string `json:"name"`
Value string `json:"value"`
}
HTTPHeader: An HTTP header to set when making requests to the MCP server.
func (*HTTPHeader) UnmarshalJSON ¶
func (h *HTTPHeader) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type Handler ¶
Handler handles an incoming request or notification. Requests may be handled concurrently; notifications are handled serially in wire order. Omitted params are passed as an empty JSON object. Returning *Error controls a request error response; other errors become Internal Error responses.
type ImageContent ¶
type ImageContent struct {
Meta Meta `json:"_meta,omitzero"`
Annotations *Annotations `json:"annotations,omitempty"`
Data string `json:"data"`
MIMEType string `json:"mimeType"`
URI *string `json:"uri,omitempty"`
}
ImageContent: An image provided to or from an LLM.
func (*ImageContent) UnmarshalJSON ¶
func (c *ImageContent) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type Implementation ¶
type Implementation struct {
Meta Meta `json:"_meta,omitzero"`
Name string `json:"name"`
Title *string `json:"title,omitempty"`
Version string `json:"version"`
}
Implementation: Metadata about the implementation of the client or agent. Describes the name and version of an ACP implementation, with an optional title for UI representation.
func (*Implementation) UnmarshalJSON ¶
func (i *Implementation) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type InitializeRequest ¶
type InitializeRequest struct {
Meta Meta `json:"_meta,omitzero"`
ClientCapabilities *ClientCapabilities `json:"clientCapabilities,omitempty"`
ClientInfo *Implementation `json:"clientInfo,omitempty"`
ProtocolVersion ProtocolVersion `json:"protocolVersion"`
}
InitializeRequest: Request parameters for the initialize method.
Sent by the client to establish connection and negotiate capabilities.
See protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization)
func (*InitializeRequest) UnmarshalJSON ¶
func (r *InitializeRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type InitializeResponse ¶
type InitializeResponse struct {
Meta Meta `json:"_meta,omitzero"`
AgentCapabilities *AgentCapabilities `json:"agentCapabilities,omitempty"`
AgentInfo *Implementation `json:"agentInfo,omitempty"`
AuthMethods []AuthMethod `json:"authMethods,omitempty"`
ProtocolVersion ProtocolVersion `json:"protocolVersion"`
}
InitializeResponse: Response to the `initialize` method.
Contains the negotiated protocol version and agent capabilities.
See protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization)
func (*InitializeResponse) UnmarshalJSON ¶
func (r *InitializeResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type IntegerPropertySchema ¶
type IntegerPropertySchema struct {
Meta Meta `json:"_meta,omitzero"`
Default *int64 `json:"default,omitempty"`
Description *string `json:"description,omitempty"`
Maximum *int64 `json:"maximum,omitempty"`
Minimum *int64 `json:"minimum,omitempty"`
Title *string `json:"title,omitempty"`
}
IntegerPropertySchema: Schema for integer properties in an elicitation form.
func (*IntegerPropertySchema) UnmarshalJSON ¶
func (s *IntegerPropertySchema) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type KillTerminalRequest ¶
type KillTerminalRequest struct {
Meta Meta `json:"_meta,omitzero"`
SessionID SessionID `json:"sessionId"`
TerminalID TerminalID `json:"terminalId"`
}
KillTerminalRequest: Request to kill a terminal without releasing it.
type KillTerminalResponse ¶
type KillTerminalResponse struct {
Meta Meta `json:"_meta,omitzero"`
}
KillTerminalResponse: Response to `terminal/kill` method
type ListSessionsHandler ¶
type ListSessionsHandler interface {
ListSessions(context.Context, *ListSessionsRequest) (*ListSessionsResponse, error)
}
ListSessionsHandler optionally lists sessions.
type ListSessionsRequest ¶
type ListSessionsRequest struct {
Meta Meta `json:"_meta,omitzero"`
Cursor *string `json:"cursor,omitempty"`
Cwd *string `json:"cwd,omitempty"`
}
ListSessionsRequest: Request parameters for listing existing sessions.
Only available if the Agent supports the `sessionCapabilities.list` capability.
type ListSessionsResponse ¶
type ListSessionsResponse struct {
Meta Meta `json:"_meta,omitzero"`
NextCursor *string `json:"nextCursor,omitempty"`
Sessions []SessionInfo `json:"sessions"`
}
ListSessionsResponse: Response from listing sessions.
func (ListSessionsResponse) MarshalJSON ¶
func (r ListSessionsResponse) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*ListSessionsResponse) UnmarshalJSON ¶
func (r *ListSessionsResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type LoadSessionHandler ¶
type LoadSessionHandler interface {
LoadSession(context.Context, *LoadSessionRequest) (*LoadSessionResponse, error)
}
LoadSessionHandler optionally loads an existing session.
type LoadSessionRequest ¶
type LoadSessionRequest struct {
Meta Meta `json:"_meta,omitzero"`
AdditionalDirectories []string `json:"additionalDirectories,omitempty"`
Cwd string `json:"cwd"`
MCPServers []MCPServer `json:"mcpServers"`
SessionID SessionID `json:"sessionId"`
}
LoadSessionRequest: Request parameters for loading an existing session.
Only available if the Agent supports the `loadSession` capability.
See protocol docs: [Loading Sessions](https://agentclientprotocol.com/protocol/session-setup#loading-sessions)
func (LoadSessionRequest) MarshalJSON ¶
func (r LoadSessionRequest) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*LoadSessionRequest) UnmarshalJSON ¶
func (r *LoadSessionRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type LoadSessionResponse ¶
type LoadSessionResponse struct {
Meta Meta `json:"_meta,omitzero"`
ConfigOptions *[]SessionConfigOption `json:"configOptions,omitempty"`
Modes *SessionModeState `json:"modes,omitempty"`
}
LoadSessionResponse: Response from loading an existing session.
func (*LoadSessionResponse) UnmarshalJSON ¶
func (r *LoadSessionResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type LogoutCapabilities ¶
type LogoutCapabilities struct {
Meta Meta `json:"_meta,omitzero"`
}
LogoutCapabilities: Logout capabilities supported by the agent.
Supplying `{}` means the agent supports the logout method.
type LogoutHandler ¶
type LogoutHandler interface {
Logout(context.Context, *LogoutRequest) (*LogoutResponse, error)
}
LogoutHandler optionally handles logout requests.
type LogoutRequest ¶
type LogoutRequest struct {
Meta Meta `json:"_meta,omitzero"`
}
LogoutRequest: Request parameters for the logout method.
Terminates the current authenticated session.
type LogoutResponse ¶
type LogoutResponse struct {
Meta Meta `json:"_meta,omitzero"`
}
LogoutResponse: Response to the `logout` method.
type MCPCapabilities ¶
type MCPCapabilities struct {
Meta Meta `json:"_meta,omitzero"`
HTTP bool `json:"http,omitempty"`
SSE bool `json:"sse,omitempty"`
}
MCPCapabilities: MCP capabilities supported by the agent
func (*MCPCapabilities) UnmarshalJSON ¶
func (c *MCPCapabilities) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type MCPServer ¶
type MCPServer struct {
Type MCPServerType `json:"type,omitempty"`
Meta Meta `json:"_meta,omitzero"`
Args []string `json:"args,omitempty"`
Command string `json:"command,omitempty"`
Env []EnvVariable `json:"env,omitempty"`
Headers []HTTPHeader `json:"headers,omitempty"`
Name string `json:"name"`
URL string `json:"url,omitempty"`
}
MCPServer: Configuration for connecting to an MCP (Model Context Protocol) server.
MCP servers provide tools and context that the agent can use when processing prompts.
See protocol docs: [MCP Servers](https://agentclientprotocol.com/protocol/session-setup#mcp-servers)
func HTTPMCPServer ¶
func HTTPMCPServer(name string, url string, headers []HTTPHeader) MCPServer
HTTPMCPServer creates an MCPServer variant: HTTP transport configuration
Only available when the Agent capabilities indicate `mcp_capabilities.http` is `true`.
func SSEMCPServer ¶
func SSEMCPServer(name string, url string, headers []HTTPHeader) MCPServer
SSEMCPServer creates an MCPServer variant: SSE transport configuration
Only available when the Agent capabilities indicate `mcp_capabilities.sse` is `true`.
func StdioMCPServer ¶
func StdioMCPServer(name string, command string, args []string, env []EnvVariable) MCPServer
StdioMCPServer creates an MCPServer variant: Stdio transport configuration
All Agents MUST support this transport.
func (MCPServer) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (*MCPServer) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type MCPServerHTTP ¶
type MCPServerHTTP struct {
Meta Meta `json:"_meta,omitzero"`
Headers []HTTPHeader `json:"headers"`
Name string `json:"name"`
URL string `json:"url"`
}
MCPServerHTTP: HTTP transport configuration for MCP.
func (MCPServerHTTP) MarshalJSON ¶
func (h MCPServerHTTP) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
type MCPServerSSE ¶
type MCPServerSSE struct {
Meta Meta `json:"_meta,omitzero"`
Headers []HTTPHeader `json:"headers"`
Name string `json:"name"`
URL string `json:"url"`
}
MCPServerSSE: SSE transport configuration for MCP.
func (MCPServerSSE) MarshalJSON ¶
func (s MCPServerSSE) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
type MCPServerStdio ¶
type MCPServerStdio struct {
Meta Meta `json:"_meta,omitzero"`
Args []string `json:"args"`
Command string `json:"command"`
Env []EnvVariable `json:"env"`
Name string `json:"name"`
}
MCPServerStdio: Stdio transport configuration for MCP.
func (MCPServerStdio) MarshalJSON ¶
func (s MCPServerStdio) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
type MCPServerType ¶
type MCPServerType string
MCPServerType is the discriminator for MCPServer variants.
const ( MCPServerTypeHTTP MCPServerType = "http" MCPServerTypeSSE MCPServerType = "sse" )
func (*MCPServerType) UnmarshalJSON ¶
func (t *MCPServerType) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type Meta ¶
Meta: Reserved metadata for protocol extensions.
func (*Meta) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type MultiSelectItems ¶
type MultiSelectItems struct {
Type MultiSelectItemsType `json:"type,omitempty"`
Meta Meta `json:"_meta,omitzero"`
Fields map[string]json.RawMessage `json:"-"`
AnyOf []EnumOption `json:"anyOf,omitempty"`
Enum []string `json:"enum,omitempty"`
}
MultiSelectItems: Items for a multi-select (array) property schema.
func NewStringMultiSelectItems ¶
func NewStringMultiSelectItems(enum []string) MultiSelectItems
NewStringMultiSelectItems creates MultiSelectItems with plain string values.
func NewTitledMultiSelectItems ¶
func NewTitledMultiSelectItems(anyOf []EnumOption) MultiSelectItems
NewTitledMultiSelectItems creates MultiSelectItems with human-readable labels.
func OtherMultiSelectItems ¶
func OtherMultiSelectItems(typeName string, fields map[string]json.RawMessage) MultiSelectItems
OtherMultiSelectItems creates custom or future typed MultiSelectItems.
func (MultiSelectItems) MarshalJSON ¶
func (i MultiSelectItems) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*MultiSelectItems) UnmarshalJSON ¶
func (i *MultiSelectItems) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type MultiSelectItemsType ¶
type MultiSelectItemsType string
MultiSelectItemsType is the discriminator for MultiSelectItems variants.
const (
MultiSelectItemsTypeString MultiSelectItemsType = "string"
)
type MultiSelectPropertySchema ¶
type MultiSelectPropertySchema struct {
Meta Meta `json:"_meta,omitzero"`
Default *[]string `json:"default,omitempty"`
Description *string `json:"description,omitempty"`
Items MultiSelectItems `json:"items"`
MaxItems *uint64 `json:"maxItems,omitempty"`
MinItems *uint64 `json:"minItems,omitempty"`
Title *string `json:"title,omitempty"`
}
MultiSelectPropertySchema: Schema for multi-select (array) properties in an elicitation form.
func (*MultiSelectPropertySchema) UnmarshalJSON ¶
func (s *MultiSelectPropertySchema) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type NewSessionRequest ¶
type NewSessionRequest struct {
Meta Meta `json:"_meta,omitzero"`
AdditionalDirectories []string `json:"additionalDirectories,omitempty"`
Cwd string `json:"cwd"`
MCPServers []MCPServer `json:"mcpServers"`
}
NewSessionRequest: Request parameters for creating a new session.
See protocol docs: [Creating a Session](https://agentclientprotocol.com/protocol/session-setup#creating-a-session)
func (NewSessionRequest) MarshalJSON ¶
func (r NewSessionRequest) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*NewSessionRequest) UnmarshalJSON ¶
func (r *NewSessionRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type NewSessionResponse ¶
type NewSessionResponse struct {
Meta Meta `json:"_meta,omitzero"`
ConfigOptions *[]SessionConfigOption `json:"configOptions,omitempty"`
Modes *SessionModeState `json:"modes,omitempty"`
SessionID SessionID `json:"sessionId"`
}
NewSessionResponse: Response from creating a new session.
See protocol docs: [Creating a Session](https://agentclientprotocol.com/protocol/session-setup#creating-a-session)
func (*NewSessionResponse) UnmarshalJSON ¶
func (r *NewSessionResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type NumberPropertySchema ¶
type NumberPropertySchema struct {
Meta Meta `json:"_meta,omitzero"`
Default *float64 `json:"default,omitempty"`
Description *string `json:"description,omitempty"`
Maximum *float64 `json:"maximum,omitempty"`
Minimum *float64 `json:"minimum,omitempty"`
Title *string `json:"title,omitempty"`
}
NumberPropertySchema: Schema for number (floating-point) properties in an elicitation form.
func (*NumberPropertySchema) UnmarshalJSON ¶
func (s *NumberPropertySchema) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type Option ¶
type Option func(*connConfig) error
Option configures a Conn.
func WithLogger ¶
WithLogger enables structured runtime diagnostics. Protocol payloads are never logged.
func WithMaxBufferedBytes ¶
WithMaxBufferedBytes bounds payloads retained by active inbound handlers and the notification queue. It must be at least the maximum frame size.
func WithMaxConcurrentRequests ¶
WithMaxConcurrentRequests sets the maximum number of active inbound requests.
func WithMaxFrameBytes ¶
WithMaxFrameBytes sets the maximum NDJSON frame size, including the trailing newline on writes.
func WithNotificationBacklog ¶
WithNotificationBacklog sets the maximum number of queued notifications.
type PermissionOption ¶
type PermissionOption struct {
Meta Meta `json:"_meta,omitzero"`
Kind PermissionOptionKind `json:"kind"`
Name string `json:"name"`
OptionID PermissionOptionID `json:"optionId"`
}
PermissionOption: An option presented to the user when requesting permission.
func (*PermissionOption) UnmarshalJSON ¶
func (o *PermissionOption) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type PermissionOptionID ¶
type PermissionOptionID string
PermissionOptionID: Unique identifier for a permission option.
type PermissionOptionKind ¶
type PermissionOptionKind string
PermissionOptionKind: The type of permission option being presented to the user.
Helps clients choose appropriate icons and UI treatment.
const ( // PermissionOptionKindAllowOnce: Allow this operation only this time. PermissionOptionKindAllowOnce PermissionOptionKind = "allow_once" // PermissionOptionKindAllowAlways: Allow this operation and remember the choice. PermissionOptionKindAllowAlways PermissionOptionKind = "allow_always" // PermissionOptionKindRejectOnce: Reject this operation only this time. PermissionOptionKindRejectOnce PermissionOptionKind = "reject_once" // PermissionOptionKindRejectAlways: Reject this operation and remember the choice. PermissionOptionKindRejectAlways PermissionOptionKind = "reject_always" )
func (*PermissionOptionKind) UnmarshalJSON ¶
func (k *PermissionOptionKind) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type Plan ¶
Plan: An execution plan for accomplishing complex tasks.
Plans consist of multiple entries representing individual tasks or goals. Agents report plans to clients to provide visibility into their execution strategy. Plans can evolve during execution as the agent discovers new requirements or completes tasks.
See protocol docs: [Agent Plan](https://agentclientprotocol.com/protocol/agent-plan)
func (Plan) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (*Plan) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type PlanEntry ¶
type PlanEntry struct {
Meta Meta `json:"_meta,omitzero"`
Content string `json:"content"`
Priority PlanEntryPriority `json:"priority"`
Status PlanEntryStatus `json:"status"`
}
PlanEntry: A single entry in the execution plan.
Represents a task or goal that the assistant intends to accomplish as part of fulfilling the user's request. See protocol docs: [Plan Entries](https://agentclientprotocol.com/protocol/agent-plan#plan-entries)
func (*PlanEntry) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type PlanEntryPriority ¶
type PlanEntryPriority string
PlanEntryPriority: Priority levels for plan entries.
Used to indicate the relative importance or urgency of different tasks in the execution plan. See protocol docs: [Plan Entries](https://agentclientprotocol.com/protocol/agent-plan#plan-entries)
const ( // PlanEntryPriorityHigh: High priority task - critical to the overall goal. PlanEntryPriorityHigh PlanEntryPriority = "high" // PlanEntryPriorityMedium: Medium priority task - important but not critical. PlanEntryPriorityMedium PlanEntryPriority = "medium" // PlanEntryPriorityLow: Low priority task - nice to have but not essential. PlanEntryPriorityLow PlanEntryPriority = "low" )
func (*PlanEntryPriority) UnmarshalJSON ¶
func (p *PlanEntryPriority) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type PlanEntryStatus ¶
type PlanEntryStatus string
PlanEntryStatus: Status of a plan entry in the execution flow.
Tracks the lifecycle of each task from planning through completion. See protocol docs: [Plan Entries](https://agentclientprotocol.com/protocol/agent-plan#plan-entries)
const ( // PlanEntryStatusPending: The task has not started yet. PlanEntryStatusPending PlanEntryStatus = "pending" // PlanEntryStatusInProgress: The task is currently being worked on. PlanEntryStatusInProgress PlanEntryStatus = "in_progress" // PlanEntryStatusCompleted: The task has been successfully completed. PlanEntryStatusCompleted PlanEntryStatus = "completed" )
func (*PlanEntryStatus) UnmarshalJSON ¶
func (s *PlanEntryStatus) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type PromptCapabilities ¶
type PromptCapabilities struct {
Meta Meta `json:"_meta,omitzero"`
Audio bool `json:"audio,omitempty"`
EmbeddedContext bool `json:"embeddedContext,omitempty"`
Image bool `json:"image,omitempty"`
}
PromptCapabilities: Prompt capabilities supported by the agent in `session/prompt` requests.
Baseline agent functionality requires support for [`ContentBlock::Text`] and [`ContentBlock::ResourceLink`] in prompt requests.
Other variants must be explicitly opted in to. Capabilities for different types of content in prompt requests.
Indicates which content types beyond the baseline (text and resource links) the agent can process.
See protocol docs: [Prompt Capabilities](https://agentclientprotocol.com/protocol/initialization#prompt-capabilities)
func (*PromptCapabilities) UnmarshalJSON ¶
func (c *PromptCapabilities) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type PromptRequest ¶
type PromptRequest struct {
Meta Meta `json:"_meta,omitzero"`
Prompt []ContentBlock `json:"prompt"`
SessionID SessionID `json:"sessionId"`
}
PromptRequest: Request parameters for sending a user prompt to the agent.
Contains the user's message and any additional context.
See protocol docs: [User Message](https://agentclientprotocol.com/protocol/prompt-turn#1-user-message)
func (PromptRequest) MarshalJSON ¶
func (r PromptRequest) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
type PromptResponse ¶
type PromptResponse struct {
Meta Meta `json:"_meta,omitzero"`
StopReason StopReason `json:"stopReason"`
// Usage is unstable but already emitted by agents; retaining it prevents
// clients from silently losing per-turn token accounting.
Usage *Usage `json:"usage,omitempty"`
}
PromptResponse: Response from processing a user prompt.
See protocol docs: [Check for Completion](https://agentclientprotocol.com/protocol/prompt-turn#4-check-for-completion)
func (*PromptResponse) UnmarshalJSON ¶ added in v0.2.0
func (r *PromptResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ProtocolVersion ¶
type ProtocolVersion uint16
ProtocolVersion: Protocol version identifier.
This version is only bumped for breaking changes. Non-breaking changes should be introduced via capabilities.
const ProtocolVersionV1 ProtocolVersion = 1
ProtocolVersionV1 is the stable ACP wire protocol version implemented by this package.
type ReadTextFileHandler ¶
type ReadTextFileHandler interface {
ReadTextFile(context.Context, *ReadTextFileRequest) (*ReadTextFileResponse, error)
}
ReadTextFileHandler optionally reads text files for an agent.
type ReadTextFileRequest ¶
type ReadTextFileRequest struct {
Meta Meta `json:"_meta,omitzero"`
Limit *uint32 `json:"limit,omitempty"`
Line *uint32 `json:"line,omitempty"`
Path string `json:"path"`
SessionID SessionID `json:"sessionId"`
}
ReadTextFileRequest: Request to read content from a text file.
Only available if the client supports the `fs.readTextFile` capability.
func (*ReadTextFileRequest) UnmarshalJSON ¶
func (r *ReadTextFileRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ReadTextFileResponse ¶
type ReadTextFileResponse struct {
Meta Meta `json:"_meta,omitzero"`
Content string `json:"content"`
}
ReadTextFileResponse: Response containing the contents of a text file.
type ReleaseTerminalRequest ¶
type ReleaseTerminalRequest struct {
Meta Meta `json:"_meta,omitzero"`
SessionID SessionID `json:"sessionId"`
TerminalID TerminalID `json:"terminalId"`
}
ReleaseTerminalRequest: Request to release a terminal and free its resources.
type ReleaseTerminalResponse ¶
type ReleaseTerminalResponse struct {
Meta Meta `json:"_meta,omitzero"`
}
ReleaseTerminalResponse: Response to terminal/release method
type RequestID ¶
type RequestID = json.RawMessage
RequestID: JSON RPC Request Id
An 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\]
The 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.
\[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.
\[2\] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions.
type RequestPermissionOutcome ¶
type RequestPermissionOutcome struct {
Outcome RequestPermissionOutcomeType `json:"outcome"`
Meta Meta `json:"_meta,omitzero"`
OptionID PermissionOptionID `json:"optionId,omitempty"`
}
RequestPermissionOutcome: The outcome of a permission request.
func CanceledRequestPermissionOutcome ¶
func CanceledRequestPermissionOutcome() RequestPermissionOutcome
CanceledRequestPermissionOutcome creates an RequestPermissionOutcome variant: The prompt turn was cancelled before the user responded.
When a client sends a `session/cancel` notification to cancel an ongoing prompt turn, it MUST respond to all pending `session/request_permission` requests with this `Cancelled` outcome.
See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/prompt-turn#cancellation)
func SelectedRequestPermissionOutcome ¶
func SelectedRequestPermissionOutcome(optionID PermissionOptionID) RequestPermissionOutcome
SelectedRequestPermissionOutcome creates an RequestPermissionOutcome variant: The user selected one of the provided options.
func (RequestPermissionOutcome) MarshalJSON ¶
func (o RequestPermissionOutcome) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*RequestPermissionOutcome) UnmarshalJSON ¶
func (o *RequestPermissionOutcome) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type RequestPermissionOutcomeType ¶
type RequestPermissionOutcomeType string
RequestPermissionOutcomeType is the discriminator for RequestPermissionOutcome variants.
const ( RequestPermissionOutcomeTypeCanceled RequestPermissionOutcomeType = "cancelled" RequestPermissionOutcomeTypeSelected RequestPermissionOutcomeType = "selected" )
func (*RequestPermissionOutcomeType) UnmarshalJSON ¶
func (t *RequestPermissionOutcomeType) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type RequestPermissionRequest ¶
type RequestPermissionRequest struct {
Meta Meta `json:"_meta,omitzero"`
Options []PermissionOption `json:"options"`
SessionID SessionID `json:"sessionId"`
ToolCall ToolCallUpdate `json:"toolCall"`
}
RequestPermissionRequest: Request for user permission to execute a tool call.
Sent when the agent needs authorization before performing a sensitive operation.
See protocol docs: [Requesting Permission](https://agentclientprotocol.com/protocol/tool-calls#requesting-permission)
func (RequestPermissionRequest) MarshalJSON ¶
func (r RequestPermissionRequest) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
type RequestPermissionResponse ¶
type RequestPermissionResponse struct {
Meta Meta `json:"_meta,omitzero"`
Outcome RequestPermissionOutcome `json:"outcome"`
}
RequestPermissionResponse: Response to a permission request.
type ResourceLink ¶
type ResourceLink struct {
Meta Meta `json:"_meta,omitzero"`
Annotations *Annotations `json:"annotations,omitempty"`
Description *string `json:"description,omitempty"`
MIMEType *string `json:"mimeType,omitempty"`
Name string `json:"name"`
Size *int64 `json:"size,omitempty"`
Title *string `json:"title,omitempty"`
URI string `json:"uri"`
}
ResourceLink: A resource that the server is capable of reading, included in a prompt or tool call result.
func (*ResourceLink) UnmarshalJSON ¶
func (l *ResourceLink) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ResumeSessionHandler ¶
type ResumeSessionHandler interface {
ResumeSession(context.Context, *ResumeSessionRequest) (*ResumeSessionResponse, error)
}
ResumeSessionHandler optionally resumes a session.
type ResumeSessionRequest ¶
type ResumeSessionRequest struct {
Meta Meta `json:"_meta,omitzero"`
AdditionalDirectories []string `json:"additionalDirectories,omitempty"`
Cwd string `json:"cwd"`
MCPServers []MCPServer `json:"mcpServers,omitempty"`
SessionID SessionID `json:"sessionId"`
}
ResumeSessionRequest: Request parameters for resuming an existing session.
Resumes an existing session without returning previous messages (unlike `session/load`). This is useful for agents that can resume sessions but don't implement full session loading.
Only available if the Agent supports the `sessionCapabilities.resume` capability.
func (*ResumeSessionRequest) UnmarshalJSON ¶
func (r *ResumeSessionRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ResumeSessionResponse ¶
type ResumeSessionResponse struct {
Meta Meta `json:"_meta,omitzero"`
ConfigOptions *[]SessionConfigOption `json:"configOptions,omitempty"`
Modes *SessionModeState `json:"modes,omitempty"`
}
ResumeSessionResponse: Response from resuming an existing session.
func (*ResumeSessionResponse) UnmarshalJSON ¶
func (r *ResumeSessionResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type Role ¶
type Role string
Role: The sender or recipient of messages and data in a conversation.
func (*Role) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type SelectedPermissionOutcome ¶
type SelectedPermissionOutcome struct {
Meta Meta `json:"_meta,omitzero"`
OptionID PermissionOptionID `json:"optionId"`
}
SelectedPermissionOutcome: The user selected one of the provided options.
type SessionAdditionalDirectoriesCapabilities ¶
type SessionAdditionalDirectoriesCapabilities struct {
Meta Meta `json:"_meta,omitzero"`
}
SessionAdditionalDirectoriesCapabilities: Capabilities for additional session directories support.
Supplying `{}` means the agent supports the `additionalDirectories` field on supported session lifecycle requests. Agents that also support `session/list` may return `SessionInfo.additionalDirectories` to report the complete ordered additional-root list associated with a listed session.
type SessionCapabilities ¶
type SessionCapabilities struct {
Meta Meta `json:"_meta,omitzero"`
AdditionalDirectories *SessionAdditionalDirectoriesCapabilities `json:"additionalDirectories,omitempty"`
Close *SessionCloseCapabilities `json:"close,omitempty"`
Delete *SessionDeleteCapabilities `json:"delete,omitempty"`
List *SessionListCapabilities `json:"list,omitempty"`
Resume *SessionResumeCapabilities `json:"resume,omitempty"`
}
SessionCapabilities: Session capabilities supported by the agent.
As a baseline, all Agents **MUST** support `session/new`, `session/prompt`, `session/cancel`, and `session/update`.
Optionally, they **MAY** support other session methods and notifications by specifying additional capabilities.
Note: `session/load` is still handled by the top-level `load_session` capability. This will be unified in future versions of the protocol.
See protocol docs: [Session Capabilities](https://agentclientprotocol.com/protocol/initialization#session-capabilities)
func (*SessionCapabilities) UnmarshalJSON ¶
func (c *SessionCapabilities) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type SessionCloseCapabilities ¶
type SessionCloseCapabilities struct {
Meta Meta `json:"_meta,omitzero"`
}
SessionCloseCapabilities: Capabilities for the `session/close` method.
Supplying `{}` means the agent supports closing sessions.
type SessionConfigBoolean ¶
type SessionConfigBoolean struct {
CurrentValue bool `json:"currentValue"`
}
SessionConfigBoolean: A boolean on/off toggle session configuration option payload.
type SessionConfigGroupID ¶
type SessionConfigGroupID string
SessionConfigGroupID: Unique identifier for a session configuration option value group.
type SessionConfigID ¶
type SessionConfigID string
SessionConfigID: Unique identifier for a session configuration option.
type SessionConfigOption ¶
type SessionConfigOption struct {
Type SessionConfigOptionType `json:"type"`
Meta Meta `json:"_meta,omitzero"`
Category *SessionConfigOptionCategory `json:"category,omitempty"`
CurrentValue any `json:"currentValue"`
Description *string `json:"description,omitempty"`
ID SessionConfigID `json:"id"`
Name string `json:"name"`
Options SessionConfigSelectOptions `json:"options,omitzero"`
}
SessionConfigOption: A session configuration option selector and its current state.
func BooleanSessionConfigOption ¶
func BooleanSessionConfigOption(id SessionConfigID, name string, currentValue bool) SessionConfigOption
BooleanSessionConfigOption creates an SessionConfigOption variant: Boolean on/off toggle.
func SelectSessionConfigOption ¶
func SelectSessionConfigOption(id SessionConfigID, name string, currentValue SessionConfigValueID, options SessionConfigSelectOptions) SessionConfigOption
SelectSessionConfigOption creates an SessionConfigOption variant: Single-value selector (dropdown).
func (SessionConfigOption) MarshalJSON ¶
func (o SessionConfigOption) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*SessionConfigOption) UnmarshalJSON ¶
func (o *SessionConfigOption) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type SessionConfigOptionCategory ¶
type SessionConfigOptionCategory string
SessionConfigOptionCategory: Semantic category for a session configuration option.
This is intended to help Clients distinguish broadly common selectors (e.g. model selector vs session mode selector vs thought/reasoning level) for UX purposes (keyboard shortcuts, icons, placement). It MUST NOT be required for correctness. Clients MUST handle missing or unknown categories gracefully.
Category names beginning with `_` are free for custom use, like other ACP extension methods. Category names that do not begin with `_` are reserved for the ACP spec.
const ( // SessionConfigOptionCategoryMode: Session mode selector. SessionConfigOptionCategoryMode SessionConfigOptionCategory = "mode" // SessionConfigOptionCategoryModel: Model selector. SessionConfigOptionCategoryModel SessionConfigOptionCategory = "model" // SessionConfigOptionCategoryModelConfig: Model-related configuration parameter. SessionConfigOptionCategoryModelConfig SessionConfigOptionCategory = "model_config" // SessionConfigOptionCategoryThoughtLevel: Thought/reasoning level selector. SessionConfigOptionCategoryThoughtLevel SessionConfigOptionCategory = "thought_level" )
type SessionConfigOptionType ¶
type SessionConfigOptionType string
SessionConfigOptionType is the discriminator for SessionConfigOption variants.
const ( SessionConfigOptionTypeSelect SessionConfigOptionType = "select" SessionConfigOptionTypeBoolean SessionConfigOptionType = "boolean" )
func (*SessionConfigOptionType) UnmarshalJSON ¶
func (t *SessionConfigOptionType) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type SessionConfigOptionsCapabilities ¶
type SessionConfigOptionsCapabilities struct {
Meta Meta `json:"_meta,omitzero"`
Boolean *BooleanConfigOptionCapabilities `json:"boolean,omitempty"`
}
SessionConfigOptionsCapabilities: Session configuration option capabilities supported by the client.
func (*SessionConfigOptionsCapabilities) UnmarshalJSON ¶
func (c *SessionConfigOptionsCapabilities) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type SessionConfigSelect ¶
type SessionConfigSelect struct {
CurrentValue SessionConfigValueID `json:"currentValue"`
Options SessionConfigSelectOptions `json:"options"`
}
SessionConfigSelect: A single-value selector (dropdown) session configuration option payload.
func (SessionConfigSelect) MarshalJSON ¶
func (s SessionConfigSelect) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
type SessionConfigSelectGroup ¶
type SessionConfigSelectGroup struct {
Meta Meta `json:"_meta,omitzero"`
Group SessionConfigGroupID `json:"group"`
Name string `json:"name"`
Options []SessionConfigSelectOption `json:"options"`
}
SessionConfigSelectGroup: A group of possible values for a session configuration option.
func (SessionConfigSelectGroup) MarshalJSON ¶
func (g SessionConfigSelectGroup) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*SessionConfigSelectGroup) UnmarshalJSON ¶
func (g *SessionConfigSelectGroup) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type SessionConfigSelectOption ¶
type SessionConfigSelectOption struct {
Meta Meta `json:"_meta,omitzero"`
Description *string `json:"description,omitempty"`
Name string `json:"name"`
Value SessionConfigValueID `json:"value"`
}
SessionConfigSelectOption: A possible value for a session configuration option.
func (*SessionConfigSelectOption) UnmarshalJSON ¶
func (o *SessionConfigSelectOption) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type SessionConfigSelectOptions ¶
type SessionConfigSelectOptions struct {
Ungrouped *UngroupedSessionConfigSelectOptions
Groups *GroupedSessionConfigSelectOptions
}
SessionConfigSelectOptions: Possible values for a session configuration option.
func (SessionConfigSelectOptions) MarshalJSON ¶
func (o SessionConfigSelectOptions) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*SessionConfigSelectOptions) UnmarshalJSON ¶
func (o *SessionConfigSelectOptions) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type SessionConfigValueID ¶
type SessionConfigValueID string
SessionConfigValueID: Unique identifier for a session configuration option value.
type SessionDeleteCapabilities ¶
type SessionDeleteCapabilities struct {
Meta Meta `json:"_meta,omitzero"`
}
SessionDeleteCapabilities: Capabilities for the `session/delete` method.
Supplying `{}` means the agent supports deleting sessions from `session/list`.
type SessionID ¶
type SessionID string
SessionID: A unique identifier for a conversation session between a client and agent.
Sessions maintain their own context, conversation history, and state, allowing multiple independent interactions with the same agent.
See protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)
type SessionInfo ¶
type SessionInfo struct {
Meta Meta `json:"_meta,omitzero"`
AdditionalDirectories []string `json:"additionalDirectories,omitempty"`
Cwd string `json:"cwd"`
SessionID SessionID `json:"sessionId"`
Title *string `json:"title,omitempty"`
UpdatedAt *string `json:"updatedAt,omitempty"`
}
SessionInfo: Information about a session returned by session/list
func (*SessionInfo) UnmarshalJSON ¶
func (i *SessionInfo) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type SessionInfoUpdate ¶
type SessionInfoUpdate struct {
Meta Meta `json:"_meta,omitzero"`
Title *string `json:"title,omitempty"`
UpdatedAt *string `json:"updatedAt,omitempty"`
}
SessionInfoUpdate: Update to session metadata. All fields are optional to support partial updates.
Agents send this notification to update session information like title or custom metadata. This allows clients to display dynamic session names and track session state changes.
func (*SessionInfoUpdate) UnmarshalJSON ¶
func (u *SessionInfoUpdate) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type SessionListCapabilities ¶
type SessionListCapabilities struct {
Meta Meta `json:"_meta,omitzero"`
}
SessionListCapabilities: Capabilities for the `session/list` method.
Supplying `{}` means the agent supports listing sessions.
type SessionMode ¶
type SessionMode struct {
Meta Meta `json:"_meta,omitzero"`
Description *string `json:"description,omitempty"`
ID SessionModeID `json:"id"`
Name string `json:"name"`
}
SessionMode: A mode the agent can operate in.
See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)
func (*SessionMode) UnmarshalJSON ¶
func (m *SessionMode) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type SessionModeState ¶
type SessionModeState struct {
Meta Meta `json:"_meta,omitzero"`
AvailableModes []SessionMode `json:"availableModes"`
CurrentModeID SessionModeID `json:"currentModeId"`
}
SessionModeState: The set of modes and the one currently active.
func (SessionModeState) MarshalJSON ¶
func (s SessionModeState) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*SessionModeState) UnmarshalJSON ¶
func (s *SessionModeState) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type SessionNotification ¶
type SessionNotification struct {
Meta Meta `json:"_meta,omitzero"`
SessionID SessionID `json:"sessionId"`
Update SessionUpdate `json:"update"`
}
SessionNotification: Notification containing a session update from the agent.
Used to stream real-time progress and results during prompt processing.
See protocol docs: [Agent Reports Output](https://agentclientprotocol.com/protocol/prompt-turn#3-agent-reports-output)
type SessionResumeCapabilities ¶
type SessionResumeCapabilities struct {
Meta Meta `json:"_meta,omitzero"`
}
SessionResumeCapabilities: Capabilities for the `session/resume` method.
Supplying `{}` means the agent supports resuming sessions.
type SessionUpdate ¶
type SessionUpdate struct {
SessionUpdate SessionUpdateType `json:"sessionUpdate"`
Meta Meta `json:"_meta,omitzero"`
AvailableCommands []AvailableCommand `json:"availableCommands,omitempty"`
ConfigOptions []SessionConfigOption `json:"configOptions,omitempty"`
Content any `json:"content,omitempty,omitzero"`
Cost *Cost `json:"cost,omitempty"`
CurrentModeID SessionModeID `json:"currentModeId,omitempty"`
Entries []PlanEntry `json:"entries,omitempty"`
Kind *ToolKind `json:"kind,omitempty"`
Locations *[]ToolCallLocation `json:"locations,omitempty"`
MessageID *MessageID `json:"messageId,omitempty"`
RawInput any `json:"rawInput,omitempty"`
RawOutput any `json:"rawOutput,omitempty"`
Size uint64 `json:"size,omitempty"`
Status *ToolCallStatus `json:"status,omitempty"`
Title *string `json:"title,omitempty"`
ToolCallID ToolCallID `json:"toolCallId,omitempty"`
UpdatedAt *string `json:"updatedAt,omitempty"`
Used uint64 `json:"used,omitempty"`
}
SessionUpdate: Different types of updates that can be sent during session processing.
These updates provide real-time feedback about the agent's progress.
See protocol docs: [Agent Reports Output](https://agentclientprotocol.com/protocol/prompt-turn#3-agent-reports-output)
func AgentMessageChunkSessionUpdate ¶
func AgentMessageChunkSessionUpdate(content ContentBlock) SessionUpdate
AgentMessageChunkSessionUpdate creates an SessionUpdate variant: A chunk of the agent's response being streamed.
func AgentThoughtChunkSessionUpdate ¶
func AgentThoughtChunkSessionUpdate(content ContentBlock) SessionUpdate
AgentThoughtChunkSessionUpdate creates an SessionUpdate variant: A chunk of the agent's internal reasoning being streamed.
func AvailableCommandsUpdateSessionUpdate ¶
func AvailableCommandsUpdateSessionUpdate(availableCommands []AvailableCommand) SessionUpdate
AvailableCommandsUpdateSessionUpdate creates an SessionUpdate variant: Available commands are ready or have changed
func ConfigOptionUpdateSessionUpdate ¶
func ConfigOptionUpdateSessionUpdate(configOptions []SessionConfigOption) SessionUpdate
ConfigOptionUpdateSessionUpdate creates an SessionUpdate variant: Session configuration options have been updated.
func CurrentModeUpdateSessionUpdate ¶
func CurrentModeUpdateSessionUpdate(currentModeID SessionModeID) SessionUpdate
CurrentModeUpdateSessionUpdate creates an SessionUpdate variant: The current mode of the session has changed
See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)
func PlanSessionUpdate ¶
func PlanSessionUpdate(entries []PlanEntry) SessionUpdate
PlanSessionUpdate creates an SessionUpdate variant: The agent's execution plan for complex tasks. See protocol docs: [Agent Plan](https://agentclientprotocol.com/protocol/agent-plan)
func SessionInfoSessionUpdate ¶
func SessionInfoSessionUpdate() SessionUpdate
SessionInfoSessionUpdate creates an SessionUpdate variant: Session metadata has been updated (title, timestamps, custom metadata)
func ToolCallSessionUpdate ¶
func ToolCallSessionUpdate(toolCallID ToolCallID, title string) SessionUpdate
ToolCallSessionUpdate creates an SessionUpdate variant: Notification that a new tool call has been initiated.
func ToolCallUpdateSessionUpdate ¶
func ToolCallUpdateSessionUpdate(toolCallID ToolCallID) SessionUpdate
ToolCallUpdateSessionUpdate creates an SessionUpdate variant: Update on the status or results of a tool call.
func UsageUpdateSessionUpdate ¶
func UsageUpdateSessionUpdate(used uint64, size uint64) SessionUpdate
UsageUpdateSessionUpdate creates an SessionUpdate variant: Context window and cost update for the session.
func UserMessageChunkSessionUpdate ¶
func UserMessageChunkSessionUpdate(content ContentBlock) SessionUpdate
UserMessageChunkSessionUpdate creates an SessionUpdate variant: A chunk of the user's message being streamed.
func (SessionUpdate) MarshalJSON ¶
func (u SessionUpdate) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*SessionUpdate) UnmarshalJSON ¶
func (u *SessionUpdate) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type SessionUpdateType ¶
type SessionUpdateType string
SessionUpdateType is the discriminator for SessionUpdate variants.
const ( SessionUpdateTypeUserMessageChunk SessionUpdateType = "user_message_chunk" SessionUpdateTypeAgentMessageChunk SessionUpdateType = "agent_message_chunk" SessionUpdateTypeAgentThoughtChunk SessionUpdateType = "agent_thought_chunk" SessionUpdateTypeToolCall SessionUpdateType = "tool_call" SessionUpdateTypeToolCallUpdate SessionUpdateType = "tool_call_update" SessionUpdateTypePlan SessionUpdateType = "plan" SessionUpdateTypeAvailableCommandsUpdate SessionUpdateType = "available_commands_update" SessionUpdateTypeCurrentModeUpdate SessionUpdateType = "current_mode_update" SessionUpdateTypeConfigOptionUpdate SessionUpdateType = "config_option_update" SessionUpdateTypeSessionInfoUpdate SessionUpdateType = "session_info_update" SessionUpdateTypeUsageUpdate SessionUpdateType = "usage_update" )
func (*SessionUpdateType) UnmarshalJSON ¶
func (t *SessionUpdateType) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type SetSessionConfigOptionHandler ¶
type SetSessionConfigOptionHandler interface {
SetSessionConfigOption(context.Context, *SetSessionConfigOptionRequest) (*SetSessionConfigOptionResponse, error)
}
SetSessionConfigOptionHandler optionally changes a session configuration.
type SetSessionConfigOptionRequest ¶
type SetSessionConfigOptionRequest struct {
Type SetSessionConfigOptionRequestType `json:"type,omitempty"`
Meta Meta `json:"_meta,omitzero"`
ConfigID SessionConfigID `json:"configId"`
SessionID SessionID `json:"sessionId"`
Value any `json:"value"`
}
SetSessionConfigOptionRequest: Request parameters for setting a session configuration option.
func BooleanSetSessionConfigOptionRequest ¶
func BooleanSetSessionConfigOptionRequest(sessionID SessionID, configID SessionConfigID, value bool) SetSessionConfigOptionRequest
BooleanSetSessionConfigOptionRequest creates a boolean value (`type: "boolean"`).
func ValueIDSetSessionConfigOptionRequest ¶
func ValueIDSetSessionConfigOptionRequest(sessionID SessionID, configID SessionConfigID, value SessionConfigValueID) SetSessionConfigOptionRequest
ValueIDSetSessionConfigOptionRequest creates a [`SessionConfigValueID`] string value.
This is the default when `type` is absent on the wire. Unknown `type` values with string payloads also gracefully deserialize into this variant.
func (*SetSessionConfigOptionRequest) UnmarshalJSON ¶
func (r *SetSessionConfigOptionRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type SetSessionConfigOptionRequestType ¶
type SetSessionConfigOptionRequestType string
SetSessionConfigOptionRequestType is the discriminator for SetSessionConfigOptionRequest variants.
const (
SetSessionConfigOptionRequestTypeBoolean SetSessionConfigOptionRequestType = "boolean"
)
type SetSessionConfigOptionResponse ¶
type SetSessionConfigOptionResponse struct {
Meta Meta `json:"_meta,omitzero"`
ConfigOptions []SessionConfigOption `json:"configOptions"`
}
SetSessionConfigOptionResponse: Response to `session/set_config_option` method.
func (SetSessionConfigOptionResponse) MarshalJSON ¶
func (r SetSessionConfigOptionResponse) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*SetSessionConfigOptionResponse) UnmarshalJSON ¶
func (r *SetSessionConfigOptionResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type SetSessionModeHandler ¶
type SetSessionModeHandler interface {
SetSessionMode(context.Context, *SetSessionModeRequest) (*SetSessionModeResponse, error)
}
SetSessionModeHandler optionally changes a session mode.
type SetSessionModeRequest ¶
type SetSessionModeRequest struct {
Meta Meta `json:"_meta,omitzero"`
ModeID SessionModeID `json:"modeId"`
SessionID SessionID `json:"sessionId"`
}
SetSessionModeRequest: Request parameters for setting a session mode.
type SetSessionModeResponse ¶
type SetSessionModeResponse struct {
Meta Meta `json:"_meta,omitzero"`
}
SetSessionModeResponse: Response to `session/set_mode` method.
type StopReason ¶
type StopReason string
StopReason: Reasons why an agent stops processing a prompt turn.
See protocol docs: [Stop Reasons](https://agentclientprotocol.com/protocol/prompt-turn#stop-reasons)
const ( // StopReasonEndTurn: The turn ended successfully. StopReasonEndTurn StopReason = "end_turn" // StopReasonMaxTokens: The turn ended because the agent reached the maximum number of tokens. StopReasonMaxTokens StopReason = "max_tokens" // StopReasonMaxTurnRequests: The turn ended because the agent reached the maximum number of allowed // agent requests between user turns. StopReasonMaxTurnRequests StopReason = "max_turn_requests" // StopReasonRefusal: The turn ended because the agent refused to continue. The user prompt // and everything that comes after it won't be included in the next // prompt, so this should be reflected in the UI. StopReasonRefusal StopReason = "refusal" // StopReasonCanceled: The turn was cancelled by the client via `session/cancel`. // // This stop reason MUST be returned when the client sends a `session/cancel` // notification, even if the cancellation causes exceptions in underlying operations. // Agents should catch these exceptions and return this semantically meaningful // response to confirm successful cancellation. StopReasonCanceled StopReason = "cancelled" )
func (*StopReason) UnmarshalJSON ¶
func (r *StopReason) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type StringFormat ¶
type StringFormat string
StringFormat: String format types for string properties in elicitation schemas.
const ( // StringFormatEmail: Email address format. StringFormatEmail StringFormat = "email" // StringFormatURI: URI format. StringFormatURI StringFormat = "uri" // StringFormatDate: Date format (YYYY-MM-DD). StringFormatDate StringFormat = "date" // StringFormatDateTime: Date-time format (ISO 8601). StringFormatDateTime StringFormat = "date-time" )
func (*StringFormat) UnmarshalJSON ¶
func (f *StringFormat) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type StringMultiSelectItems ¶
type StringMultiSelectItems struct {
Meta Meta `json:"_meta,omitzero"`
Enum []string `json:"enum"`
}
StringMultiSelectItems: String item schema for multi-select enum properties.
func (StringMultiSelectItems) MarshalJSON ¶
func (i StringMultiSelectItems) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*StringMultiSelectItems) UnmarshalJSON ¶
func (i *StringMultiSelectItems) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type StringPropertySchema ¶
type StringPropertySchema struct {
Meta Meta `json:"_meta,omitzero"`
Default *string `json:"default,omitempty"`
Description *string `json:"description,omitempty"`
Enum *[]string `json:"enum,omitempty"`
Format *StringFormat `json:"format,omitempty"`
MaxLength *uint32 `json:"maxLength,omitempty"`
MinLength *uint32 `json:"minLength,omitempty"`
OneOf *[]EnumOption `json:"oneOf,omitempty"`
Pattern *string `json:"pattern,omitempty"`
Title *string `json:"title,omitempty"`
}
StringPropertySchema: Schema for string properties in an elicitation form.
When `enum` or `oneOf` is set, this represents a single-select enum with `"type": "string"`.
func (*StringPropertySchema) UnmarshalJSON ¶
func (s *StringPropertySchema) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type Terminal ¶
type Terminal struct {
Meta Meta `json:"_meta,omitzero"`
TerminalID TerminalID `json:"terminalId"`
}
Terminal: Embed a terminal created with `terminal/create` by its id.
The terminal must be added before calling `terminal/release`.
See protocol docs: Terminal(https://agentclientprotocol.com/protocol/terminals)
type TerminalExitStatus ¶
type TerminalExitStatus struct {
Meta Meta `json:"_meta,omitzero"`
ExitCode *uint32 `json:"exitCode,omitempty"`
Signal *string `json:"signal,omitempty"`
}
TerminalExitStatus: Exit status of a terminal command.
func (*TerminalExitStatus) UnmarshalJSON ¶
func (s *TerminalExitStatus) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type TerminalHandler ¶
type TerminalHandler interface {
CreateTerminal(context.Context, *CreateTerminalRequest) (*CreateTerminalResponse, error)
TerminalOutput(context.Context, *TerminalOutputRequest) (*TerminalOutputResponse, error)
ReleaseTerminal(context.Context, *ReleaseTerminalRequest) (*ReleaseTerminalResponse, error)
WaitForTerminalExit(context.Context, *WaitForTerminalExitRequest) (*WaitForTerminalExitResponse, error)
KillTerminal(context.Context, *KillTerminalRequest) (*KillTerminalResponse, error)
}
TerminalHandler implements the complete ACP terminal capability.
type TerminalID ¶
type TerminalID string
TerminalID: Typed identifier used for terminal values on the wire.
type TerminalOutputRequest ¶
type TerminalOutputRequest struct {
Meta Meta `json:"_meta,omitzero"`
SessionID SessionID `json:"sessionId"`
TerminalID TerminalID `json:"terminalId"`
}
TerminalOutputRequest: Request to get the current output and status of a terminal.
type TerminalOutputResponse ¶
type TerminalOutputResponse struct {
Meta Meta `json:"_meta,omitzero"`
ExitStatus *TerminalExitStatus `json:"exitStatus,omitempty"`
Output string `json:"output"`
Truncated bool `json:"truncated"`
}
TerminalOutputResponse: Response containing the terminal output and exit status.
func (*TerminalOutputResponse) UnmarshalJSON ¶
func (r *TerminalOutputResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type TextContent ¶
type TextContent struct {
Meta Meta `json:"_meta,omitzero"`
Annotations *Annotations `json:"annotations,omitempty"`
Text string `json:"text"`
}
TextContent: Text provided to or from an LLM.
func (*TextContent) UnmarshalJSON ¶
func (c *TextContent) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type TextResourceContents ¶
type TextResourceContents struct {
Meta Meta `json:"_meta,omitzero"`
MIMEType *string `json:"mimeType,omitempty"`
Text string `json:"text"`
URI string `json:"uri"`
}
TextResourceContents: Text-based resource contents.
func (*TextResourceContents) UnmarshalJSON ¶
func (c *TextResourceContents) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type TitledMultiSelectItems ¶
type TitledMultiSelectItems struct {
Meta Meta `json:"_meta,omitzero"`
AnyOf []EnumOption `json:"anyOf"`
}
TitledMultiSelectItems: Items definition for titled multi-select enum properties.
func (TitledMultiSelectItems) MarshalJSON ¶
func (i TitledMultiSelectItems) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*TitledMultiSelectItems) UnmarshalJSON ¶
func (i *TitledMultiSelectItems) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ToolCall ¶
type ToolCall struct {
Meta Meta `json:"_meta,omitzero"`
Content []ToolCallContent `json:"content,omitempty"`
Kind ToolKind `json:"kind,omitempty"`
Locations []ToolCallLocation `json:"locations,omitempty"`
RawInput any `json:"rawInput,omitempty"`
RawOutput any `json:"rawOutput,omitempty"`
Status ToolCallStatus `json:"status,omitempty"`
Title string `json:"title"`
ToolCallID ToolCallID `json:"toolCallId"`
}
ToolCall: Represents a tool call that the language model has requested.
Tool calls are actions that the agent executes on behalf of the language model, such as reading files, executing code, or fetching data from external sources.
See protocol docs: [Tool Calls](https://agentclientprotocol.com/protocol/tool-calls)
func (*ToolCall) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type ToolCallContent ¶
type ToolCallContent struct {
Type ToolCallContentType `json:"type"`
Meta Meta `json:"_meta,omitzero"`
Content ContentBlock `json:"content,omitzero"`
NewText string `json:"newText,omitempty"`
OldText *string `json:"oldText,omitempty"`
Path string `json:"path,omitempty"`
TerminalID TerminalID `json:"terminalId,omitempty"`
}
ToolCallContent: Content produced by a tool call.
Tool calls can produce different types of content including standard content blocks (text, images) or file diffs.
See protocol docs: Content(https://agentclientprotocol.com/protocol/tool-calls#content)
func ContentToolCallContent ¶
func ContentToolCallContent(content ContentBlock) ToolCallContent
ContentToolCallContent creates an ToolCallContent variant: Standard content block (text, images, resources).
func DiffToolCallContent ¶
func DiffToolCallContent(path string, newText string) ToolCallContent
DiffToolCallContent creates an ToolCallContent variant: File modification shown as a diff.
func TerminalToolCallContent ¶
func TerminalToolCallContent(terminalID TerminalID) ToolCallContent
TerminalToolCallContent creates an ToolCallContent variant: Embed a terminal created with `terminal/create` by its id.
The terminal must be added before calling `terminal/release`.
See protocol docs: Terminal(https://agentclientprotocol.com/protocol/terminals)
func (ToolCallContent) MarshalJSON ¶
func (c ToolCallContent) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*ToolCallContent) UnmarshalJSON ¶
func (c *ToolCallContent) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ToolCallContentType ¶
type ToolCallContentType string
ToolCallContentType is the discriminator for ToolCallContent variants.
const ( ToolCallContentTypeContent ToolCallContentType = "content" ToolCallContentTypeDiff ToolCallContentType = "diff" ToolCallContentTypeTerminal ToolCallContentType = "terminal" )
func (*ToolCallContentType) UnmarshalJSON ¶
func (t *ToolCallContentType) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ToolCallID ¶
type ToolCallID string
ToolCallID: Unique identifier for a tool call within a session.
type ToolCallLocation ¶
type ToolCallLocation struct {
Meta Meta `json:"_meta,omitzero"`
Line *uint32 `json:"line,omitempty"`
Path string `json:"path"`
}
ToolCallLocation: A file location being accessed or modified by a tool.
Enables clients to implement "follow-along" features that track which files the agent is working with in real-time.
See protocol docs: [Following the Agent](https://agentclientprotocol.com/protocol/tool-calls#following-the-agent)
func (*ToolCallLocation) UnmarshalJSON ¶
func (l *ToolCallLocation) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ToolCallStatus ¶
type ToolCallStatus string
ToolCallStatus: Execution status of a tool call.
Tool calls progress through different statuses during their lifecycle.
See protocol docs: [Status](https://agentclientprotocol.com/protocol/tool-calls#status)
const ( // ToolCallStatusPending: The tool call hasn't started running yet because the input is either // streaming or we're awaiting approval. ToolCallStatusPending ToolCallStatus = "pending" // ToolCallStatusInProgress: The tool call is currently running. ToolCallStatusInProgress ToolCallStatus = "in_progress" // ToolCallStatusCompleted: The tool call completed successfully. ToolCallStatusCompleted ToolCallStatus = "completed" // ToolCallStatusFailed: The tool call failed with an error. ToolCallStatusFailed ToolCallStatus = "failed" )
func (*ToolCallStatus) UnmarshalJSON ¶
func (s *ToolCallStatus) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ToolCallUpdate ¶
type ToolCallUpdate struct {
Meta Meta `json:"_meta,omitzero"`
Content *[]ToolCallContent `json:"content,omitempty"`
Kind *ToolKind `json:"kind,omitempty"`
Locations *[]ToolCallLocation `json:"locations,omitempty"`
RawInput any `json:"rawInput,omitempty"`
RawOutput any `json:"rawOutput,omitempty"`
Status *ToolCallStatus `json:"status,omitempty"`
Title *string `json:"title,omitempty"`
ToolCallID ToolCallID `json:"toolCallId"`
}
ToolCallUpdate: An update to an existing tool call.
Used to report progress and results as tools execute. All fields except the tool call ID are optional - only changed fields need to be included.
See protocol docs: [Updating](https://agentclientprotocol.com/protocol/tool-calls#updating)
func (*ToolCallUpdate) UnmarshalJSON ¶
func (u *ToolCallUpdate) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ToolKind ¶
type ToolKind string
ToolKind: Categories of tools that can be invoked.
Tool kinds help clients choose appropriate icons and optimize how they display tool execution progress.
See protocol docs: [Creating](https://agentclientprotocol.com/protocol/tool-calls#creating)
const ( // ToolKindRead: Reading files or data. ToolKindRead ToolKind = "read" // ToolKindEdit: Modifying files or content. ToolKindEdit ToolKind = "edit" // ToolKindDelete: Removing files or data. ToolKindDelete ToolKind = "delete" // ToolKindMove: Moving or renaming files. ToolKindMove ToolKind = "move" // ToolKindSearch: Searching for information. ToolKindSearch ToolKind = "search" // ToolKindExecute: Running commands or code. ToolKindExecute ToolKind = "execute" // ToolKindThink: Internal reasoning or planning. ToolKindThink ToolKind = "think" // ToolKindFetch: Retrieving external data. ToolKindFetch ToolKind = "fetch" // ToolKindSwitchMode: Switching the current session mode. ToolKindSwitchMode ToolKind = "switch_mode" // ToolKindOther: Other tool types (default). ToolKindOther ToolKind = "other" )
func (*ToolKind) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type UngroupedSessionConfigSelectOptions ¶
type UngroupedSessionConfigSelectOptions []SessionConfigSelectOption
UngroupedSessionConfigSelectOptions is the ungrouped variant of SessionConfigSelectOptions.
type UnstructuredCommandInput ¶
type UnstructuredCommandInput struct {
Meta Meta `json:"_meta,omitzero"`
Hint string `json:"hint"`
}
UnstructuredCommandInput: All text that was typed after the command name is provided as input.
type Usage ¶ added in v0.2.0
type Usage struct {
Meta Meta `json:"_meta,omitzero"`
TotalTokens uint64 `json:"totalTokens"`
InputTokens uint64 `json:"inputTokens"`
OutputTokens uint64 `json:"outputTokens"`
ThoughtTokens *uint64 `json:"thoughtTokens,omitempty"`
CachedReadTokens *uint64 `json:"cachedReadTokens,omitempty"`
CachedWriteTokens *uint64 `json:"cachedWriteTokens,omitempty"`
}
Usage is token usage for a prompt turn, from @agentclientprotocol/sdk v1.4.0 schema/schema.json. This extension is unstable and may change or be removed. Optional counters use pointers to distinguish unreported usage from zero.
func (*Usage) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON implements json.Unmarshaler.
type UsageUpdate ¶
type UsageUpdate struct {
Meta Meta `json:"_meta,omitzero"`
Cost *Cost `json:"cost,omitempty"`
Size uint64 `json:"size"`
Used uint64 `json:"used"`
}
UsageUpdate: Context window and cost update for a session.
func (*UsageUpdate) UnmarshalJSON ¶
func (u *UsageUpdate) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type WaitForTerminalExitRequest ¶
type WaitForTerminalExitRequest struct {
Meta Meta `json:"_meta,omitzero"`
SessionID SessionID `json:"sessionId"`
TerminalID TerminalID `json:"terminalId"`
}
WaitForTerminalExitRequest: Request to wait for a terminal command to exit.
type WaitForTerminalExitResponse ¶
type WaitForTerminalExitResponse struct {
Meta Meta `json:"_meta,omitzero"`
ExitCode *uint32 `json:"exitCode,omitempty"`
Signal *string `json:"signal,omitempty"`
}
WaitForTerminalExitResponse: Response containing the exit status of a terminal command.
func (*WaitForTerminalExitResponse) UnmarshalJSON ¶
func (r *WaitForTerminalExitResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type WriteTextFileHandler ¶
type WriteTextFileHandler interface {
WriteTextFile(context.Context, *WriteTextFileRequest) (*WriteTextFileResponse, error)
}
WriteTextFileHandler optionally writes text files for an agent.
type WriteTextFileRequest ¶
type WriteTextFileRequest struct {
Meta Meta `json:"_meta,omitzero"`
Content string `json:"content"`
Path string `json:"path"`
SessionID SessionID `json:"sessionId"`
}
WriteTextFileRequest: Request to write content to a text file.
Only available if the client supports the `fs.writeTextFile` capability.
type WriteTextFileResponse ¶
type WriteTextFileResponse struct {
Meta Meta `json:"_meta,omitzero"`
}
WriteTextFileResponse: Response to `fs/write_text_file`