Skip to main content
Glama

code_executor

Solve computational tasks by running Python code in a stateful sandbox, with support for common scientific libraries.

Instructions

Solve a task by letting Grok run Python in a stateful sandbox.

The agent iteratively writes and executes Python (with common scientific
libraries) to arrive at a numeric, data, or analysis answer.

Args:
    prompt: Task or question requiring computation.
    model: Grok model driving the agent (default `grok-4.3`).
    max_turns: Cap the number of reasoning/execution turns.
    show_usage: Append a token usage and cost footer to the answer (default False).

Returns:
    Markdown with the final answer followed by each code execution block's stdout.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelNogrok-4.3
promptYes
max_turnsNo
show_usageNo
Behavior3/5

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

No annotations are provided, so the description must disclose behavioral traits. It mentions the sandbox is stateful and iterative, and describes the return format. However, it omits details about sandbox lifetime, resource limits, error handling, or safety implications, which are important for a code execution tool.

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 concise (about 100 words) and well-structured: an overview sentence, a clear list of parameters with one-line explanations, and a return type description. No extraneous information.

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?

Given no output schema, the description adequately describes the return format (Markdown with answer and code blocks). It covers parameters and the high-level iterative process. However, it could include more details on stateful behavior and limitations for full completeness.

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?

The description adds meaning to all four parameters beyond the schema's bare titles. For example, 'prompt' is 'Task or question requiring computation,' and 'max_turns' is 'Cap the number of reasoning/execution turns.' Since schema description coverage is 0%, the description effectively compensates.

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 tool's purpose: 'Solve a task by letting Grok run Python in a stateful sandbox.' It specifies the action (solving tasks via Python execution) and distinguishes it from sibling tools like chat or image generation, which are not computation-focused.

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 implies the tool is for computational tasks ('numeric, data, or analysis answer') but does not explicitly contrast with alternatives like 'grok_agent' or provide when-not-to-use guidance. It offers clear context but lacks explicit usage boundaries.

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/merterbak/Grok-MCP'

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