Skip to main content
Glama

Run a git-bash command

exec

Run bash commands or multi-line scripts in git-bash on Windows, returning stdout, stderr, and exit code. Prefer it for git, build, grep/sed/awk pipelines, and shell loops outside the sandbox.

Instructions

Run a command or multi-line script in git-bash (MSYS2 bash on Windows) and return stdout, stderr and exit code. On Windows this is the preferred shell tool: choose it over a sandboxed PowerShell or shell tool for shell, git, build and script work, and keep the native PowerShell tool for Windows-native cmdlets, COM or .NET calls. Use for bash/git workflows: git, grep/sed/awk pipelines, shell loops, make, scripts. This bridge runs OUTSIDE the agent sandbox: pipes work here that a sandboxed shell tool cannot create. Each call starts a fresh bash process; state does not persist between calls (use cd in the command or pass cwd). Command failures return a JSON result with a non-zero exit_code, so they never raise tool errors. A policy engine blocks destructive commands: such a call returns error_code APPROVAL_REQUIRED (ask the user how to proceed) or POLICY_DENIED (blocked at the current stance). Call the policy tool to see the rules and the current stance. Resource limits: at most 4 commands run at once (extra calls queue and report queued_ms), captured output is capped at 64KB per stream with the remainder written to a capped spill file, and cancelling the tool call kills the whole process tree (killed_by: "cancel"). Every call is recorded in a local audit log; the user can read it with the gitbash-mcp audit command. If git-bash is missing the result carries error_code=BASH_NOT_FOUND with fix instructions; call doctor for details.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cwdNoWorking directory (Windows path). Defaults to the server working directory
envNoExtra environment variables for this command (passed through as given, not scrubbed)
loginNoUse bash -lc (login shell, sources profile) instead of bash -c
commandYesThe bash command line or multi-line script to execute
timeout_msNoKill the command after this many ms (default 60000)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.3.0

TDQS

A4.7/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so well: fresh process per call with no persistent state, non-zero exit_code returned as JSON rather than a tool error, destructive-command blocking with APPROVAL_REQUIRED/POLICY_DENIED codes, 4-command concurrency limit with queued_ms, 64KB per-stream output cap with spill file, process-tree kill on cancel, and audit logging. This is unusually rich behavioral disclosure.

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?

Front-loaded with the core action and the routing rule, which is good. However the back half is a dense wall of operational detail (policy codes, resource limits, audit log, BASH_NOT_FOUND) that is comprehensive but heavy; some items (e.g., audit log command) feel peripheral to invocation decisions and could be trimmed or deferred to the doctor/policy siblings.

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?

For a 5-param tool with no annotations and no output schema, the description nearly covers everything an agent needs: routing, stateless behavior, error/exit-code semantics, policy gating, resource limits, cancellation, and the missing-bash fallback. No output schema exists, yet return behavior is explained, so nothing critical is missing.

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

Parameters4/5

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

Schema coverage is 100%, so baseline is 3. The description adds meaning beyond the schema by warning that each call starts a fresh process (state does not persist) and advising to use cd in the command or pass cwd, which clarifies the cwd parameter's role in the stateless model. Slightly above baseline.

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?

States a specific verb (run), resource (a git-bash command/script), and the return payload (stdout, stderr, exit code). It explicitly distinguishes itself from the sibling sandboxed PowerShell/shell tool and the native PowerShell tool, so an agent can route correctly without opening any schema.

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

Usage Guidelines5/5

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

Explicit when-to-use (git, grep/sed/awk pipelines, shell loops, make, scripts) and when-not (Windows-native cmdlets, COM, .NET — use the PowerShell tool). It also contrasts with the sandboxed shell tool by noting this one runs outside the sandbox. Alternatives are named, not merely implied.

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

Deploy Server

Other Tools