command

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const FunctionArgumentNameAll = "@"

Variables

This section is empty.

Functions

This section is empty.

Types

type ApprovalFn

type ApprovalFn func(ctx context.Context, jsonArguments string) bool

type Command

type Command string

func (Command) CommandFn

func (c Command) CommandFn(fd FunctionDefinition) CommandFn

func (Command) Validate

func (c Command) Validate() error

type CommandFn

type CommandFn func(ctx context.Context, jsonArguments string) ([]byte, error)

type Expression

type Expression string

func (Expression) CommandFn

func (c Expression) CommandFn(fd FunctionDefinition) CommandFn

func (Expression) Validate

func (c Expression) Validate() error

type FunctionDefinition

type FunctionDefinition struct {
	Name        string              `yaml:"-" json:"name" usage:"The name of the function"`
	Description string              `yaml:"description,omitempty" json:"description" usage:"The description of the function"`
	Parameters  mcp.ToolInputSchema `yaml:"parameters,omitempty" json:"parameters" usage:"The parameter definition of the function"`
	Approval    string              `yaml:"approval,omitempty" json:"approval" usage:"Expression to check if user approval is needed before execute this tool"`

	Command               string            `` /* 183-byte string literal not displayed */
	CommandExpr           string            `` /* 180-byte string literal not displayed */
	Environment           map[string]string `` /* 145-byte string literal not displayed */
	AdditionalEnvironment map[string]string `` /* 181-byte string literal not displayed */
	WorkingDir            string            `yaml:"workingDir,omitempty,omitempty" json:"workingDir,omitempty" usage:"The working directory for the command"`

	//will be filled at runtime (and should not be filled by user in any way)
	CommandFn  CommandFn  `yaml:"-" json:"-"`
	ApprovalFn ApprovalFn `yaml:"-" json:"-"`
}

func (*FunctionDefinition) GetAdditionalEnvironment

func (f *FunctionDefinition) GetAdditionalEnvironment(jsonArgs string) (map[string]string, error)

func (*FunctionDefinition) GetCommandWithArgs

func (f *FunctionDefinition) GetCommandWithArgs(jsonArgs string) (string, []string, error)

func (*FunctionDefinition) GetEnvironment

func (f *FunctionDefinition) GetEnvironment(jsonArgs string) (map[string]string, error)

func (*FunctionDefinition) GetWorkingDirectory

func (f *FunctionDefinition) GetWorkingDirectory(jsonArgs string) (string, error)

func (*FunctionDefinition) NeedApproval

func (f *FunctionDefinition) NeedApproval(ctx context.Context, jsonArgs string) bool

type Variables

type Variables struct {
	FunctionDefinition FunctionDefinition `json:"fd"`
	Arguments          string             `json:"args"`
}

Jump to

Keyboard shortcuts

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