Skip to main content
Glama
anaseqal

MCP Code Mode

by anaseqal

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault

No arguments

Capabilities

Features and capabilities supported by this server

CapabilityDetails
tools
{
  "listChanged": false
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
get_system_contextA

Get comprehensive system context before writing code.

CALL THIS FIRST to understand:

  • OS, Python version, available paths

  • Installed and available libraries

  • Execution mode (direct or Docker sandbox)

  • Past learnings from errors

  • Tips for writing effective code

Returns detailed system information formatted for code generation.

run_pythonA

Execute Python code to accomplish ANY task.

This is a universal tool - write Python to do what you need:

  • HTTP requests (requests, httpx, aiohttp)

  • Parse HTML (beautifulsoup4, lxml)

  • Process data (pandas, json, csv)

  • File operations (pathlib, shutil)

  • System commands (subprocess)

  • Images (Pillow, opencv)

  • And anything else Python can do!

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

Returns: Execution result with stdout, stderr, status, and any generated images

Example: code = ''' import requests resp = requests.get("https://api.github.com/users/octocat") data = resp.json() print(f"User: {data['login']}") print(f"Repos: {data['public_repos']}") '''

run_python_streamA

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.

run_with_retryA

Execute Python code with intelligent retry and error analysis.

On failure, this tool:

  1. Analyzes the error pattern

  2. Searches past learnings (both error-based and semantic) for solutions

  3. Provides diagnostic information

  4. Suggests fixes based on error type and similar objectives

IMPORTANT: Use record_semantic_failure() if code runs successfully but doesn't accomplish the objective. This helps the system learn from non-error failures.

Use this for more robust execution when errors are expected or when learning from previous similar tasks.

Args: code: Python code to execute description: Task description (helps find relevant semantic learnings) max_retries: Max retry attempts (same code) timeout: Execution timeout in seconds

Returns: Detailed execution result with retry info and suggestions from both error and semantic learnings

add_learningA

Record a learning from a code execution for future reference.

When you figure out how to fix an error, record it here. Future executions will suggest this solution for similar errors.

Args: error_pattern: Text/regex that matches the error message solution: What fixed the problem context: When this solution applies tags: Comma-separated tags (e.g., "network,ssl,https")

Example: add_learning( error_pattern="SSL: CERTIFICATE_VERIFY_FAILED", solution="Add verify=False to requests.get() or install certifi", context="HTTPS requests on systems with certificate issues", tags="ssl,https,certificates" )

Returns: Confirmation message

record_semantic_failureA

Record a semantic failure: when code executed successfully but didn't accomplish the goal.

This is different from error-based learning. Use this when:

  • Code ran without errors but produced wrong output

  • Tool was used but didn't achieve the intended objective

  • An approach worked technically but failed semantically

Args: objective: What you were trying to accomplish failed_approach: What you tried that didn't work (even though it ran) successful_approach: What actually worked to accomplish the objective context: Why the first approach failed or additional context tags: Comma-separated tags (e.g., "api,authentication,retry")

Example: record_semantic_failure( objective="Display image in Goose app", failed_approach="Used print() to output file path", successful_approach="Returned base64 encoded image as MCP content object", context="MCP clients need structured content objects, not just paths", tags="goose,mcp,display,images" )

Returns: Confirmation message

get_learningsA

View recorded learnings from past executions.

Args: search: Optional search term to filter learnings

Returns: Summary of learnings, optionally filtered

pip_installA

Pre-install a Python package.

Use this to install packages before execution if you know you'll need them, or if auto-install missed something.

Args: package_name: The pip package name to install

Returns: Installation result

configureA

View or update Code Mode configuration.

Args: action: "view" to see config, "set" to update a value key: Config key to update (for action="set") value: New value (for action="set")

Available settings:

  • execution_mode: "direct" (fast) or "docker" (secure sandbox)

  • default_timeout: Default execution timeout in seconds

  • max_retries: Default max retry attempts

  • auto_install: Whether to auto-install packages (true/false)

  • docker_image: Docker image for sandbox mode

Examples: configure() # View current config configure(action="set", key="execution_mode", value="docker") configure(action="set", key="default_timeout", value="120")

Returns: Current configuration or update confirmation

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription
context_resourceSystem context as a resource
learnings_resourceAll learnings as a resource
config_resourceCurrent configuration as a resource

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