Skip to main content
Glama
smol-codeact-mcp

smol-codeact-mcp

by nanyun818

codeact_execute

Execute multi-step Python logic in a stateful AST sandbox with persistent session variables and workspace-jailed read-only helpers for listing, reading, and searching files.

Instructions

Execute multi-step Python logic inside a stateful, zero-exec() AST sandbox. Variables persist across calls per session_id. Includes workspace-jailed read-only helpers: list_files(pattern), read_lines(rel_path, start, end), grep_files(regex, glob_filter).

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "code": "<code>"
    },
    "name": "codeact_execute"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesPython snippet to execute in the AST sandbox.
session_idNoStateful session namespace.default
reset_beforeNoClear session state before run.
max_operationsNoElementary AST node cap.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.4/5.0
Behavior2/5

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

With no annotations at all, the description carries the full burden, and it does disclose important traits: statefulness, per-session_id variable persistence, a zero-exec() AST sandbox, and workspace-jailed read-only helpers. However it says nothing about what the call returns (stdout, expression value, error/traceback shape), how failures surface, or what happens when max_operations is exceeded — all critical for a code-execution tool with no output schema.

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?

Three tight sentences, front-loaded with the core action and sandbox semantics before the statefulness note and the helper list. No filler or restated title; every sentence conveys distinct information.

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

Completeness3/5

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

For a complex execution tool with no annotations and no output schema, the definition covers the sandbox model, state persistence, and available helpers well. The notable hole is return/error semantics: an agent cannot tell whether it receives stdout, a return value, or a traceback, nor how the max_operations cap manifests, which is a real gap for a code runner.

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 100%, so the baseline is 3, and the description meaningfully adds to it by explaining that session_id namespaces persistent variables across calls rather than being an opaque identifier. It also documents an API surface not present in the schema at all — the list_files, read_lines, and grep_files helpers with their signatures. reset_before and max_operations are left to the schema, which is acceptable given full coverage.

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?

States a concrete verb and resource: executing multi-step Python in a stateful, zero-exec() AST sandbox, with per-session variable persistence. That is specific enough to distinguish it from codeact_reset_session and codeact_inspect_state by implication, but the description never names a sibling or explicitly frames itself as the 'run code' counterpart to codeact_compile_stubs.

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

Usage Guidelines3/5

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

Usage is only implied: the persistence and helper-function details suggest when a stateful execution call is appropriate, and reset_before hints that a fresh session is an option. There is no explicit when-to-use or when-not guidance, and no pointer to codeact_inspect_state for checking state or codeact_reset_session as the alternative to reset_before.

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