Skip to main content
Glama

Execute Shell Command

execute_shell_command
Destructive

Execute shell commands directly from the Serena MCP server to automate tasks, run scripts, and retrieve command output for development workflows.

Instructions

Execute a shell command and return its output. If there is a memory about suggested commands, read that first. Never execute unsafe shell commands! IMPORTANT: Do not use this tool to start

  • long-running processes (e.g. servers) that are not intended to terminate quickly,

  • processes that require user interaction. Returns a JSON object containing the command's stdout and optionally stderr output.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandYesThe shell command to execute.
cwdNoThe working directory to execute the command in. If None, the project root will be used.
capture_stderrNoWhether to capture and return stderr output.
max_answer_charsNoIf the output is longer than this number of characters, no content will be returned. -1 means using the default value, don't adjust unless there is no other way to get the content required for the task.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

Annotations already indicate destructiveHint=true and readOnlyHint=false, but the description adds valuable behavioral context beyond this: it warns against unsafe commands, specifies output truncation behavior via max_answer_chars, mentions checking memory first, and describes the JSON return structure. This provides important safety and operational guidance that annotations alone don't cover.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded with the core purpose, followed by important warnings and return format details. While some sentences could be more concise (e.g., the warning about long-running processes is slightly verbose), overall it's efficient with each sentence serving a clear purpose.

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 the tool's complexity (destructive shell command execution), rich annotations (destructiveHint=true), complete schema coverage, and existence of an output schema, the description provides excellent contextual completeness. It covers safety warnings, usage constraints, memory integration, and output behavior, making it fully adequate for an AI agent to understand when and how to use this tool correctly.

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

Parameters3/5

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

With 100% schema description coverage, the input schema already fully documents all 4 parameters. The description doesn't add any parameter-specific semantics beyond what's in the schema descriptions, so it meets the baseline expectation without providing additional value about parameter usage or interactions.

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?

The description clearly states the specific action ('execute a shell command and return its output') and distinguishes it from siblings by focusing on command execution rather than file operations, memory management, or project configuration. It goes beyond just restating the name/title by specifying the return format and behavioral constraints.

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?

The description provides explicit guidance on when NOT to use this tool (for long-running processes or processes requiring user interaction) and references checking memory for suggested commands first. However, it doesn't explicitly name alternative tools for those excluded use cases or differentiate from similar tools like list_dir for directory operations.

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/oraios/serena'

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