Skip to main content
Glama

execute_program

Execute Python programs that call multiple MCP tools in sequence, handling loops, conditional logic, and data aggregation while keeping intermediate results local to reduce latency.

Instructions

Execute a Python program with access to MCP tools as async functions. Tool calls within the script are dispatched to their respective MCP servers. Only stdout (from print statements) is returned — intermediate tool results do not enter the conversation context. Use this when a task involves 3+ tool calls, loops, filtering, aggregation, or conditional logic based on intermediate results. For single tool calls, call the tool directly. All tool functions require await.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesPython code to execute. MCP tools are available as async functions using their namespaced names (e.g., mcp__financial_data__query_financials). Use `await` for all tool calls. Use `print()` to produce output.
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 and does so effectively. It explains key behavioral traits: tool calls are dispatched to MCP servers, only stdout from print statements is returned (not intermediate results), and all tool functions require await. It doesn't cover potential limitations like execution timeouts or error handling, but provides substantial operational context.

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 efficiently structured with zero wasted sentences. It front-loads the core purpose, then explains behavioral constraints, followed by clear usage guidelines. Every sentence adds essential information about how the tool works and when to use it.

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 a single parameter, the description provides comprehensive context about the tool's behavior, constraints, and appropriate usage. It explains the execution model, output limitations, and programming requirements. The main gap is lack of information about return format or error conditions, but overall it's quite complete for this complexity level.

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 the single 'code' parameter. The description adds some context about how MCP tools are accessed within the code (namespaced names) and the requirement to use print() for output, but doesn't provide significant additional parameter semantics beyond what the schema indicates.

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 ('execute a Python program') and resources ('with access to MCP tools as async functions'). It distinguishes this tool's unique capability of running multi-step scripts with tool integration from direct tool calls, even though there are no sibling tools to differentiate from.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use this tool ('when a task involves 3+ tool calls, loops, filtering, aggregation, or conditional logic based on intermediate results') and when not to use it ('for single tool calls, call the tool directly'). It clearly defines the appropriate context and alternatives.

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/gallanoe/ptc-mcp'

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