Skip to main content
Glama

claude_run

Execute a one-shot Claude Code task with a prompt and get structured JSON output, for non-conversational work such as reviewing diffs, answering questions, or making a single change.

Instructions

Run a one-shot claude -p task and return structured JSON.

Best for work that needs no conversation: review a diff, answer a question, make one contained change. Cheaper and faster than a tmux session.

Pass session_name to resume a managed session's conversation, so one-shot and interactive work share history. A live, busy session is refused (two writers would corrupt the transcript); a live idle one is allowed but the running TUI will not show the turn until restarted. fork=True branches to a new session ID instead, avoiding both issues.

Returns {result, session_id, num_turns, total_cost_usd, duration_ms}. Always set max_turns to bound cost.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cwdNo
forkNo
modelNo
effortNo
promptYes
add_dirNo
timeoutNo
max_turnsNo
session_nameNo
allowed_toolsNo
permission_modeNo
disallowed_toolsNo
append_system_promptNo
Behavior4/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 well: it discloses session refusal for busy sessions, TUI behavior for idle ones, fork as a workaround for both, the return format, and a cost-bounding recommendation. Minor gap: no mention of filesystem access or arbitrary command execution, which may be relevant for safety.

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 front-loaded with a one-sentence summary, then uses short, purposeful paragraphs for usage guidance, session semantics, and return output. No redundant filler; every sentence adds value.

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?

For a tool with 13 parameters, no output schema, and no schema descriptions, this description covers the primary one-shot use case and session interactions well, but is insufficient for full autonomous use because many parameters (permission_mode, allowed_tools, model, effort, etc.) are not explained. It is adequate for basic usage but not complete.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate. It explains session_name, fork, and max_turns, but leaves cwd, model, effort, add_dir, timeout, allowed_tools, permission_mode, disallowed_tools, and append_system_prompt entirely undocumented, leaving most of the parameter space ambiguous.

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 first line 'Run a one-shot `claude -p` task and return structured JSON' gives a specific verb and resource, clearly distinguishing it from the session_* siblings. The note about being cheaper and faster than a tmux session further clarifies its unique purpose.

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?

Explicitly states when to use it: 'Best for work that needs no conversation' with concrete examples. Also provides guidance on session_name and fork behaviors, alternatives, and edge cases like busy vs idle sessions.

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/joschi655/claude-code-mcp'

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