exectool

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Description

func Description(cfg config.Config) string

Description honestly lists the sandbox environment AND the input contract so the agent writes correct calls on the first try (FR-016). The usage rules exist because LLMs repeatedly trip on two things: leading indentation on top-level statements and passing `stdin` as a parsed object instead of a string. Accidental top-level indentation is auto-corrected before execution (normalizeTopLevelIndent), but spelling the contract out still avoids needless confusion. Cheaper than a retry loop.

Types

type ExecRequest

type ExecRequest struct {
	Code     string `` /* 223-byte string literal not displayed */
	TimeoutS int    `json:"timeout_s,omitempty" jsonschema:"wall-clock timeout in seconds (default 30, clamped to [1,300])"`
	Stdin    string `` /* 143-byte string literal not displayed */
}

ExecRequest is the public input schema of the exec tool.

type ExecResult

type ExecResult struct {
	Stdout     string `json:"stdout"`
	Stderr     string `json:"stderr"`
	ExitCode   int    `json:"exit_code"`
	DurationMS int64  `json:"duration_ms"`
	Truncated  bool   `json:"truncated"`
	TimedOut   bool   `json:"timed_out"`
}

ExecResult is the public output schema of the exec tool. The field set is a versioned contract (constitution III) and is identical across all transports.

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler implements the exec tool. Runs are serialized within the instance (constitution VIII): only one execution proceeds at a time.

func New

func New(cfg config.Config, iso isolator.Isolator, log *zap.Logger) *Handler

func (*Handler) Handle

Handle is the MCP tool handler. Invalid input returns an error (tool-call error); a non-zero exit or a timeout is a successful result with the corresponding fields set.

Jump to

Keyboard shortcuts

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