Skip to main content
Glama

grok_request

Destructive

Submit a synchronous Grok CLI request, auto-deferring to a pollable job when async is enabled. Requires a prompt or structured prompt parts.

Instructions

Run an xAI Grok 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
denyNoGrok --deny <RULE>: permission deny rules. Each entry is emitted as its own --deny instance (per `grok --help`: "Repeat to add multiple rules").
agentNoGrok --agent <NAME>: agent name or definition file path.
allowNoGrok --allow <RULE>: permission allow rules. Each entry is emitted as its own --allow instance (per `grok --help`: "Repeat to add multiple rules").
checkNoGrok --check: append a self-verification loop to the prompt (headless only).
modelNoModel name or alias (e.g. grok-build, latest)
oauthNoGrok --oauth: use OAuth during authentication.
rulesNoGrok --rules <RULES>: extra rules to append to the system prompt. Supports `@file` prefix per `grok --help` to load from a file; gateway passes the value verbatim and lets Grok parse the prefix.
agentsNoGrok --agents <JSON>: inline subagent definitions (JSON string or name → { description, prompt, … } map).
effortNoGrok effort level
noPlanNoGrok --no-plan: disable plan mode.
promptNoPrompt text for Grok (mutually exclusive with promptParts)
singleNoGrok --single <PROMPT>: single-turn prompt (in addition to gateway -p).
bestOfNNoGrok --best-of-n <N>: run the task N ways in parallel and pick the best (headless only).
sandboxNoGrok --sandbox <PROFILE>: sandbox profile for filesystem and network access. Freeform per `grok --help` (no enum constraint on Grok 0.1.210); also settable via GROK_SANDBOX env var. Caller responsibility to pass a valid profile name.
maxTurnsNoGrok `--max-turns N`: cap on agent-loop iterations for cost / latency control (Phase 4 slice δ). Bounded to safe integers ≤ 10000.
noMemoryNoGrok --no-memory: disable cross-session memory.
todoGateNoGrok --todo-gate: enable runtime turn-end TodoGate for this session (session-scoped, not persisted).
verbatimNoGrok --verbatim: send the prompt exactly as given. Also skips gateway optimizePrompt when true.
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).
sessionIdNoProvider-native session ID to resume (emits --resume <id>; use resumeLatest for --continue). Note: the gw-* id minted for a brand-new session is not resumable via sessionId; continue with resumeLatest:true.
transportNoTransport: 'cli' (default) runs the Grok CLI; 'acp' routes through `grok agent stdio` when [acp].enabled and the provider's runtime_enabled are set (fails closed otherwise).cli
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.
jsonSchemaNoGrok 0.2.73 --json-schema: constrain output to a JSON Schema (string literal or object; implies json output). 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 server names for approval tracking (Grok manages its own MCP config via `grok mcp`)
promptFileNoGrok --prompt-file <PATH>: single-turn prompt loaded from a file.
promptJsonNoGrok --prompt-json <JSON>: single-turn prompt JSON blocks (string or serializable value).
workingDirNoGrok --cwd <DIR>: working directory for this invocation. Lets headless callers run Grok against a directory other than the gateway process's cwd.
forkSessionNoGrok 0.2.73 --fork-session: when resuming (--resume/--continue), fork into a new session ID instead of reusing the original.
noAltScreenNoGrok --no-alt-screen: run inline without alt screen.
noSubagentsNoGrok --no-subagents: disable subagent spawning.
promptPartsNoCache-aware structured prompt: { system?, tools?, context?, task }. Mutually exclusive with prompt. Stable parts hash into cache_state for prefix-discipline tracking.
restoreCodeNoGrok --restore-code: check out the original session commit when resuming.
worktreeRefNoGrok 0.2.73 --worktree-ref <REF>: git ref (branch/tag/commit) to base the native worktree on. Requires nativeWorktree.
allowedToolsNoAllowed built-in tools (passed as --tools comma list)
forceRefreshNoBypass dedup and force a fresh CLI run even if a recent identical request exists
leaderSocketNoGrok 0.2.32+ --leader-socket <PATH>: custom leader socket path (default ~/.grok/leader.sock). Targets an isolated leader process, e.g. a local/branch Grok build; name it ~/.grok/leader-*.sock to keep `grok leader list/kill` discovery working.
outputFormatNoOutput format (plain|json|streaming-json). Grok default is plain.
resumeLatestNoResume most recent Grok session in cwd (--continue). Note: the gw-* id minted for a brand-new session is not resumable via sessionId; continue with resumeLatest:true.
alwaysApproveNoAuto-approve all tool executions (--always-approve)
correlationIdNoRequest trace ID (auto if omitted)
idleTimeoutMsNoIdle timeout in ms (min 30s, max 1h). Omit = gateway default of 600000ms (10 min) with no output before the process is killed.
approvalPolicyNoApproval policy when approvalStrategy is mcp_managed: strict|balanced|permissive (default balanced). Ignored under legacy strategy.
compactionModeNoGrok --compaction-mode: summary (default; no pointer) | transcript (points at the raw transcript) | segments (persists per-segment markdown to grep). Sets GROK_COMPACTION_MODE.
nativeWorktreeNoGrok -w/--worktree: native CLI worktree flag (`true` → bare `--worktree`, string → named). NOT gateway slice λ `worktree`.
optimizePromptNoOptimize prompt before execution
permissionModeNoGrok permission mode: default|acceptEdits|auto|dontAsk|bypassPermissions|plan.
disallowedToolsNoDisallowed built-in tools (passed as --disallowed-tools comma list)
reasoningEffortNoReasoning effort for reasoning models
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
compactionDetailNoGrok --compaction-detail: verbatim segment detail (none|minimal|balanced|verbose, default verbose). Only affects `--compaction-mode segments`. Sets GROK_COMPACTION_DETAIL.
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
disableWebSearchNoGrok --disable-web-search: disable web search and remote retrieval tools.
optimizeResponseNoOptimize response output
experimentalMemoryNoGrok --experimental-memory: enable cross-session memory.
systemPromptOverrideNoGrok --system-prompt-override <PROMPT>: replace the agent's system prompt entirely. Distinct from Claude's --system-prompt / --append-system-prompt (Grok has only one override flag, not a pair).
Behavior2/5

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

Annotations already indicate destructiveHint=true and openWorldHint=true. The description adds the synchronous behavior and auto-deferral detail, but does not elaborate on what actions are destructive, side effects, or auth requirements. It adds little beyond what annotations provide.

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?

Two sentences, front-loaded with the core purpose and behavior. Every sentence adds value without redundancy. Highly efficient and structured for quick scanning.

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

Completeness2/5

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

Despite 56 parameters and no output schema, the description is extremely brief. It does not explain return values, error handling, or the deferral mechanism in detail. Annotations provide some context but the description leaves significant gaps for a tool of this complexity.

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?

Schema coverage is 100%, so the baseline is 3. The description adds the key constraint of mutual exclusivity between prompt and promptParts, which is not explicit in the schema. However, it doesn't compensate for the lack of parameter context beyond what schema descriptions already offer.

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 an xAI Grok CLI request synchronously' with a specific verb and resource. It distinguishes from the async sibling tool by noting the auto-deferral behavior and the requirement for exactly one of prompt or promptParts.

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

Usage Guidelines3/5

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

The description mentions when async jobs are enabled and the mutual exclusivity constraint, but does not compare to other sibling tools (e.g., claude_request) or provide explicit when-not-to-use scenarios. The guidance is minimal and context-specific.

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