Skip to main content
Glama

grok_request

Destructive

Runs a Grok CLI prompt synchronously and returns the result; when async is enabled, it converts to a pollable job past the sync deadline.

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). Not advertised by grok 1.0.4+; passed through for older installs.
modelNoModel name or alias (e.g. grok-4.5, 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. Known values: low, medium, high, xhigh, max. Your installed grok decides what it accepts; these are not enforced.
noPlanNoGrok --no-plan: disable plan mode.
promptNoPrompt text for Grok (mutually exclusive with promptParts)
bestOfNNoGrok --best-of-n <N>: run the task N ways in parallel and pick the best (headless only). Not advertised by grok 1.0.4+; passed through for older installs.
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, reuse requires same-host ownership metadata and a matching live Git registration. Named path collisions never reuse manager state. Gateway-managed worktrees require the local file-backed session manager and fail closed with PostgreSQL sessions. The Grok, Devin, and Mistral adapters require an explicit provider-native sessionId; fresh, createNewSession, and resumeLatest-only worktree requests fail closed because they cannot durably reselect the worktree. The request must select a registered workspace explicitly, through caller-owned session metadata, or through the configured default. Worktrees never fall back to the gateway process cwd and cannot be combined with local workingDir, addDir, or includeDirs paths. The gateway spawns the child CLI with `cwd: <worktree-path>`; no `-w`/`--worktree` flag is ever emitted to the underlying CLI. On worktree materialization, the gateway suppresses repository, system, and global Git hooks and configured clean, smudge, and process checkout filters, sparse checkout, and lazy object fetching. Filter-dependent content such as Git LFS remains in its repository representation instead of executing host commands. On session_delete or TTL eviction the gateway hides the session and runs `git worktree remove --force`. Failed removal retains a durable cleanup-pending tombstone which blocks reuse and is retried when the file store is registered on the owning host. The tombstone is finalized only after verified Git removal. Successful responses are prefixed with `[gateway] worktree=<absolute-path>\n` so callers can use the path. For Claude approvalStrategy:mcp_managed, requesting or reusing a worktree requires approval and LLM_GATEWAY_APPROVAL_ALLOW_BYPASS=1. Other adapters reject mcp_managed before launch. NOTE: callers should `.gitignore` the `.worktrees/` directory in their repo (the gateway does NOT auto-gitignore; see slice λ spec Q4).
sessionIdNoOn transport=cli, provider-native session ID to resume (emits --resume <id>; use resumeLatest for --continue); gateway gw-* tracking ids are not CLI session ids. On transport=acp, gateway-owned ACP session ID returned by an earlier ACP call; provider-native and CLI session ids are rejected.
transportNoTransport: 'cli' (default) runs the Grok CLI. 'acp' routes through `grok agent stdio` only when [acp].enabled plus [acp.providers.grok].enabled and runtime_enabled are true (fails closed otherwise). ACP accepts prompt, model, a gateway ACP sessionId, and a registered workspace alias; Grok CLI-only controls are rejected.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.
mcpServersNoThis provider does not receive gateway-managed MCP configuration. mcpServers has no effect with legacy, and mcp_managed is rejected before launch because ambient MCP configuration cannot be isolated.
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 for headless mode. Grok default is plain. The gateway parses json and streaming-json; other formats are passed through as raw output.
resumeLatestNoResume the most recent Grok session in cwd (--continue) on transport=cli. true is rejected on transport=acp.
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.
providerFlagsNoFlags passed to the provider binary verbatim, keyed exactly as the binary spells them (e.g. {"--best-of-n": "3", "--verbatim": true, "--rules": ["a", "b"]}). Use this for any flag your installed CLI accepts that this schema does not name: the binary decides what it supports, not the gateway. true emits the flag alone; a list REPEATS the flag once per item (pass a joined string if your CLI wants a comma-separated value). Values may not start with '-', and a flag the gateway is already emitting for this request is refused rather than duplicated. LOCAL stdio callers only: remote HTTP/OAuth callers are refused every flag here and should use this tool's declared parameters, which carry their own host-path and approval gates.
approvalPolicyNoOn transport=cli, approvalPolicy has no effect because mcp_managed is unavailable. On transport=acp, supplying approvalPolicy is rejected because ACP has its own permission bridge.
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. Known values: low, medium, high, xhigh, max. Not enforced; the installed binary decides.
approvalStrategyNoApproval strategy. legacy is supported. mcp_managed is rejected before Grok launches because the CLI adapter cannot isolate ambient MCP configuration; transport=acp has its own permission bridge and also rejects mcp_managed.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 a new session on transport=cli. true is rejected on transport=acp.
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).

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Addedv3.2.0
  2. Removedv3.0.0
  3. First observedv2.16.0

TDQS

A4/5.0
Behavior4/5

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

Annotations already carry the safety profile (destructiveHint=true, readOnlyHint=false, openWorldHint=true), so the bar is lower and no contradiction exists. The description adds genuine behavioral context beyond annotations: the synchronous execution mode, the auto-deferral to a pollable job past the sync deadline, and the exactly-one-of-prompt requirement. It does not detail output or failure behavior, but its added value over annotations justifies a 4.

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 tightly packed sentences with zero waste: core purpose front-loaded first, the async-deferral nuance second, and the mandatory requirement last. Every clause earns its place.

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?

For a 56-parameter tool with nested objects and no output schema, the description is thin. With no output schema, the description carries the burden of explaining return values, yet it never states what the caller receives (raw output, parsed JSON, job reference, error behavior), nor does it address transport selection, the sync deadline value, or failure modes at the tool level. The schema covers parameters richly, but the high-level invocation contract is incomplete.

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 description coverage is 100%, so the baseline is 3 with the schema doing the heavy lifting. The description adds the 'exactly one of prompt or promptParts' constraint, but this mutual exclusion is already stated in both parameter descriptions. It introduces no new parameter meaning beyond what the schema documents.

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 and resource ('Run an xAI Grok CLI request synchronously') and clarifies the execution mode. The provider (xAI Grok), the sync/async distinction, and the mandatory prompt/promptParts requirement sharply distinguish it from siblings like grok_request_async, claude_request, and the other provider request tools without needing to open the schema.

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?

Gives clear context on execution mode: the tool auto-defers to a pollable job past the sync deadline when async jobs are enabled, otherwise runs to completion. This effectively tells an agent when the call becomes async-like, but it never names grok_request_async as the explicit alternative for guaranteed-async cases, nor does it state when-not-to-use this tool. Clear context, no explicit exclusions.

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

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