Public declaration syntax from forge-go/mcp/server.go Original source SHA-256: 6a53a0c669c8cb47a79257395621b1aab7c0427a90c0da157a987d9fde870bc9 Function bodies and constant values are omitted. This is not the complete implementation. Source line 17 type ToolHandler func(ctx context.Context, arguments json.RawMessage) (json.RawMessage, error) // ResourceHandler is a function that handles an MCP resource read. // // Parameters: // - ctx: context for cancellation and timeout // // Returns the resource content as raw JSON or an error. type ResourceHandler func(ctx context.Context) (json.RawMessage, error) // PromptHandler is a function that handles an MCP prompt request. // // Parameters: // - ctx: context for cancellation and timeout // - arguments: the prompt arguments as key-value pairs // // Returns the rendered prompt as raw JSON or an error. type PromptHandler func(ctx context.Context, arguments map[string]string) (json.RawMessage, error) // McpServerConfig configures an MCP server. // // ANVIL Spec Section 12.9 -- MCP Server Configuration. type McpServerConfig struct Source line 25 type ResourceHandler func(ctx context.Context) (json.RawMessage, error) // PromptHandler is a function that handles an MCP prompt request. // // Parameters: // - ctx: context for cancellation and timeout // - arguments: the prompt arguments as key-value pairs // // Returns the rendered prompt as raw JSON or an error. type PromptHandler func(ctx context.Context, arguments map[string]string) (json.RawMessage, error) // McpServerConfig configures an MCP server. // // ANVIL Spec Section 12.9 -- MCP Server Configuration. type McpServerConfig struct Source line 34 type PromptHandler func(ctx context.Context, arguments map[string]string) (json.RawMessage, error) // McpServerConfig configures an MCP server. // // ANVIL Spec Section 12.9 -- MCP Server Configuration. type McpServerConfig struct Source line 39 type McpServerConfig struct Source line 59 type McpServer struct Source line 84 func NewMcpServer(config McpServerConfig) *McpServer Source line 102 func (s *McpServer) RegisterTool(descriptor McpToolDescriptor, handler ToolHandler) Source line 120 func (s *McpServer) RegisterResource(resource McpResource, handler ResourceHandler) Source line 138 func (s *McpServer) RegisterPrompt(prompt McpPrompt, handler PromptHandler) Source line 159 func (s *McpServer) HandleRequest(ctx context.Context, req *McpRequest) *McpResponse Source line 192 func (s *McpServer) Serve(ctx context.Context, transport McpTransport) error