Skip to main content
Glama

session_exec

Run commands in persistent sessions and shape output via grep, line limits, and character caps for AI agents.

Instructions

Run a command in a session; returns a structured ExecResult JSON (stdout, stderr, exit_code, duration_ms, cwd, truncated). Optionally pass budget to shape output: {grep:{pattern,context?}, keep:{mode:"all"|"tail"|"head"|"head_tail",n?|head?+tail?}, max_chars?}. Shaping is line-based, client-side, AFTER secret redaction; it never changes the exit code or side effects. When applied, the result includes a budget report (per-stream mode + lines_total/lines_kept).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
budgetNoShape THIS command's output (overrides the session default).
commandYesThe shell command to run.
session_idYesSession id from session_create.
Behavior4/5

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

The description discloses the output shaping behavior (line-based, client-side, after secret redaction, no effect on exit code/side effects) and the inclusion of a budget report. Since no annotations exist, this adds value, but it omits details on error handling, session state mutations beyond shaping, and environment assumptions.

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 concise (5 sentences) and front-loaded with the core purpose. Each sentence provides essential detail: return format, budget parameter structure, behavioral guarantees. No wasted words; clear and efficient.

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

Completeness4/5

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

With 3 parameters, no output schema, and no annotations, the description covers the return format, budget parameter details, and key behavioral traits. However, it does not explain error cases, session lifecycle prerequisites (session_id from session_create), or the execution environment (cwd, env), which would enhance completeness.

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?

Input schema covers 100% of parameters with descriptions, so baseline is 3. The description adds significant meaning by explaining the budget structure (grep, keep, max_chars), processing order, client-side execution, and the budget report, which goes beyond the schema's static definitions.

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 command in a session' with a specific verb and resource, and details the return format (structured ExecResult JSON). Among sibling tools (session_create, session_destroy, etc.), this is the only command execution tool, making its purpose distinct.

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 implicitly indicates use for executing commands in a session, but lacks explicit when-to-use or when-not-to-use guidance or alternatives. With clear sibling names, the context is sufficient, but no exclusions or comparisons are provided.

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/blinkingbit-oss/execkit'

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