Versions in this module Expand all Collapse all v1 v1.3.7 Nov 29, 2026 v1.3.6 Nov 29, 2026 Changes in this version + const CodeInternalError + const CodeInvalidParams + const CodeInvalidRequest + const CodeMethodNotFound + const CodeParseError + const ProtocolVersion + func NewPipePair() (*PipeTransport, *PipeTransport) + func NormalizeToolCall(name string, rawArgs json.RawMessage) (string, json.RawMessage) + type AgentInfo struct + Description string + Name string + Vendor string + Version string + type Capabilities struct + Cancellation bool + Streaming bool + Thinking bool + Tools bool + type Client struct + func NewClient(transport Transport) *Client + func (c *Client) Call(ctx context.Context, method string, params any, result any) error + func (c *Client) Cancel(ctx context.Context, sessionID string) error + func (c *Client) Close() error + func (c *Client) CreateSession(ctx context.Context, params SessionCreateParams) (*SessionCreateResult, error) + func (c *Client) Initialize(ctx context.Context, info ClientInfo) (*InitializeResult, error) + func (c *Client) NewSession(ctx context.Context, params SessionNewParams) (*SessionNewResult, error) + func (c *Client) Notify(ctx context.Context, method string, params any) error + func (c *Client) Prompt(ctx context.Context, params SessionPromptParams, onEvent EventHandler) (*SessionPromptResult, error) + func (c *Client) SetModel(ctx context.Context, sessionID, modelID string) error + func (c *Client) SetToolHandler(h ToolHandler) + type ClientInfo struct + Name string + Version string + type ContentBlock struct + Text string + Type string + type EventHandler func(event SessionEvent) + type EventType string + const EventDone + const EventError + const EventTextDelta + const EventThoughtDelta + const EventToolCall + const EventUsage + type ID struct + IsStr bool + Num int64 + Str string + func (id *ID) UnmarshalJSON(b []byte) error + func (id ID) MarshalJSON() ([]byte, error) + func (id ID) String() string + type IDEMCPServer struct + func NewIDEMCPServer() (*IDEMCPServer, error) + func (s *IDEMCPServer) Close() error + func (s *IDEMCPServer) Port() int + func (s *IDEMCPServer) SetHandler(h ToolHandler) + func (s *IDEMCPServer) SetTools(tools []ToolDefinition) + type InitializeParams struct + Capabilities Capabilities + ClientInfo ClientInfo + ProtocolVersion int + type InitializeResult struct + AgentInfo AgentInfo + Capabilities Capabilities + ProtocolVersion int + type Notification struct + JSONRPC string + Method string + Params json.RawMessage + type PipeTransport struct + func (p *PipeTransport) Close() error + func (p *PipeTransport) Receive(_ context.Context) ([]byte, error) + func (p *PipeTransport) Send(_ context.Context, msg []byte) error + type PromptContent []ContentBlock + func TextContent(text string) PromptContent + func (p *PromptContent) UnmarshalJSON(b []byte) error + func (p PromptContent) MarshalJSON() ([]byte, error) + type PromptMessage struct + Content string + Role string + Thought string + ToolCalls []ToolCall + ToolResults []ToolResult + type RPCError struct + Code int + Data any + Message string + func (e *RPCError) Error() string + type Request struct + ID ID + JSONRPC string + Method string + Params json.RawMessage + type Response struct + Error *RPCError + ID ID + JSONRPC string + Result json.RawMessage + type SessionCreateParams struct + Model string + SessionID string + SystemPrompt string + Workspace string + type SessionCreateResult struct + SessionID string + Status string + type SessionEvent struct + Error string + SessionID string + Text string + Thought string + ToolCall *ToolCall + Type EventType + Usage *Usage + type SessionNewParams struct + AdditionalDirs []string + Cwd string + DisableBuiltInTools bool + Model string + SessionID string + SystemPrompt string + Workspace string + type SessionNewResult struct + SessionID string + Status string + type SessionPromptParams struct + Messages []PromptMessage + Model string + Prompt PromptContent + SessionID string + Stream bool + type SessionPromptResult struct + FinishReason string + Message PromptMessage + StopReason string + Usage *Usage + type SetModelParams struct + ModelID string + SessionID string + type SocketTransport struct + func NewSocketTransport(ctx context.Context, network, address string) (*SocketTransport, error) + func (s *SocketTransport) Close() error + func (s *SocketTransport) Receive(_ context.Context) ([]byte, error) + func (s *SocketTransport) Send(_ context.Context, msg []byte) error + type StdioTransport struct + func NewStdioTransport(ctx context.Context, command string, args []string, dir string) (*StdioTransport, error) + func (t *StdioTransport) Close() error + func (t *StdioTransport) Receive(_ context.Context) ([]byte, error) + func (t *StdioTransport) Send(_ context.Context, msg []byte) error + type ToolCall struct + Arguments json.RawMessage + ID string + Name string + type ToolDefinition struct + Description string + InputSchema map[string]any + Name string + type ToolHandler func(ctx context.Context, call ToolCall) (ToolResult, error) + type ToolResult struct + CallID string + Content string + Error string + Name string + type Transport interface + Close func() error + Receive func(ctx context.Context) ([]byte, error) + Send func(ctx context.Context, msg []byte) error + type Usage struct + CachedReadTokens int64 + CachedTokens int64 + InputTokens int64 + OutputTokens int64 + ReasoningTokens int64 + ThoughtTokens int64 + TotalTokens int64