Skip to main content
Glama

Foundry MCP code mode

execute

Destructive

Run a script against the connected Foundry world with the full foundry.* API — reads, writes and deletes. code is the body of an async function (see docs): call foundry..({ ... }), use await, console.log, and return what you want back (JSON, size-limited). Before it runs, a static check refuses the script if it calls a method your tier lacks, an unknown method, or accesses foundry dynamically — the answer lists each with its line. allowPartial: true runs it anyway and each locked call fails inside the script. Writes count against per-script budgets (the limits line of the docs index); the trace lists every call with the ids it touched. Nothing is rolled back when a script fails part-way: the trace shows what already happened — continue from it rather than re-running everything.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesBody of an async function, e.g. `const a = await foundry.actors.create({ name: "Guard", type: "npc" }); return a.id;`
debugNoKeep the script and its report for the world owner's diagnostics (default false)
allowPartialNoRun even if the static check finds locked or computed calls; each locked call then fails at runtime (default false)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.5/5.0
Behavior5/5

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

Annotations already mark the tool destructive, but the description goes further, disclosing that nothing is rolled back on partial failure, that writes count against per-script budgets, and that a trace lists all calls with touched IDs. It also explains the static check's refusal behavior and the allowPartial fallback. These traits—especially non-rollback and budget limits—are critical for an agent to anticipate side effects and are not present in the annotations.

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 long but every sentence delivers distinct, essential information: purpose, code format, static check, allowPartial, budgets, trace, and rollback semantics. It front-loads the primary purpose before diving into nuance, and the structure follows a natural logical flow from what it does to how it behaves. No filler is present; the length is proportionate to the tool's complexity.

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 tool without an output schema and with three parameters, the description covers all necessary aspects: the execution environment, the required code format, the safety checks, error handling with allowPartial, resource limits, and the non-rollback behavior. It even points to the docs for budget limits. There are no obvious gaps an agent needs to call it correctly.

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?

The schema provides 100% parameter descriptions, including an example for `code`. The tool description adds substantial value by specifying that `code` is an async function body using the foundry.* API, requiring await and console.log for debugging, and that the return is size-limited JSON. It also clarifies `allowPartial` behavior beyond the schema's one-line description. Because the schema already covers the basics, a 3 is the baseline; the extra detail on code format and partial execution justifies a 4.

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 opens with a clear verb-resource pair—'Run a script against the connected Foundry world'—and explicitly notes it covers reads, writes, and deletes. This distinguishes it from the sibling `query` tool, which presumably handles read-only access, and from `docs`. The specificity leaves no ambiguity about what the tool does.

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?

The description explains the mechanics of static checks and allowPartial, giving context on when to use them, but it never explicitly tells the agent when to prefer `query` for read-only operations. Given that `execute` counts writes against budgets, guidance to route simple reads to `query` would be valuable. Without that, the tool is presented as the go-to for any script, which may lead to overuse for read-only tasks.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources