Documentation
¶
Index ¶
- func Call[Output any](ctx context.Context, dependency *Dependency, name string, input any, ...) (Output, error)
- func Connect(ctx context.Context, name string) (*mcp.ClientSession, error)
- func Serve(ctx context.Context, server *mcp.Server, opts ...Option) error
- type Caller
- type Dependency
- type ElicitHandler
- type Option
- type Principal
- type RequestContext
- type ToolCallError
- type ToolSchema
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Call ¶
func Call[Output any](ctx context.Context, dependency *Dependency, name string, input any, elicit ...ElicitHandler) (Output, error)
Types ¶
type Caller ¶
Caller is the app of the same session that made a request. A lifecycle hook's job calls as its app.
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
}