Skip to main content
Glama
yonaka15

Simple Subprocess MCP Server

by yonaka15

run_command

Execute shell commands to automate tasks, retrieve system information, or manage processes through a secure subprocess interface.

Instructions

Execute a shell command using subprocess and return the output

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • server.py:6-26 (handler)
    The main handler function for the 'run_command' tool. It executes the provided shell command using subprocess.run with shell=True, captures output, handles success/error/timeout cases, and returns the appropriate string response.
    @mcp.tool
    def run_command(command: str) -> str:
        """Execute a shell command using subprocess and return the output"""
        try:
            result = subprocess.run(
                command,
                shell=True,
                capture_output=True,
                text=True,
                timeout=30  # 30秒でタイムアウト
            )
            
            if result.returncode == 0:
                return result.stdout
            else:
                return f"Error (exit code {result.returncode}): {result.stderr}"
        
        except subprocess.TimeoutExpired:
            return "Error: Command timed out after 30 seconds"
        except Exception as e:
            return f"Error executing command: {str(e)}"
  • server.py:6-6 (registration)
    The @mcp.tool decorator registers the run_command function as an MCP tool.
    @mcp.tool
  • server.py:7-8 (schema)
    Type hints and docstring define the input schema (command: str) and output (str), used by FastMCP for tool schema.
    def run_command(command: str) -> str:
        """Execute a shell command using subprocess and return the output"""
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions execution and output return, but fails to disclose critical traits such as security implications, error handling, timeouts, or side effects. This is a significant gap for a tool that executes shell commands, which can be destructive or resource-intensive.

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?

The description is extremely concise and front-loaded, consisting of a single sentence that directly states the tool's function. Every word earns its place, with no unnecessary elaboration or redundancy, making it efficient and easy to parse.

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

Completeness2/5

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

Given the complexity of executing shell commands, the description is incomplete. With no annotations, 0% schema coverage, and only an output schema (which doesn't explain behavior), it lacks essential context such as safety warnings, execution environment, or error details. This makes it inadequate for safe and effective use by an AI agent.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate for the lack of parameter documentation. It only implies that 'command' is a shell command without adding meaning beyond the schema's basic type. No details on command format, allowed syntax, or constraints are provided, failing to adequately explain the parameter's semantics.

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

Purpose4/5

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

The description clearly states the action ('Execute a shell command') and resource ('using subprocess'), making the purpose immediately understandable. It distinguishes the tool's function well, though without sibling tools, differentiation isn't applicable. However, it lacks specificity about the type of shell or environment, which prevents a perfect score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives, prerequisites, or any context for its application. It merely states what the tool does without indicating scenarios, limitations, or best practices, leaving the agent with insufficient usage context.

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/yonaka15/simple-subprocess-mcp'

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