Skip to main content
Glama
FlowLLM-AI

Finance MCP

by FlowLLM-AI

execute_shell

Execute shell commands to navigate directories, list contents, and run scripts for financial data processing and analysis workflows.

Instructions

A tool capable of executing shell commands can use pwd to check the current location, cd to navigate to a new directory, ls to view the contents of a directory, and execute scripts. Note that the starting directory is always the same each time the tool is invoked. If you need to perform multiple operations within a specific directory, you must include the full path in each command, for example: cd aa/bb && bash xxx.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandYescommand to be executed

Implementation Reference

  • Executes the shell command asynchronously using the run_shell_command helper, captures stdout, stderr, and exit code, then formats and sets the output.
    async def async_execute(self):
        """Execute the shell command operation."""
        command: str = self.input_dict.get("command", "").strip()
        assert command, "The 'command' parameter cannot be empty."
    
        # Execute using run_shell_command from common_utils
        stdout, stderr, return_code = await run_shell_command(command)
    
        # Build result message
        result_parts = [
            f"Command: {command}",
            f"Output: {stdout if stdout else '(empty)'}",
            f"Error: {stderr if stderr else '(none)'}",
            f"Exit Code: {return_code if return_code is not None else '(none)'}",
        ]
    
        self.set_output("\n".join(result_parts))
  • Defines the tool schema including name 'ExecuteShell', description, and required 'command' string input.
    def build_tool_call(self) -> ToolCall:
        """Build the tool call schema for executing shell commands."""
        return ToolCall(
            **{
                "name": "ExecuteShell",
                "description": self.get_prompt("tool_description"),
                "input_schema": {
                    "command": {
                        "type": "string",
                        "description": "command to be executed",
                        "required": True,
                    },
                },
            },
        )
  • Registers the ExecuteShellOp class as an operation using the @C.register_op() decorator.
    @C.register_op()
    class ExecuteShellOp(BaseAsyncToolOp):
  • Helper function that runs shell commands using asyncio.create_subprocess_shell, handles timeout, and returns decoded stdout, stderr, and return code.
    async def run_shell_command(cmd: str, timeout: Optional[float] = 30) -> Tuple[str, str, int]:
        """Run a shell command asynchronously and return its output.
    
        Args:
            cmd: Full command string to execute in a system shell.
            timeout: Maximum time in seconds to wait for completion. ``None``
                disables the timeout and waits indefinitely.
    
        Returns:
            A tuple ``(stdout, stderr, return_code)`` where both streams are
            UTF-8 decoded strings.
    
        Raises:
            asyncio.TimeoutError: If command execution exceeds ``timeout``.
        """
        process = await asyncio.create_subprocess_shell(
            cmd,
            stdout=asyncio.subprocess.PIPE,
            stderr=asyncio.subprocess.PIPE,
        )
    
        if timeout:
            stdout, stderr = await asyncio.wait_for(process.communicate(), timeout=timeout)
        else:
            stdout, stderr = await process.communicate()
    
        return (
            stdout.decode("utf-8", errors="ignore"),
            stderr.decode("utf-8", errors="ignore"),
            process.returncode,
        )
Behavior4/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 effectively explains key traits: the tool executes shell commands, the starting directory is fixed per invocation, and full paths are needed for multi-step operations. This adds valuable context beyond the basic schema, though it could mention security implications or output handling.

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 front-loaded with the core purpose and examples, followed by important behavioral notes. It uses two sentences efficiently, with no wasted words. However, the first sentence is slightly verbose ('A tool capable of executing shell commands can use...'), and it could be more streamlined without losing clarity.

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

Completeness3/5

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

Given the tool's complexity (executing arbitrary shell commands) and lack of annotations or output schema, the description does a fair job. It covers the fixed starting directory and path advice, which are critical for usage. However, it misses details like error handling, security warnings, or output format, leaving gaps for a tool with significant behavioral implications.

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?

The schema description coverage is 100%, with the 'command' parameter well-documented in the schema. The description doesn't add specific syntax or format details for the parameter beyond implying it accepts shell commands like 'pwd' or 'cd'. Since the schema already covers the parameter adequately, a baseline score of 3 is appropriate.

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

Purpose3/5

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

The description states the tool 'executes shell commands' and provides examples (pwd, cd, ls, scripts), which clarifies its purpose. However, it doesn't distinguish this tool from potential siblings like 'execute_code'—both could involve command execution, leaving the differentiation unclear. The purpose is understandable but lacks sibling-specific context.

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 includes a note about the starting directory being fixed and advises using full paths for multiple operations, which offers some usage context. However, it doesn't explicitly state when to use this tool versus alternatives like 'execute_code' or other siblings, nor does it provide exclusions or prerequisites. Guidance is minimal and not comparative.

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/FlowLLM-AI/finance-mcp'

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