Documentation
¶
Index ¶
- func NewHTTPServer(ctx context.Context, exec Executor, cfg *ServerConfig) (*http.Server, error)
- func WithMCPManager(mgr promptdef.MCPManager) func(*ToolHandler)
- func WithProfileRepo(repo ProfileRepo) func(*ToolHandler)
- type Executor
- type LLMCore
- type ProfileRepo
- type ServerConfig
- type ToolHandler
- func (h *ToolHandler) CallTool(ctx context.Context, req *jsonrpc.TypedRequest[*mcpschema.CallToolRequest]) (*mcpschema.CallToolResult, *jsonrpc.Error)
- func (h *ToolHandler) Complete(_ context.Context, _ *jsonrpc.TypedRequest[*mcpschema.CompleteRequest]) (*mcpschema.CompleteResult, *jsonrpc.Error)
- func (h *ToolHandler) GetPrompt(ctx context.Context, req *jsonrpc.TypedRequest[*mcpschema.GetPromptRequest]) (*mcpschema.GetPromptResult, *jsonrpc.Error)
- func (h *ToolHandler) Implements(method string) bool
- func (h *ToolHandler) Initialize(_ context.Context, _ *mcpschema.InitializeRequestParams, ...)
- func (h *ToolHandler) ListPrompts(ctx context.Context, _ *jsonrpc.TypedRequest[*mcpschema.ListPromptsRequest]) (*mcpschema.ListPromptsResult, *jsonrpc.Error)
- func (h *ToolHandler) ListResourceTemplates(_ context.Context, ...) (*mcpschema.ListResourceTemplatesResult, *jsonrpc.Error)
- func (h *ToolHandler) ListResources(_ context.Context, _ *jsonrpc.TypedRequest[*mcpschema.ListResourcesRequest]) (*mcpschema.ListResourcesResult, *jsonrpc.Error)
- func (h *ToolHandler) ListTools(ctx context.Context, _ *jsonrpc.TypedRequest[*mcpschema.ListToolsRequest]) (*mcpschema.ListToolsResult, *jsonrpc.Error)
- func (h *ToolHandler) OnNotification(_ context.Context, _ *jsonrpc.Notification)
- func (h *ToolHandler) ReadResource(_ context.Context, _ *jsonrpc.TypedRequest[*mcpschema.ReadResourceRequest]) (*mcpschema.ReadResourceResult, *jsonrpc.Error)
- func (h *ToolHandler) Subscribe(_ context.Context, _ *jsonrpc.TypedRequest[*mcpschema.SubscribeRequest]) (*mcpschema.SubscribeResult, *jsonrpc.Error)
- func (h *ToolHandler) Unsubscribe(_ context.Context, _ *jsonrpc.TypedRequest[*mcpschema.UnsubscribeRequest]) (*mcpschema.UnsubscribeResult, *jsonrpc.Error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHTTPServer ¶
NewHTTPServer constructs an MCP HTTP server exposing selected executor tools. It does not start listening; callers should run ListenAndServe and handle shutdown.
func WithMCPManager ¶ added in v0.1.7
func WithMCPManager(mgr promptdef.MCPManager) func(*ToolHandler)
WithMCPManager injects an MCP manager so MCP-sourced profiles can be rendered.
func WithProfileRepo ¶ added in v0.1.7
func WithProfileRepo(repo ProfileRepo) func(*ToolHandler)
WithProfileRepo injects a profile repository into a ToolHandler so that prompts/list and prompts/get return agently-core profiles to MCP clients.
Types ¶
type Executor ¶
type Executor interface {
LLMCore() LLMCore
ExecuteTool(ctx context.Context, name string, args map[string]interface{}, timeoutSec int) (interface{}, error)
}
Executor is the minimal runtime contract needed by MCP expose handlers.
type LLMCore ¶
type LLMCore interface {
ToolDefinitions() []llm.ToolDefinition
}
LLMCore exposes tool definitions required by MCP tool listing.
type ProfileRepo ¶ added in v0.1.7
type ProfileRepo interface {
LoadAll(ctx context.Context) ([]*promptdef.Profile, error)
Load(ctx context.Context, id string) (*promptdef.Profile, error)
}
ProfileRepo is the subset of *promptrepo.Repository used by the MCP prompt handlers. *promptrepo.Repository satisfies this interface without any changes.
type ServerConfig ¶
ServerConfig defines MCP server exposure options.
func (*ServerConfig) ToolPatterns ¶
func (c *ServerConfig) ToolPatterns() []string
type ToolHandler ¶
type ToolHandler struct {
// contains filtered or unexported fields
}
ToolHandler exposes executor tool registry via MCP tools/list and tools/call.
func NewToolHandler ¶
func NewToolHandler(exec Executor, patterns []string, opts ...func(*ToolHandler)) *ToolHandler
func NewToolHandlerWithProfiles ¶ added in v0.1.7
func NewToolHandlerWithProfiles(exec Executor, patterns []string, repo *promptrepo.Repository) *ToolHandler
NewToolHandlerWithProfiles constructs a ToolHandler with an optional profile repository so callers can pass both in a single call.
func (*ToolHandler) CallTool ¶
func (h *ToolHandler) CallTool(ctx context.Context, req *jsonrpc.TypedRequest[*mcpschema.CallToolRequest]) (*mcpschema.CallToolResult, *jsonrpc.Error)
func (*ToolHandler) Complete ¶
func (h *ToolHandler) Complete(_ context.Context, _ *jsonrpc.TypedRequest[*mcpschema.CompleteRequest]) (*mcpschema.CompleteResult, *jsonrpc.Error)
func (*ToolHandler) GetPrompt ¶
func (h *ToolHandler) GetPrompt(ctx context.Context, req *jsonrpc.TypedRequest[*mcpschema.GetPromptRequest]) (*mcpschema.GetPromptResult, *jsonrpc.Error)
func (*ToolHandler) Implements ¶
func (h *ToolHandler) Implements(method string) bool
func (*ToolHandler) Initialize ¶
func (h *ToolHandler) Initialize(_ context.Context, _ *mcpschema.InitializeRequestParams, _ *mcpschema.InitializeResult)
func (*ToolHandler) ListPrompts ¶
func (h *ToolHandler) ListPrompts(ctx context.Context, _ *jsonrpc.TypedRequest[*mcpschema.ListPromptsRequest]) (*mcpschema.ListPromptsResult, *jsonrpc.Error)
func (*ToolHandler) ListResourceTemplates ¶
func (h *ToolHandler) ListResourceTemplates(_ context.Context, _ *jsonrpc.TypedRequest[*mcpschema.ListResourceTemplatesRequest]) (*mcpschema.ListResourceTemplatesResult, *jsonrpc.Error)
func (*ToolHandler) ListResources ¶
func (h *ToolHandler) ListResources(_ context.Context, _ *jsonrpc.TypedRequest[*mcpschema.ListResourcesRequest]) (*mcpschema.ListResourcesResult, *jsonrpc.Error)
func (*ToolHandler) ListTools ¶
func (h *ToolHandler) ListTools(ctx context.Context, _ *jsonrpc.TypedRequest[*mcpschema.ListToolsRequest]) (*mcpschema.ListToolsResult, *jsonrpc.Error)
func (*ToolHandler) OnNotification ¶
func (h *ToolHandler) OnNotification(_ context.Context, _ *jsonrpc.Notification)
func (*ToolHandler) ReadResource ¶
func (h *ToolHandler) ReadResource(_ context.Context, _ *jsonrpc.TypedRequest[*mcpschema.ReadResourceRequest]) (*mcpschema.ReadResourceResult, *jsonrpc.Error)
func (*ToolHandler) Subscribe ¶
func (h *ToolHandler) Subscribe(_ context.Context, _ *jsonrpc.TypedRequest[*mcpschema.SubscribeRequest]) (*mcpschema.SubscribeResult, *jsonrpc.Error)
func (*ToolHandler) Unsubscribe ¶
func (h *ToolHandler) Unsubscribe(_ context.Context, _ *jsonrpc.TypedRequest[*mcpschema.UnsubscribeRequest]) (*mcpschema.UnsubscribeResult, *jsonrpc.Error)