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 Caller
- type ConnectOption
- type Dependency
- type ElicitHandler
- type Option
- type Principal
- type RequestContext
- type ToolCallError
- type ToolSchema
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 Caller ¶
Caller is the app of the same session that made a request. A lifecycle hook's job calls as its app.
type ConnectOption ¶
type ConnectOption func(*connecting)
func WithTransport ¶
func WithTransport(wrap func(http.RoundTripper) http.RoundTripper) ConnectOption
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)
type ElicitHandler ¶
type ElicitHandler func(context.Context, *mcp.ElicitParams) (*mcp.ElicitResult, error)
ElicitHandler answers a server's question during one tool call.
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 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
}