Skip to main content
Glama

colab_code_execute

Execute Python code in a Colab session with optional timeout and environment variables, returning stdout, stderr, exit code, and execution time.

Instructions

Execute Python code in a Colab session via stdin pipe.

Args: session: Session display name code: Python code to execute timeout: Execution timeout in seconds (1-300, default: 30) env: Environment variables to set before execution

Returns: Execution result with stdout, stderr, exit_code, execution_time

Raises: ToolError: SESSION_NOT_FOUND, EXECUTION_TIMEOUT, KERNEL_ERROR, AUTH_EXPIRED, QUOTA_EXCEEDED, CLI_ERROR

Input Schema

NameRequiredDescriptionDefault
envNo
codeYes
sessionYes
timeoutNo

Output Schema

NameRequiredDescriptionDefault
stderrYesStandard error from execution
stdoutYesStandard output from execution
exit_codeYesProcess exit code (0 = success)
execution_timeYesExecution time in seconds

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.7/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does substantial work: it enumerates concrete failure modes (SESSION_NOT_FOUND, EXECUTION_TIMEOUT, KERNEL_ERROR, AUTH_EXPIRED, QUOTA_EXCEEDED, CLI_ERROR) and states the timeout bounds 1-300. It omits whether code runs in a persistent kernel state or is idempotent/reversible, which matters for an arbitrary-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?

One front-loaded sentence establishes the operation, followed by structured Args/Returns/Raises blocks. No filler, though the Returns block partially duplicates the output schema.

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

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 4-parameter code-execution tool with no annotations, the definition supplies argument meanings, timeout bounds, return fields, and a full error taxonomy. An agent has enough to invoke it correctly without opening the schema.

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?

Schema coverage is 0%, so the description must compensate, and it does: all four parameters are addressed, including the timeout range and default (1-300, default 30) which the schema omits. The 'env' description ('Environment variables to set before execution') is brief but conveys the semantics the bare schema lacks.

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 first sentence names a specific verb and resource ('Execute Python code in a Colab session') plus the transport mechanism (stdin pipe). It doesn't explicitly differentiate from the sibling colab_file_execute, so an agent must infer the distinction.

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

Usage Guidelines2/5

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

No statement of when to use this versus colab_file_execute or when a session must first be created. The 'via stdin pipe' clause hints at mechanism but does not guide tool selection or state prerequisites.

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