Skip to main content
Glama

grok_code_reasoning

Debug code, review architecture, and analyze quantitative or data problems with Grok reasoning; optionally execute Python calculations or search the web to verify APIs and CVEs.

Instructions

Use Grok's frontier reasoning model for debugging, architecture review, or quantitative analysis.

Args: prompt: Code snippet, bug report, math/data problem, or architecture question. model: Optional xAI model ID (defaults to XAI_REASONING_MODEL / grok-4.7). enable_code_interpreter: Allow Grok to execute Python on xAI's server-side sandbox to verify calculations. enable_web_search: Also enable live web search (e.g., to verify latest library APIs or CVEs).

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "prompt": "<prompt>"
    },
    "name": "grok_code_reasoning"
  }
}

Input Schema

NameRequiredDescriptionDefault
modelNo
promptYes
enable_web_searchNo
enable_code_interpreterNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.8/5.0
Behavior3/5

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

With no annotations, the description carries the full burden. It usefully discloses that code is executed in Python on xAI's server-side sandbox and that web search is live, which are real behavioral traits. It says nothing about latency, cost, rate limits, credential/config requirements, or the consequences of sending proprietary code to a third party, which matters for this kind of tool.

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?

One front-loaded purpose sentence followed by a clean Args block; each line carries information rather than restating the schema verbatim. The 'Args:' formatting is docstring-style and slightly verbose for a tool description, but nothing is wasteful.

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?

An output schema exists, so return values needn't be explained, and all four inputs are covered. What's missing is operational context for an external-service call: cost/latency expectations and any configuration prerequisites implied by the XAI_REASONING_MODEL default.

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?

Schema description coverage is 0%, so the description must compensate, and it largely does: all four parameters get meaning, including the model default chain (XAI_REASONING_MODEL / grok-4.7) that the schema only expresses as null, and what each boolean actually enables. It does not specify accepted model ID formats or sandbox limits, so not a full 5.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The opening sentence names the resource (Grok's frontier reasoning model) and the concrete jobs it handles: debugging, architecture review, quantitative analysis. An agent can tell this is a delegation-to-external-model tool. It never names or contrasts with the siblings ask_grok_realtime or search_x_posts, so differentiation is left to the reader.

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?

It gives clear triggering contexts (bug report, architecture question, math/data problem) and a targeted rationale for enable_web_search ('to verify latest library APIs or CVEs'). There are no explicit when-not-to-use statements or routing rules toward the sibling tools, which keeps it below a 5.

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