Overview
Simulations define test scenarios for your resources—combining tool definitions, mock data, and platform state. They can be used with the Inspector for local development or runMCPServer for platform testing with hosts like ChatGPT and Claude. Simulations are JSON files that live in thetests/simulations/ directory. Each simulation references a tool file by name — tool metadata and resource linkage are handled by the tool files in src/tools/.
File Convention
Simulation files live in a flattests/simulations/ directory:
tests/simulations/show-albums.jsontests/simulations/review-diff.jsontests/simulations/review-post.json
*.json filename works. Multiple simulations can reference the same tool with different fixture data.
Tool files live in src/tools/:
- Each
.tsfile exportstool(metadata with optional resource link),schema(Zod), and adefaulthandler.
src/resources/{name}/:
- Component + Metadata:
src/resources/{name}/{name}.tsx(exports both the React component andexport const resource: ResourceConfig)
JSON Schema
Each simulation JSON file contains:tool field is a string referencing a tool filename (without .ts) in src/tools/. Tool metadata (name, description, schema, annotations, visibility) lives in the tool file, not in the simulation.
Auto-Discovery
The framework automatically discovers and links everything:- Tools: Scans
src/tools/*.tsfor tool files with metadata, schemas, and handlers - Simulations: Scans
tests/simulations/*.jsonand links each to its tool via thetoolstring field - Resources: Each tool file references its resource by directory name (e.g.,
resource: 'albums')
- Duplicate tool metadata in simulations
- Import resource metadata into simulations
- Maintain an index file of simulations or tools
Multiple Scenarios
Create multiple simulations for the same tool to test different scenarios:toolInput and toolResult.structuredContent to test various data scenarios.
Mocking Server Tool Calls
When a resource callscallServerTool (e.g., the review resource calling a backend-only “review” tool), the inspector needs mock responses. Instead of separate simulation files for each backend tool response, you define mock responses inline using the serverTools field on the resource’s simulation.
serverTools map supports two forms:
Simple form — always return the same result:
when object does shallow key matching against the tool call arguments. The first entry whose keys all match wins.
Use structuredContent in the result to return structured data to the calling resource. For example, the review tool returns { status: 'success', message: '...' } or { status: 'cancelled', message: '...' } — the review resource reads status to determine success/error styling and displays message. Use isError: true only for actual tool execution failures.
Properties
Unique identifier for the simulation. Auto-generated from the filename.
A decorative message shown in the inspector interface. Has no functional purpose.
A string referencing a tool filename (without
.ts) in src/tools/.Mock input parameters for the tool call. Accessible via
useToolData().Mock data for the tool response. The
structuredContent property is passed to your component via useToolData().Initial host context for the simulation. Accessible via
useHostContext().Mock responses for
callServerTool calls made by the resource. Keys are tool names. Values are either a single CallToolResult (always returned) or an array of { when, result } entries for argument-based conditional matching.MCP SDK Types
The simulation interface uses official types from@modelcontextprotocol/sdk:
Tool
Tool Visibility
Thetool._meta.ui.visibility field controls which contexts can invoke the tool:
"model"— The AI model can call this tool"app"— The app can call this tool (viauseCallServerTool)
Resource
Resource Metadata (_meta.ui)
The resource._meta.ui field configures resource rendering behavior:
Permissions
allow attribute directives. Only declared permissions are enabled.
CSP
See Also
Inspector
Component API reference.
runMCPServer
MCP server API reference.