Skip to main content
Glama
hoyt-harness

ProcExecMCP

by hoyt-harness

execute_command

Run commands securely with timeouts and output limits, preventing shell injection and memory issues.

Instructions

Execute a command safely with timeout and output limits.

This tool executes commands without shell injection vulnerabilities. Commands are parsed into argument lists and executed directly via subprocess without shell=True.

Args: command: Command to execute (e.g., "python --version", "npm test") working_directory: Working directory for execution (default: current) timeout_ms: Timeout in milliseconds (default: 30000, max: 300000) capture_output: Whether to capture stdout/stderr (default: True) ctx: MCP context for logging (optional)

Returns: ExecuteCommandOutput with stdout, stderr, exit code, and timing

Raises: ValueError: If input validation fails SanitizedError: If command execution fails

Security: - No shell=True (prevents shell injection) - Command parsed with shlex.split (safe parsing) - Mandatory timeout enforcement - Output size limits (prevents memory exhaustion) - Path validation for working directory - Sanitized error messages (no information leakage)

Examples: >>> result = await execute_command("python --version") >>> print(result.stdout) # "Python 3.11.5" >>> print(result.exit_code) # 0

>>> result = await execute_command(
...     "npm test",
...     working_directory="./myproject",
...     timeout_ms=60000
... )

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandYes
timeout_msNo
capture_outputNo
working_directoryNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
stderrYesStandard error from the command
stdoutYesStandard output from the command
exit_codeYesExit code returned by the command (0 typically means success)
timed_outYesWhether the command was terminated due to timeout
output_truncatedYesWhether output was truncated due to size limit
execution_time_msYesTime taken to execute command in milliseconds
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Comprehensively covers safety features (no shell injection, timeout, output limits, path validation, sanitized errors), return type, and exceptions. No annotations provided, so description fully shoulders the burden.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Well-structured with front-loaded purpose, then detailed sections (Args, Returns, Raises, Security, Examples). Every section adds value without redundancy; appropriate length for a safety-critical tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given four parameters, one required, and existence of output schema, the description covers inputs, behavior, return type, and exceptions completely. No gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Although input schema has 0% description coverage, the description's Args section defines each parameter with examples, defaults, and constraints (e.g., timeout max, capture_output default), fully compensating.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states 'Execute a command safely with timeout and output limits'. Specific verb+resource, distinguishes from siblings by focusing on command execution rather than file or process management.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides clear context and examples for typical use cases, but does not explicitly contrast with sibling tools (search_file_contents, list_processes, kill_process) for when to avoid this tool.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hoyt-harness/ProcExecMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server