Skip to main content
Glama
JeremyLakeyJr

Friday MCP Server

run_bash

Run bash commands within the workspace root. Specify command, optional timeout, and working directory to automate system tasks.

Instructions

Run a bash command within the workspace root.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandYes
timeoutNo
working_dirNo.

Implementation Reference

  • The core handler function for the 'run_bash' tool. It creates an async subprocess shell running /bin/bash with the given command, enforces a timeout (default from config), and returns a dict with command, cwd, exit_code, timed_out, stdout, and stderr.
    @mcp.tool()
    async def run_bash(
        command: str,
        timeout: int | None = None,
        working_dir: str = ".",
    ) -> dict:
        """Run a bash command within the workspace root."""
        cwd = _resolve_path(working_dir)
        if not cwd.is_dir():
            raise ValueError(f"'{working_dir}' is not a directory.")
    
        proc = await asyncio.create_subprocess_shell(
            command,
            cwd=str(cwd),
            stdout=asyncio.subprocess.PIPE,
            stderr=asyncio.subprocess.PIPE,
            executable="/bin/bash",
        )
        timeout = timeout or config.default_command_timeout
        try:
            stdout, stderr = await asyncio.wait_for(proc.communicate(), timeout=timeout)
            timed_out = False
        except asyncio.TimeoutError:
            proc.kill()
            stdout, stderr = await proc.communicate()
            timed_out = True
    
        return {
            "command": command,
            "cwd": str(cwd),
            "exit_code": proc.returncode if not timed_out else -1,
            "timed_out": timed_out,
            "stdout": stdout.decode(errors="replace"),
            "stderr": stderr.decode(errors="replace"),
        }
  • The write_file tool - included for context as a sibling tool defined in the same file.
    @mcp.tool()
    def write_file(path: str, content: str, overwrite: bool = True) -> dict:
        """Write a file within the workspace."""
        target = _resolve_path(path)
        if target.exists() and not overwrite:
            raise ValueError(f"'{path}' already exists and overwrite is disabled.")
    
        target.parent.mkdir(parents=True, exist_ok=True)
        target.write_text(content, encoding="utf-8")
        return {
            "path": str(target),
            "bytes_written": len(content.encode("utf-8")),
        }
  • The _resolve_path helper used by run_bash to resolve and validate working_dir against the workspace root, enforcing the allow_external_paths config.
    def register(mcp, *, config) -> None:
        def _resolve_path(path: str) -> Path:
            raw_path = Path(path).expanduser()
            resolved = (
                raw_path.resolve()
                if raw_path.is_absolute()
                else (config.workspace_root / raw_path).resolve()
            )
            if config.allow_external_paths:
                return resolved
            if resolved != config.workspace_root and config.workspace_root not in resolved.parents:
                raise ValueError(
                    f"Path '{path}' is outside the workspace root {config.workspace_root}."
                )
            return resolved
  • Registration orchestration: register_all_tools calls workspace.register(mcp, config=config) which registers the run_bash tool via the @mcp.tool() decorator pattern.
    """Tool registry for Friday MCP Server."""
    
    from friday_mcp_server.tools import skills, system, utils, web, workspace
    
    
    def register_all_tools(mcp, *, config, skill_store) -> None:
        system.register(mcp, config=config)
        utils.register(mcp)
        web.register(mcp, config=config)
        workspace.register(mcp, config=config)
        skills.register(mcp, skill_store=skill_store)
  • Config dataclass containing default_command_timeout (line 29) and allow_external_paths (line 28) used by run_bash for timeout and path validation.
    @dataclass(frozen=True)
    class Config:
        server_name: str
        transport: str
        workspace_root: Path
        skills_root: Path
        allow_external_paths: bool
        default_command_timeout: int
        max_fetch_chars: int
Behavior1/5

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

No annotations are present, and the description fails to disclose any behavioral traits. For a tool that executes arbitrary bash commands, critical information about potential side effects (file modification, deletion, infinite loops), security implications, or error handling is entirely missing.

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

Conciseness3/5

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

The description is a single sentence, very concise and front-loaded. However, it is too minimal—it sacrifices necessary detail for brevity. It earns its place in terms of word count but lacks structural completeness.

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

Completeness1/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 commands), the lack of output schema, annotations, and any description of return values, error handling, or safety considerations makes the description completely inadequate for an agent to use it reliably.

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

Parameters1/5

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

Schema description coverage is 0%, and the description adds no meaning to the three parameters (command, timeout, working_dir). It does not explain timeouts, default values, or the role of working_dir. The description is insufficient to help an agent use these parameters correctly.

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 'Run a bash command within the workspace root.' It uses a specific verb ('Run') and resource ('bash command'), and specifies the scope ('workspace root'). This distinguishes it from sibling tools like read_file or fetch_url.

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?

No guidance is provided on when to use this tool versus alternatives. There is no mention of when not to use it, prerequisites, or which scenarios are appropriate. The description simply states its action without 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/JeremyLakeyJr/mcp-server'

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