execute_and_capture
Run a shell command and capture its stdout/stderr into an ephemeral, searchable buffer, then get a concise summary with exit code, line count, and head/tail preview—without flooding context.
Instructions
Runs a shell command, captures stdout/stderr, indexes it, and returns a concise summary (exit code, line count, diff map or error signals, head/tail preview) WITHOUT flooding your prompt context with thousands of lines.
Use this for noisy tests, builds, logs, and other output that benefits from
bounded capture and later search. Direct command execution is usually
faster for a small, targeted inspection; use capture once output may be
noisy, large, or uncertain. This is an advisory routing heuristic, not an
enforced threshold. Before running, verify the
command, intended repository, and working directory: an omitted cwd
inherits the server process directory, and symlinks or shell expansion can
target a different path than expected. This tool bounds output but does
not validate command intent, path identity, or filesystem safety.
Args: command: Shell command line to execute. cwd: Optional working directory for command execution; pass an explicit validated path for repository-sensitive commands. label: Optional human-readable description/label for this capture. content_type: Content type hint - 'auto' (default, detects diff/log/text), 'diff', 'log', or 'text'. max_output_bytes: Maximum command output retained (default: configured buffer byte limit). timeout_seconds: Optional maximum runtime; timed-out commands return exit code 124.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | ||
| label | No | ||
| command | Yes | ||
| content_type | No | auto | |
| timeout_seconds | No | ||
| max_output_bytes | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |