Skip to main content
Glama

code_executor

Execute Python code in a sandbox to solve computational tasks, analyze data, or perform scientific calculations through iterative reasoning and execution.

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-1-fast-reasoning`).
    max_turns: Cap the number of reasoning/execution turns.

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYes
modelNogrok-4-1-fast-reasoning
max_turnsNo
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behavioral traits: the iterative nature of the tool ('iteratively writes and executes'), the stateful sandbox environment, the types of answers expected ('numeric, data, or analysis'), and the output format. However, it doesn't mention potential limitations like execution timeouts, memory constraints, or security restrictions.

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 well-structured and appropriately sized. It begins with a high-level purpose statement, then explains the execution approach, followed by clear parameter explanations and return value description. Every sentence earns its place with no wasted words.

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?

For a tool with no annotations, no output schema, and 0% schema description coverage, the description does an excellent job covering the essential context. It explains the tool's behavior, parameters, and return format. The only minor gap is not explicitly mentioning what happens when max_turns is null or what common scientific libraries are available.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description fully compensates by providing clear semantic explanations for all three parameters. It explains what 'prompt' should contain, what 'model' represents with a default value, and what 'max_turns' controls. The description adds significant value beyond the bare schema.

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 with specific verbs ('solve a task', 'run Python in a stateful sandbox') and resources ('Python with common scientific libraries'). It distinguishes itself from siblings by focusing on computational problem-solving rather than chat, file management, or search functions.

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 provides clear context for when to use this tool ('task or question requiring computation'), but doesn't explicitly state when NOT to use it or name specific alternatives among the sibling tools. The guidance is helpful but lacks explicit exclusions or comparisons.

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