Skip to main content
Glama

claude_request

Destructive

Execute Claude Code CLI requests synchronously, with automatic deferral to pollable async jobs when needed. Accepts plain prompts or cache-aware structured prompt parts for efficiency.

Instructions

Run a Claude Code CLI request synchronously (when async jobs are enabled, auto-defers to a pollable job past the sync deadline; otherwise runs to completion). Requires exactly one of prompt or promptParts.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bareNoClaude --bare: minimal mode (skip hooks, LSP, plugin sync, attribution, auto-memory, keychain reads, CLAUDE.md auto-discovery). Explicit opt-in.
nameNoClaude --name: display name for this session (shown in pickers/titles).
agentNoClaude --agent: dispatch to a named single sub-agent.
debugNoClaude -d/--debug: enable debug mode. true emits a bare --debug; a string emits --debug <filter> (e.g. "api,hooks"). Debug output goes to stderr only.
modelNoModel name or alias (e.g. sonnet, claude-sonnet-4-5-20250929, latest)
toolsNoClaude --tools: restrict the available built-in tool set (distinct from allowedTools permission gating). Pass [""] to disable all tools.
addDirNoClaude --add-dir: additional directories the CLI is allowed to read/write beyond the process cwd. Each entry is emitted as its own --add-dir instance. Stdio/local callers may pass local paths directly. Remote HTTP/OAuth callers must use relative paths inside a selected registered workspace. Do not call workspace_* tools to fix stdio/local provider path access.
agentsNoClaude --agents: inline JSON map of agent name → { description, prompt, tools?, model? }.
effortNoClaude --effort: low|medium|high|xhigh|max.
promptNoPrompt text for Claude (mutually exclusive with promptParts)
maxTurnsNoClaude --max-turns: cap on agent loop iterations.
safeModeNoClaude --safe-mode: start with all customizations (CLAUDE.md, skills, plugins, hooks, MCP, commands, agents) disabled for troubleshooting. Explicit opt-in.
settingsNoClaude --settings: path to a settings JSON file or a JSON literal of additional settings. Powerful: settings can define hooks/permissions/model; passed verbatim.
worktreeNoSlice λ: run this request inside a dedicated git worktree owned by the gateway. `true` creates a fresh worktree at `<repoRoot>/.worktrees/<uuid>` branched from HEAD. `{ name?, ref? }` lets the caller supply a sanitized name and/or a git ref (default: HEAD). When the request carries a sessionId and the session already has a worktree, that worktree is reused. The gateway spawns the child CLI with `cwd: <worktree-path>` — no `-w`/`--worktree` flag is ever emitted to the underlying CLI. On session_delete or TTL eviction the gateway runs `git worktree remove --force`. Successful responses are prefixed with `[gateway] worktree=<absolute-path>\n` so callers can use the path. NOTE: callers should `.gitignore` the `.worktrees/` directory in their repo (the gateway does NOT auto-gitignore — see slice λ spec Q4).
debugFileNoClaude --debug-file: write debug logs to a specific file path (enables debug mode).
pluginDirNoClaude --plugin-dir: load a plugin from a directory or .zip for this session only. One --plugin-dir instance per entry.
pluginUrlNoClaude --plugin-url: load a plugin .zip from a URL for this session only. One --plugin-url instance per entry.
sessionIdNoOn a fresh request this id is emitted as Claude --session-id <uuid> (must be a valid UUID that does not already exist). Resume the latest cwd conversation with continueSession:true. gw-* ids are not valid Claude --session-id values.
workspaceNoRegistered workspace alias for remote HTTP/OAuth provider calls. Do not use this field, workspace_list, or workspace_register_existing_repo as a fallback for stdio/local provider path access; pass workingDir/addDir/includeDirs directly instead.
jsonSchemaNoClaude --json-schema: JSON Schema literal (NOT a path) constraining structured output. Object values are JSON.stringify-d; string values are passed verbatim. Use with outputFormat='json'. Set outputFormat:json so the gateway treats the reply as structured output (skips response optimization and warning injection); the default output format is not json, so pass it explicitly.
mcpServersNoMCP servers exposed to Claude
forkSessionNoClaude --fork-session: branch from an existing session into a fresh fork.
promptPartsNoCache-aware structured prompt: { system?, tools?, context?, task, cacheControl? }. Use for repeated calls that share a stable prefix — `system`/`tools`/`context` are the stable head; `task` is the volatile tail (never marked). Set `cacheControl: { system?: boolean, tools?: boolean, context?: boolean }` to opt into explicit Anthropic prefix caching via `--input-format stream-json` (slice κ). Requires `outputFormat: 'stream-json'` and hard-codes `ttl='1h'` (Anthropic rejects 5m blocks after Claude Code's 1h-marked session-wrap content). Mutually exclusive with `prompt`. The stable prefix hash is logged to the flight recorder for cache_state aggregates.
allowedToolsNoAllowed tools (['Bash(git:*)','Edit','Write'])
forceRefreshNoBypass dedup and force a fresh CLI run even if a recent identical request exists
maxBudgetUsdNoClaude --max-budget-usd: spend cap for this request in USD.
outputFormatNoOutput format (text|json|stream-json). DEFAULT: stream-json — the gateway parses NDJSON usage events to extract input/output/cache_read/cache_creation tokens + cost + model, persists them to the flight recorder for cache_state aggregates, and still returns the assistant text. Override to 'text' only when you truly want unparsed stdout (loses observability).stream-json
systemPromptNoClaude --system-prompt: replace the system prompt entirely. Mutually exclusive with appendSystemPrompt.
correlationIdNoRequest trace ID (auto if omitted)
fallbackModelNoClaude --fallback-model: model name to auto-fallback to when the default model is overloaded (effective only with --print, which the gateway always uses).
idleTimeoutMsNoIdle timeout in ms (min 30s, max 1h, omit=CLI default). Idle enforcement applies only when outputFormat is stream-json; it is ignored for text/json.
approvalPolicyNoApproval policy when approvalStrategy is mcp_managed: strict|balanced|permissive (default balanced). Ignored under legacy strategy.
optimizePromptNoOptimize prompt before execution
permissionModeNoClaude --permission-mode: default|acceptEdits|plan|auto|dontAsk|bypassPermissions. `default` is a no-op (no flag emitted).
settingSourcesNoClaude --setting-sources: comma-separated setting sources to load (user|project|local) for reproducible/isolated headless runs.
continueSessionNoContinue the most recent Claude conversation in this cwd (emits --continue; real CLI continuity).
disallowedToolsNoDisallowed tools
strictMcpConfigNoRestrict Claude to provided MCP config only
approvalStrategyNoApproval strategy: legacy (default) lets the provider CLI's own flags decide; mcp_managed routes the run through the gateway approval gate (required for approvalPolicy and approval_list). Under mcp_managed the caller's permissionMode/alwaysApprove may be overridden by the gate.legacy
compressResponseNoCompress the response display text via the native compressor (default: [compression].enabled in config.toml, off unless opted in). Skipped for structured output.
createNewSessionNoForce new session
optimizeResponseNoOptimize response output
systemPromptFileNoClaude --system-prompt-file: replace the system prompt from a file path (path variant of systemPrompt).
includeHookEventsNoClaude --include-hook-events: include all hook lifecycle events in the output stream. Only takes effect with outputFormat=stream-json (the default).
appendSystemPromptNoClaude --append-system-prompt: append to the existing system prompt. Mutually exclusive with systemPrompt.
replayUserMessagesNoClaude --replay-user-messages: re-emit user messages from stdin back on stdout for acknowledgment. Only works with input-format=stream-json and outputFormat=stream-json (the cacheControl path).
noSessionPersistenceNoClaude --no-session-persistence: do not write this session to disk (ephemeral one-shot runs; mirrors codex --ephemeral).
appendSystemPromptFileNoClaude --append-system-prompt-file: append a system prompt from a file path (path variant of appendSystemPrompt).
dangerouslySkipPermissionsNoDEPRECATED: prefer `permissionMode: "bypassPermissions"`. Maps to it when `permissionMode` is unset.
excludeDynamicSystemPromptSectionsNoClaude --exclude-dynamic-system-prompt-sections: trim dynamic context blocks from the system prompt.
Behavior4/5

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

Annotations already indicate destructive hint (true) and read-only false. The description adds behavioral insight: auto-defers to async jobs past a deadline, and runs to completion otherwise. This goes beyond annotations by explaining the execution model, though it could detail side effects or error handling more.

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 concise (three sentences) and front-loaded with the main purpose. It efficiently conveys key information without superfluous text, though it could be slightly more structured (e.g., bullet points for constraints) without harming 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 high complexity (50 parameters, no output schema), the description is brief and omits details like return format, error cases, or typical usage patterns. The schema covers parameters individually, but the description does not sufficiently tie together the overall workflow or expected behavior beyond the sync/async dimension.

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?

With 100% schema description coverage, each parameter is already well-documented in the schema. The tool description adds only the overarching constraint of requiring exactly one of `prompt` or `promptParts`. This provides marginal added value, meeting the baseline expectation for high schema coverage.

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 the verb 'Run', the resource 'Claude Code CLI request', and specifies synchronous behavior with deferral to async when applicable. It distinguishes from the `claude_request_async` sibling by clarifying the sync/async mechanism, making the purpose specific and unambiguous.

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 mentions the synchronous vs. async behavior and the mutual exclusivity of `prompt` and `promptParts`, giving context for when to use this tool. However, it does not explicitly name alternatives like `claude_request_async` or provide clear when-not-to-use scenarios, leaving room for slight ambiguity.

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/verivus-oss/llm-cli-gateway'

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