Documentation
¶
Index ¶
- Constants
- func InvocationValidator(invocationType string, data json.RawMessage, primitive mcpfile.Primitive) error
- func RegisterFactory(invocationType string, factory InvokerFactory)
- func RegisterParser(invocationType string, parser InvocationConfigParser)
- type Builder
- type DynamicJson
- type InvocationConfig
- func ParseInvocation(invocationType string, data json.RawMessage, tool *mcpfile.Tool) (InvocationConfig, error)
- func ParsePromptInvocation(invocationType string, data json.RawMessage, prompt *mcpfile.Prompt) (InvocationConfig, error)
- func ParseResourceInvocation(invocationType string, data json.RawMessage, resource *mcpfile.Resource) (InvocationConfig, error)
- func ParseResourceTemplateInvocation(invocationType string, data json.RawMessage, ...) (InvocationConfig, error)
- type InvocationConfigParser
- type Invoker
- type InvokerFactory
- type Registry
Constants ¶
View Source
const ( JsonSchemaTypeObject = "object" JsonSchemaTypeNumber = "number" JsonSchemaTypeInteger = "integer" JsonSchemaTypeString = "string" JsonSchemaTypeArray = "array" JsonSchemaTypeBoolean = "boolean" JsonSchemaTypeNull = "null" )
Variables ¶
This section is empty.
Functions ¶
func InvocationValidator ¶
func RegisterFactory ¶
func RegisterFactory(invocationType string, factory InvokerFactory)
func RegisterParser ¶
func RegisterParser(invocationType string, parser InvocationConfigParser)
Types ¶
type Builder ¶
type Builder interface {
// SetField provides the builder with the parsed value, as well as the json dot separated path where the value comes from
SetField(path string, value any)
// GetResult returns the final builder resulting object
GetResult() (any, error)
}
Builder is an interface used to build any objects needed to invoke a tool as the request JSON is parsed. This avoids extra allocations/passes through the parsed map[string]any, which possibly contains nested maps
type DynamicJson ¶
type DynamicJson struct {
Builders []Builder
}
func (*DynamicJson) ParseJson ¶
func (dj *DynamicJson) ParseJson(data []byte, schema *jsonschema.Schema) (map[string]any, error)
type InvocationConfig ¶
type InvocationConfig interface {
Validate() error
}
func ParseInvocation ¶
func ParseInvocation(invocationType string, data json.RawMessage, tool *mcpfile.Tool) (InvocationConfig, error)
func ParsePromptInvocation ¶
func ParsePromptInvocation(invocationType string, data json.RawMessage, prompt *mcpfile.Prompt) (InvocationConfig, error)
func ParseResourceInvocation ¶
func ParseResourceInvocation(invocationType string, data json.RawMessage, resource *mcpfile.Resource) (InvocationConfig, error)
func ParseResourceTemplateInvocation ¶
func ParseResourceTemplateInvocation(invocationType string, data json.RawMessage, resourceTemplate *mcpfile.ResourceTemplate) (InvocationConfig, error)
type InvocationConfigParser ¶
type InvocationConfigParser interface {
Parse(data json.RawMessage, tool *mcpfile.Tool) (InvocationConfig, error)
ParsePrompt(data json.RawMessage, prompt *mcpfile.Prompt) (InvocationConfig, error)
ParseResource(data json.RawMessage, resource *mcpfile.Resource) (InvocationConfig, error)
ParseResourceTemplate(data json.RawMessage, resourceTemplate *mcpfile.ResourceTemplate) (InvocationConfig, error)
}
type Invoker ¶
type Invoker interface {
Invoke(ctx context.Context, req *mcp.CallToolRequest) (*mcp.CallToolResult, error)
InvokePrompt(ctx context.Context, req *mcp.GetPromptRequest) (*mcp.GetPromptResult, error)
InvokeResource(ctx context.Context, req *mcp.ReadResourceRequest) (*mcp.ReadResourceResult, error)
InvokeResourceTemplate(ctx context.Context, req *mcp.ReadResourceRequest) (*mcp.ReadResourceResult, error)
}
func CreateResourceInvoker ¶
func CreateResourceTemplateInvoker ¶
func CreateResourceTemplateInvoker(resourceTemplate *mcpfile.ResourceTemplate) (Invoker, error)
type InvokerFactory ¶
type InvokerFactory interface {
CreateInvoker(config InvocationConfig, schema *jsonschema.Resolved) (Invoker, error)
}
Click to show internal directories.
Click to hide internal directories.