Overview
Simulations define test scenarios for your resources—combining tool definitions, mock data, and platform state. They can be used with the ChatGPTSimulator for local development or runMCPServer for platform testing with hosts like ChatGPT.- Framework (JSON)
- Library (TypeScript)
In the sunpeak framework, simulations are JSON files that live in the For example:Each simulation can have different
tests/simulations/ directory. The resource URL and metadata are automatically linked based on directory structure.File Naming Convention
Simulation files live intests/simulations/{name}/:tests/simulations/albums/albums-show-simulation.jsontests/simulations/review/review-diff-simulation.jsontests/simulations/review/review-post-simulation.json
src/resources/{name}/:- Component + Metadata:
src/resources/{name}/{name}-resource.tsx(exports both the React component andexport const resource: ResourceConfig)
albums-show-simulation.json and albums-empty-simulation.json in the same folder).JSON Schema
Each simulation JSON file contains:Auto-Discovery
The framework automatically discovers and links simulations:- Discovery: Scans
tests/simulations/{name}/folders for*-simulation.jsonfiles - Linking: Simulations are automatically linked to the corresponding resource in
src/resources/{name}/ - No imports needed: Everything is wired automatically
- Import resource metadata into simulations
- Specify
resourcein the simulation JSON - Maintain an index file of simulations
Multiple Scenarios
Create multiple simulations per resource to test different scenarios:toolResult.structuredContent to test various data scenarios.Properties
Unique identifier for the simulation. Used to select simulations in the UI and URL parameters. (Library only - auto-generated from filename in framework)
URL to the resource HTML page for dev mode (with Vite HMR). (Library only - auto-linked in framework)
URL to the resource JS bundle for prod mode. (Library only - auto-linked in framework)
A decorative message shown in the simulator interface. Has no functional purpose.
MCP Tool definition from
@modelcontextprotocol/sdk. Defines the tool’s name, description, input schema, and metadata.MCP Resource definition from
@modelcontextprotocol/sdk. Defines the resource’s name, URI, MIME type, and metadata. (Library only - auto-linked in framework)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().MCP SDK Types
The simulation interface uses official types from@modelcontextprotocol/sdk:
Tool
Resource
See Also
ChatGPTSimulator
Component API reference.
runMCPServer
MCP server API reference.