cli

package
v0.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2026 License: Apache-2.0 Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

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 (*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 (*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

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL