Documentation
¶
Index ¶
- Constants
- func IsValidHttpMethod(method string) bool
- type HttpInvocationConfig
- type HttpInvocationData
- type HttpInvoker
- func (hi *HttpInvoker) Invoke(ctx context.Context, req *mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func (hi *HttpInvoker) InvokePrompt(ctx context.Context, req *mcp.GetPromptRequest) (*mcp.GetPromptResult, error)
- func (hi *HttpInvoker) InvokeResource(ctx context.Context, req *mcp.ReadResourceRequest) (*mcp.ReadResourceResult, error)
- func (hi *HttpInvoker) InvokeResourceTemplate(ctx context.Context, req *mcp.ReadResourceRequest) (*mcp.ReadResourceResult, error)
- type InvokerFactory
- type Parser
- func (p *Parser) Parse(data json.RawMessage, tool *mcpfile.Tool) (invocation.InvocationConfig, error)
- func (p *Parser) ParsePrompt(data json.RawMessage, prompt *mcpfile.Prompt) (invocation.InvocationConfig, error)
- func (p *Parser) ParseResource(data json.RawMessage, resource *mcpfile.Resource) (invocation.InvocationConfig, error)
- func (p *Parser) ParseResourceTemplate(data json.RawMessage, resourceTemplate *mcpfile.ResourceTemplate) (invocation.InvocationConfig, error)
Constants ¶
View Source
const (
InvocationType = "http"
)
Variables ¶
This section is empty.
Functions ¶
func IsValidHttpMethod ¶
Types ¶
type HttpInvocationConfig ¶
type HttpInvocationConfig struct {
// The URL template for the HTTP request. It can contain placeholders in the form of '%' which correspond to parameters from the input schema.
PathTemplate string `json:"url" jsonschema:"required"`
// PathIndices maps parameter names to their positional index in the PathTemplate.
// This field is for internal use and is not part of the JSON schema.
PathIndices map[string]int `json:"-"`
// The HTTP method to be used for the request (e.g., "GET", "POST").
Method string `json:"method" jsonschema:"required,enum=GET,enum=POST,enum=PUT,enum=PATCH,enum=DELETE,enum=HEAD"`
// MCP URI template (for resource templates only).
URITemplate string `json:"-"`
}
The configuration for making an HTTP request.
func (*HttpInvocationConfig) Validate ¶
func (hic *HttpInvocationConfig) Validate() error
type HttpInvocationData ¶
type HttpInvocationData struct {
// Detailed HTTP invocation configuration.
Http HttpInvocationConfig `json:"http" jsonschema:"required"`
}
The structure for HTTP invocation configuration. It is used to parse the raw JSON data that specifies how to make an HTTP request.
type HttpInvoker ¶
type HttpInvoker struct {
PathTemplate string // template string for the request path
PathIndeces map[string]int // map to where each path parameter should go in the path
Method string // Http request method
InputSchema *jsonschema.Resolved // InputSchema for the tool
URITemplate string // MCP URI template (for resource templates only)
}
func (*HttpInvoker) Invoke ¶
func (hi *HttpInvoker) Invoke(ctx context.Context, req *mcp.CallToolRequest) (*mcp.CallToolResult, error)
func (*HttpInvoker) InvokePrompt ¶
func (hi *HttpInvoker) InvokePrompt(ctx context.Context, req *mcp.GetPromptRequest) (*mcp.GetPromptResult, error)
func (*HttpInvoker) InvokeResource ¶
func (hi *HttpInvoker) InvokeResource(ctx context.Context, req *mcp.ReadResourceRequest) (*mcp.ReadResourceResult, error)
func (*HttpInvoker) InvokeResourceTemplate ¶
func (hi *HttpInvoker) InvokeResourceTemplate(ctx context.Context, req *mcp.ReadResourceRequest) (*mcp.ReadResourceResult, error)
type InvokerFactory ¶
type InvokerFactory struct{}
func (*InvokerFactory) CreateInvoker ¶
func (f *InvokerFactory) CreateInvoker(config invocation.InvocationConfig, schema *jsonschema.Resolved) (invocation.Invoker, error)
type Parser ¶
type Parser struct{}
func (*Parser) Parse ¶
func (p *Parser) Parse(data json.RawMessage, tool *mcpfile.Tool) (invocation.InvocationConfig, error)
func (*Parser) ParsePrompt ¶
func (p *Parser) ParsePrompt(data json.RawMessage, prompt *mcpfile.Prompt) (invocation.InvocationConfig, error)
func (*Parser) ParseResource ¶
func (p *Parser) ParseResource(data json.RawMessage, resource *mcpfile.Resource) (invocation.InvocationConfig, error)
func (*Parser) ParseResourceTemplate ¶
func (p *Parser) ParseResourceTemplate(data json.RawMessage, resourceTemplate *mcpfile.ResourceTemplate) (invocation.InvocationConfig, error)
Click to show internal directories.
Click to hide internal directories.