Skip to main content
Glama
DumplingAI

Dumpling AI MCP Server

Official
by DumplingAI

run-python-code

Execute Python code in a sandbox to test scripts, process data, or run computations with configurable memory, timeout, and JSON parsing options.

Instructions

Execute Python code in a sandbox.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesPython code
commandsNoPip install commands
parseJsonNoParse output as JSON
timeoutNoExecution timeout in ms
memoryNoMemory allocation in MB
saveOutputFilesNoSave output files

Implementation Reference

  • The handler function that implements the logic for the 'run-python-code' tool by proxying the request to the Dumpling AI API endpoint for executing Python code in a sandbox.
    async ({ code, commands, parseJson, timeout, memory, saveOutputFiles }) => {
      const apiKey = process.env.DUMPLING_API_KEY;
      if (!apiKey) throw new Error("DUMPLING_API_KEY not set");
      const response = await fetch(`${NWS_API_BASE}/api/v1/run-python-code`, {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          Authorization: `Bearer ${apiKey}`,
        },
        body: JSON.stringify({
          code,
          commands,
          parseJson,
          timeout,
          memory,
          saveOutputFiles,
        }),
      });
      if (!response.ok)
        throw new Error(`Failed: ${response.status} ${await response.text()}`);
      const data = await response.json();
      return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
    }
  • Zod schema defining the input parameters for the 'run-python-code' tool including code, optional pip commands, JSON parsing flag, timeout, memory, and file saving options.
      code: z.string().describe("Python code"),
      commands: z.string().optional().describe("Pip install commands"),
      parseJson: z.boolean().optional().describe("Parse output as JSON"),
      timeout: z.number().optional().describe("Execution timeout in ms"),
      memory: z.number().optional().describe("Memory allocation in MB"),
      saveOutputFiles: z.boolean().optional().describe("Save output files"),
    },
  • src/index.ts:1018-1021 (registration)
    Registration of the 'run-python-code' tool using server.tool() with its name, description, schema, and handler function.
    server.tool(
      "run-python-code",
      "Execute Python code in a sandbox.",
      {
Behavior2/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. It mentions 'sandbox' which hints at isolation, but doesn't specify execution limits, error handling, output format, or security implications. For a code execution tool with zero annotation coverage, this leaves significant behavioral gaps.

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 a single, efficient sentence that directly states the tool's function without unnecessary words. It's front-loaded with the core purpose and avoids any redundant information, making it highly concise and well-structured.

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

Completeness2/5

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

Given the complexity of executing arbitrary Python code and the lack of annotations and output schema, the description is insufficient. It doesn't cover critical aspects like execution environment details, safety guarantees, error responses, or output handling, leaving the agent with incomplete context for safe and effective use.

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%, providing clear documentation for all 6 parameters. The description doesn't add any parameter-specific context beyond what's in the schema, such as examples or constraints. With high schema coverage, the baseline score of 3 is appropriate as the schema handles the heavy lifting.

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 description clearly states the action ('Execute') and resource ('Python code in a sandbox'), making the purpose immediately understandable. It distinguishes from sibling 'run-js-code' by specifying Python, though it doesn't explicitly contrast with other execution or processing tools like 'extract' or 'generate-agent-completion'.

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 explicit guidance on when to use this tool versus alternatives is provided. The description doesn't mention when to choose this over 'run-js-code' for scripting, or when to prefer other processing tools like 'extract' or 'generate-agent-completion' for specific tasks. Usage is implied but not articulated.

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/DumplingAI/mcp-server-dumplingai'

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