Search Simulations
search_simulationsSearch past simulations by topic, project name, or simulation ID to retrieve results from previous runs.
Instructions
Search past simulations by topic, project name, or simulation ID.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search term — matches against simulation ID, project name, or requirement |
Implementation Reference
- mcp-server/src/tools/search-simulations.ts:13-53 (registration)Registration of the tool 'search_simulations' on the MCP server, with input schema, description, annotations, and handler.
export function registerSearchSimulations(server: McpServer, client: MirofishClient): void { server.registerTool( "search_simulations", { title: "Search Simulations", description: "Search past simulations by topic, project name, or simulation ID.", inputSchema, annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: false }, }, async (args) => { try { const results = await client.searchSimulations(args.query); return { content: [ { type: "text" as const, text: JSON.stringify( { query: args.query, results_count: results.length, simulations: results.map((s) => ({ simulation_id: s.simulation_id, project_name: s.project_name, requirement: s.simulation_requirement, state: s.state, created_at: s.created_at, })), }, null, 2, ), }, ], }; } catch (err) { throw toMcpError(err); } }, ); } - Handler function that calls client.searchSimulations(args.query) and returns formatted results (simulation_id, project_name, requirement, state, created_at).
async (args) => { try { const results = await client.searchSimulations(args.query); return { content: [ { type: "text" as const, text: JSON.stringify( { query: args.query, results_count: results.length, simulations: results.map((s) => ({ simulation_id: s.simulation_id, project_name: s.project_name, requirement: s.simulation_requirement, state: s.state, created_at: s.created_at, })), }, null, 2, ), }, ], }; } catch (err) { throw toMcpError(err); } }, - Input schema: 'query' is a required string with a min length of 1, used to match against simulation ID, project name, or requirement.
const inputSchema = { query: z.string().min(1).describe("Search term — matches against simulation ID, project name, or requirement"), }; - Client-side search implementation: fetches up to 100 simulations via listSimulations, then filters client-side by matching query (case-insensitive) against simulation_id, project_name, or simulation_requirement.
async searchSimulations(query: string): Promise<SimulationSummary[]> { // Backend doesn't have a search endpoint yet — fetch and filter client-side. const { simulations } = await this.listSimulations(100); const q = query.toLowerCase(); return simulations.filter((s) => (s.simulation_requirement ?? "").toLowerCase().includes(q) || (s.project_name ?? "").toLowerCase().includes(q) || s.simulation_id.toLowerCase().includes(q), ); } - SimulationSummary interface: defines the shape of each simulation result returned by searchSimulations.
export interface SimulationSummary { simulation_id: string; project_id: string; project_name?: string; simulation_requirement?: string; state: SimState; entities_count?: number; created_at: string; }