Documentation
¶
Index ¶
- Constants
- type CliInvocationConfig
- type CliInvoker
- func (ci *CliInvoker) Invoke(ctx context.Context, req *mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func (ci *CliInvoker) InvokePrompt(ctx context.Context, req *mcp.GetPromptRequest) (*mcp.GetPromptResult, error)
- func (ci *CliInvoker) InvokeResource(ctx context.Context, req *mcp.ReadResourceRequest) (*mcp.ReadResourceResult, error)
- func (ci *CliInvoker) InvokeResourceTemplate(ctx context.Context, req *mcp.ReadResourceRequest) (*mcp.ReadResourceResult, error)
- type InvokerFactory
- type TemplateVariable
Constants ¶
View Source
const (
InvocationType = "cli"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CliInvocationConfig ¶
type CliInvocationConfig struct {
// The command-line string to be executed. It can contain placeholders in the form of '{paramName}' which correspond to parameters defined in the input schema.
Command string `json:"command" jsonschema:"required"`
// Defines how input parameters are formatted into the command string.
// The map key corresponds to the parameter name from the input schema.
TemplateVariables map[string]*TemplateVariable `json:"templateVariables,omitempty" jsonschema:"optional"`
}
CliInvocationConfig is the configuration for executing a command-line tool. This is a pure data structure with no parsing logic - all struct tags only.
func (*CliInvocationConfig) DeepCopy ¶ added in v0.1.1
func (c *CliInvocationConfig) DeepCopy() invocation.InvocationConfig
func (*CliInvocationConfig) Validate ¶
func (c *CliInvocationConfig) Validate() error
type CliInvoker ¶
type CliInvoker struct {
ParsedTemplate *template.ParsedTemplate // Parsed template for the command
InputSchema *jsonschema.Resolved // InputSchema for the tool
URITemplate string // MCP URI template (for resource templates only)
}
func (*CliInvoker) Invoke ¶
func (ci *CliInvoker) Invoke(ctx context.Context, req *mcp.CallToolRequest) (*mcp.CallToolResult, error)
func (*CliInvoker) InvokePrompt ¶
func (ci *CliInvoker) InvokePrompt(ctx context.Context, req *mcp.GetPromptRequest) (*mcp.GetPromptResult, error)
func (*CliInvoker) InvokeResource ¶
func (ci *CliInvoker) InvokeResource(ctx context.Context, req *mcp.ReadResourceRequest) (*mcp.ReadResourceResult, error)
func (*CliInvoker) InvokeResourceTemplate ¶
func (ci *CliInvoker) 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, primitive invocation.Primitive) (invocation.Invoker, error)
func (*InvokerFactory) NewConfig ¶ added in v0.1.1
func (f *InvokerFactory) NewConfig() invocation.InvocationConfig
type TemplateVariable ¶
type TemplateVariable struct {
// Template is the format string for the variable. It can be a simple string or contain template variables like '{paramName}'.
// For example, "--user={username}" or "--verbose".
Template string `json:"format" jsonschema:"required"`
// OmitIfFalse, if true, causes the template to be omitted entirely if the input
// value is a boolean `false`. This is useful for optional flags like "--force".
OmitIfFalse bool `json:"omitIfFalse,omitempty" jsonschema:"optional"`
}
TemplateVariable is the formatting for a single parameter in the command template.
func (*TemplateVariable) DeepCopy ¶ added in v0.1.1
func (tv *TemplateVariable) DeepCopy() *TemplateVariable
Click to show internal directories.
Click to hide internal directories.