Skip to main content
Glama
anaseqal

MCP Code Mode

by anaseqal

run_python_stream

Stream Python code execution output in real time, eliminating delays in monitoring long-running tasks like scraping or processing.

Instructions

Execute Python code with REAL-TIME STREAMING OUTPUT.

Perfect for long-running tasks where you want to see progress as it happens:

  • Web scraping multiple pages (see each page as it's scraped)

  • Data processing loops (see progress through large datasets)

  • API calls with retries (see each attempt)

  • File operations (see each file as it's processed)

  • Long computations (see intermediate results)

Output streams in real-time as the code executes, so you see results immediately instead of waiting for the entire execution to complete.

Args: code: Python code to execute. Use print() liberally for progress updates. description: Brief task description (for logging) timeout: Max execution time in seconds auto_install: Auto-install missing packages

Returns: Streaming output followed by execution summary, with any generated images

Example: code = ''' import time for i in range(5): print(f"Processing item {i+1}/5...") time.sleep(1) print("✓ Done!") '''

The output will appear line-by-line as the code runs, not all at once at the end.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes
descriptionNo
timeoutNo
auto_installNo
Behavior4/5

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

With no annotations, the description fully describes the streaming behavior, the role of print statements, and the output format (streaming, summary, images). It provides a concrete example demonstrating real-time output. No critical behavioral traits are missing.

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?

The description is well-structured with headers, bullet points, and an example. It is somewhat verbose but every part adds value. The purpose is front-loaded, and the organization aids readability.

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?

Given no output schema, the description explains the return format clearly. It covers usage patterns, parameter semantics, and provides an example. For a 4-parameter tool with no annotations, it is fairly complete, though a brief note on error behavior would enhance it.

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 coverage is 0%, so the description must compensate. It explains that 'code' should use print(), 'description' is for logging, 'timeout' is max execution time, and 'auto_install' handles missing packages. However, it does not provide detailed parameter constraints or formats beyond schema types, so value added is moderate.

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 executes Python code with real-time streaming output, distinguishing it from siblings like 'run_python' and 'pip_install'. It uses specific verbs and resources, making the purpose unambiguous.

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 multiple use cases (e.g., web scraping, data processing loops) and explains when streaming is beneficial. However, it does not explicitly state when not to use the tool (e.g., for short tasks or non-streaming needs), but the context is clear enough for an AI agent.

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/anaseqal/codemode'

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