Documentation
¶
Index ¶
- Variables
- func ActAs(ctx context.Context, subject string, opts ...ActAsOption) context.Context
- func Call[Output any](ctx context.Context, dependency *Dependency, name string, input any, ...) (Output, error)
- func Connect(ctx context.Context, name string, opts ...ConnectOption) (*mcp.ClientSession, error)
- func Serve(ctx context.Context, server *mcp.Server, opts ...Option) error
- type ActAsOption
- type Answered
- type Caller
- type CancelledTask
- type CompletedTask
- type ConnectOption
- type Created
- type Dependency
- func (d *Dependency) CallTool(ctx context.Context, params *mcp.CallToolParams, elicit ...ElicitHandler) (*mcp.CallToolResult, error)
- func (d *Dependency) CancelTask(ctx context.Context, id TaskID) error
- func (d *Dependency) GetTask(ctx context.Context, id TaskID) (DetailedTask, error)
- func (d *Dependency) StartTask(ctx context.Context, params *mcp.CallToolParams, elicit ...ElicitHandler) (Started, error)
- func (d *Dependency) UpdateTask(ctx context.Context, id TaskID, responses mcp.InputResponseMap) error
- type DetailedTask
- type ElicitHandler
- type FailedTask
- type InputRequiredTask
- type Option
- type Principal
- type RequestContext
- type Started
- type Task
- type TaskID
- type TaskStatus
- type ToolCallError
- type ToolSchema
- type WorkingTask
Constants ¶
This section is empty.
Variables ¶
var ErrNotBound = errors.New("not bound")
Functions ¶
func ActAs ¶
ActAs returns a context in which calls to other apps are made for subject, a person's principal subject, the subject of RFC 8693 §2.1.
func Call ¶
func Call[Output any](ctx context.Context, dependency *Dependency, name string, input any, elicit ...ElicitHandler) (Output, error)
func Connect ¶
func Connect(ctx context.Context, name string, opts ...ConnectOption) (*mcp.ClientSession, error)
Types ¶
type ActAsOption ¶
type ActAsOption func(*acting)
func WithActor ¶
func WithActor(app string) ActAsOption
WithActor names app, when it is not this app, as the one acting for the subject, the actor of RFC 8693 §2.1.
type Answered ¶
type Answered struct{ Result *mcp.CallToolResult }
type Caller ¶
Caller is the app of the same session that made a request. A lifecycle hook's job calls as its app.
type CancelledTask ¶
type CancelledTask struct{ Task }
type CompletedTask ¶
type CompletedTask struct {
Task
Result *mcp.CallToolResult `json:"result"`
}
type ConnectOption ¶
type ConnectOption func(*connecting)
func WithTransport ¶
func WithTransport(wrap func(http.RoundTripper) http.RoundTripper) ConnectOption
type Created ¶
type Created struct{ Task }
https://tasks.extensions.modelcontextprotocol.io/specification/2026-07-28/tasks#task-creation
type Dependency ¶
type Dependency struct {
Name string
Tools map[string]ToolSchema
}
func (*Dependency) CallTool ¶
func (d *Dependency) CallTool(ctx context.Context, params *mcp.CallToolParams, elicit ...ElicitHandler) (*mcp.CallToolResult, error)
func (*Dependency) CancelTask ¶
func (d *Dependency) CancelTask(ctx context.Context, id TaskID) error
https://tasks.extensions.modelcontextprotocol.io/specification/2026-07-28/tasks#task-cancellation
func (*Dependency) GetTask ¶
func (d *Dependency) GetTask(ctx context.Context, id TaskID) (DetailedTask, error)
https://tasks.extensions.modelcontextprotocol.io/specification/2026-07-28/tasks#task-polling
func (*Dependency) StartTask ¶
func (d *Dependency) StartTask(ctx context.Context, params *mcp.CallToolParams, elicit ...ElicitHandler) (Started, error)
func (*Dependency) UpdateTask ¶
func (d *Dependency) UpdateTask(ctx context.Context, id TaskID, responses mcp.InputResponseMap) error
https://tasks.extensions.modelcontextprotocol.io/specification/2026-07-28/tasks#task-update-requests
type DetailedTask ¶
type DetailedTask interface {
// contains filtered or unexported methods
}
https://tasks.extensions.modelcontextprotocol.io/specification/2026-07-28/tasks#task-status
type ElicitHandler ¶
type ElicitHandler func(context.Context, *mcp.ElicitParams) (*mcp.ElicitResult, error)
ElicitHandler answers a server's question during one tool call.
type FailedTask ¶
type InputRequiredTask ¶
type InputRequiredTask struct {
Task
InputRequests mcp.InputRequestMap `json:"inputRequests"`
}
type Option ¶
type Option func(*options)
Option configures Serve.
func WithFrontend ¶
WithFrontend serves dir, such as a built view, as the application's page: its files answer every GET and HEAD outside the MCP endpoint. A relative dir is resolved against the working directory.
type Principal ¶
type Principal struct {
Issuer string `json:"issuer"`
Subject string `json:"subject"`
ClientID string `json:"clientId"`
Scopes []string `json:"scopes"`
Claims map[string]json.RawMessage `json:"claims"`
Actor json.RawMessage `json:"actor,omitempty"`
}
type RequestContext ¶
type RequestContext struct {
Principal *Principal `json:"principal"`
Caller *Caller `json:"caller"`
}
func Context ¶
func Context(ctx context.Context) RequestContext
type Started ¶
type Started interface {
// contains filtered or unexported methods
}
https://tasks.extensions.modelcontextprotocol.io/specification/2026-07-28/tasks#polymorphic-results
type Task ¶
type Task struct {
ID TaskID `json:"taskId"`
Status TaskStatus `json:"status"`
StatusMessage string `json:"statusMessage,omitempty"`
CreatedAt string `json:"createdAt"`
LastUpdatedAt string `json:"lastUpdatedAt"`
TTLMs *int64 `json:"ttlMs"`
PollIntervalMs *int64 `json:"pollIntervalMs,omitempty"`
}
https://tasks.extensions.modelcontextprotocol.io/specification/2026-07-28/tasks#tasks-1
type TaskStatus ¶
type TaskStatus string
https://tasks.extensions.modelcontextprotocol.io/specification/2026-07-28/tasks#task-status
const ( TaskWorking TaskStatus = "working" TaskInputRequired TaskStatus = "input_required" TaskCompleted TaskStatus = "completed" TaskFailed TaskStatus = "failed" TaskCancelled TaskStatus = "cancelled" )
type ToolCallError ¶
type ToolCallError struct {
App string
Tool string
Code string
Result *mcp.CallToolResult
}
func (*ToolCallError) Error ¶
func (e *ToolCallError) Error() string
type ToolSchema ¶
type ToolSchema struct {
Input, Output string
}
type WorkingTask ¶
type WorkingTask struct{ Task }