Foundry MCP code mode
Server Details
Code mode (preview): the AI writes a script against a typed foundry.* API and runs it in a sandbox.
- Status
- Healthy
- Uptime
- 100.0% over the last 24 hours
- Last Tested
- Transport
- Streamable HTTP Β· MCP 2025-11-25
- URL
- ChatGPT
- β
- Claude
- β
TDQS
Scored across 3 tools
The three tools occupy clearly separate roles: docs is a static reference lookup, query is read-only script execution, and execute allows writes. Descriptions explicitly cross-reference each other (docs for the API, query says 'use execute' for writes), leaving no realistic path to misselection.
All names are short, lowercase, single-token, and predictable, but 'docs' is a noun while 'query' and 'execute' are verbs, a minor stylistic deviation from a uniform verb pattern.
Three tools is exactly right for a code-mode server: one reference surface, one read path, one write path. Each tool has a distinct, non-redundant purpose and nothing feels padded or missing at the surface level.
Reference discovery, read execution, and write execution are all covered, including truncation and partial-failure signals in the trace. Minor gaps exist: no explicit rollback/transaction tool and no discovery of available worlds or connection state, though docs mitigates the former by instructing continuation from traces.
Available Tools
3 toolsdocsARead-onlyIdempotentInspect
Reference for the foundry.* API used in query and execute scripts. No arguments: the index β every domain with its methods for this world's game system; π marks methods above your tier. With domain (e.g. "actors"): the TypeScript declarations of that domain with parameter and result types. With type (e.g. "ActorSummary"): one named type. Read the domain declarations before writing a script; every method takes one object argument and returns a Promise.
Inputs: type, domain.
executeADestructiveInspect
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.
Inputs: code (required), debug, allowPartial.
queryARead-onlyIdempotentInspect
Run a read-only script against the connected Foundry world. code is the body of an async function: call foundry..({ ... }) (see docs), use await, console.log, and return the value you want back (JSON, size-limited). Only read methods are bound; writes are not available here β use execute. Every call counts against the per-script limits shown in the docs index (calls, wall time, CPU time, result size); an oversized call result arrives as { __truncated: true, bytes, limit, preview }.
Inputs: code (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
Related MCP Connectors
Beta code sandbox for agents. Run Python or JavaScript with no network and a 30 s timeout.
Build Apps and run code in 30 languages β sandboxed, with persistent sessions for agent loops.
Write, type-check and run AILANG in a sandbox, with Z3-proved contracts and docs search.
Connect any AI to your Foundry VTT world: actors, combat, dice, journals, tokens, compendiums.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceProvides sandboxed code execution for AI agents with support for Python, JavaScript, and shell commands. Includes comprehensive safety features like destructive pattern blocking, timeout protection, and restricted file access for secure production use.35 PyPIMIT
- AlicenseAqualityDmaintenanceEnables AI assistants to execute code in isolated sandboxes with support for Python, JavaScript, and TypeScript, featuring intelligent caching and semantic search for code reuse.9MIT
- AlicenseNot gradedqualityBmaintenanceEnables building safe, programmable Code Mode MCP servers from upstream tool sources, with model-authored TypeScript running in a sandbox and tool calls routed to trusted host-side providers.1Apache 2.0

@roarkanalytics/sdk-mcpofficial
AlicenseNot gradedqualityBmaintenanceEnables AI agents to interact with the Roark API by writing and executing TypeScript SDK code in an isolated sandbox, with built-in documentation search to guide those tasks.3,258 npmApache 2.0
Glama MCP Gateway
Add one secure layer between your agents and this server.