Skip to main content
Glama

workbench_run_python

Read-onlyIdempotent

Run Python in an isolated sandbox to process LARGE or paginated tool results without pulling every row into the conversation. Inside the code, call your connected integration tools with call_tool('ext<id>_<name>', {..}), or this agent's own platform tools by their dotted id (e.g. call_tool('db.query', {'sql': 'SELECT ...'})) — a platform tool must be in the agent's allowed_tools, and calling one requires an agent context. RETURN SHAPE: call_tool ALWAYS returns a dict with a boolean r['success']. The payload key DIFFERS by tool kind: integration (ext*) results are under r['body'] (e.g. r['body']['results']), platform tools are under r['data'] (e.g. r['data']['rows'] for db.query). Reading the wrong key returns nothing even though the call SUCCEEDED — so when in doubt print(r) once and inspect before extracting. On FAILURE r['success'] is False and r['error'] explains. Aggregate/filter/paginate in the sandbox, then assign ONLY the small summary you want back to a variable named result. FIRST discover exact tool slugs with integrations_search_tools, THEN write code that calls them. pandas/numpy available.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesPython source to execute. call_tool(slug, {..}) returns a dict: for integrations ('ext<id>_<name>') the HTTP payload is under r['body'] (e.g. r['body']['results']); for platform tools (dotted ids like 'db.query') it is under r['data'] (e.g. r['data']['rows']). Failure is {'success': False, 'error': ...}. Assign the small summary to `result`. pandas/numpy available.
agent_idNoWhich agent's tool policy the sandbox runs under — this scopes which ext* integrations call_tool may reach (enabled + denied_tools for that agent). Only needed when calling this tool OUTSIDE a normal agent run (e.g. directly from an external MCP client); during an agent run the running agent is used and this is ignored. Without it, call_tool can reach no integrations.
in_workspaceNoRun this one call in this workspace id instead of the session's. Nothing is stored; other sessions are not affected.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / in_workspace
      Added value: +{
      +  "description": "Run this one call in this workspace id instead of the session's. Nothing is stored; other sessions are not affected.",
      +  "type": "integer"
      +}
  2. Added
  3. Removed
  4. Added

TDQS

A4.3/5.0
Behavior5/5

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

Annotations cover only the safety profile (readOnly/idempotent/openWorld); the description goes well beyond by disclosing the call_tool return contract (r['success'], r['body'] vs r['data'] per tool kind), the failure shape (r['error']), the allowed_tools + agent-context requirement for platform tools, and the 'assign to `result`' output convention. These are non-obvious behaviors an agent would otherwise get wrong.

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?

Front-loaded with purpose, then mechanics, then the discovery step. Dense and mostly earned, though the return-shape detail is repeated almost verbatim in the schema's `code` description, so some redundancy exists.

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 complex, no-output-schema execution tool it covers return shape, failure mode, output convention, and tool-discovery workflow. It omits practical runtime details an agent might want (execution timeout, resource limits, whether sandbox files/state persist across calls), which keeps it short of 5.

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 all three params are already documented in the schema, and the description largely restates the `code` contract. It adds the behavioral note that a platform tool must be in allowed_tools and that without agent_id no integrations are reachable, but that is more behavioral than parameter-level. Baseline 3 applies.

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?

States a specific verb+resource+mechanism ('Run Python in an isolated sandbox') and immediately scopes the use case ('process LARGE or paginated tool results without pulling every row into the conversation'). No sibling in the list does code execution, so the agent can distinguish it instantly.

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?

Gives clear context for when to reach for it (large/paginated results that shouldn't enter the conversation) and an explicit prerequisite workflow ('FIRST discover exact tool slugs with integrations_search_tools, THEN write code'). It lacks an explicit when-NOT (e.g. use db_query directly for a small result), which keeps it from a 5.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.