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 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 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 has the host serve dir, a directory inside the application such as a built view, as the application's page. A relative dir is resolved against the application's 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"`
}
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
}