Skip to main content
Glama

Gemini Run Code Tool

gemini_run_code_tool

Execute Python code with Gemini to answer questions, perform calculations, or process data. Provide a prompt and optional data, and it writes and runs the code.

Instructions

Execute code using Gemini's built-in code execution.

Gemini writes and runs Python code to answer questions, perform calculations, or process data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataNoOptional data to process.
modelNoModel to use.flash
promptYesDescription of what code to write and run.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.0

TDQS

B3.4/5.0
Behavior3/5

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

No annotations are provided, so the description carries the full behavioral burden. It does disclose the non-obvious fact that Gemini generates and executes the code itself rather than the caller supplying it, which matters for prompt design. It says nothing about sandboxing, execution isolation, network/filesystem access, or side effects — material traits 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.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two short sentences, front-loaded with the core action and followed by the clarifying mechanic. No padding or restatement of the tool name, though the second sentence is close to restating the first with examples.

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

Completeness3/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 need not be described. However, with zero annotation coverage on a tool that executes arbitrary generated code, the definition should address execution safety, permissions, or environment constraints; that gap leaves the agent under-informed for a tool of this risk profile.

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 schema already documents prompt, model, and data. The description's framing of the prompt ('what code to write and run') is consistent with and mildly reinforcing of the schema, but adds no new syntax, format, or constraint detail. Baseline 3 applies when the schema does the heavy lifting.

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 description names a specific verb (execute) and resource (Python code written and run by Gemini), and clarifies the unusual mechanic that the model authors the code from a prompt. It does not, however, differentiate itself from the closest sibling, gemini_analyze_code_tool, which an agent could easily confuse with a run/execute tool.

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?

Usage is only implied through the examples 'answer questions, perform calculations, or process data' — reasonable context but no explicit when-to-use or when-not-to-use. With a large sibling set including gemini_query_tool, gemini_analyze_code_tool, and gemini_structured_tool, a routing hint is conspicuously absent.

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