Skip to main content
Glama

List Simulations

list_simulations
Read-only

Retrieve past simulation runs with status and metadata to track and analyze community reaction predictions.

Instructions

List past simulation runs with their status and metadata.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMax results to return (default 20)

Implementation Reference

  • MCP tool handler: registers the 'list_simulations' tool with input schema (limit), calls client.listSimulations(), and returns formatted JSON with total and simulation details.
    export function registerListSimulations(server: McpServer, client: MirofishClient): void {
      server.registerTool(
        "list_simulations",
        {
          title: "List Simulations",
          description: "List past simulation runs with their status and metadata.",
          inputSchema,
          annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: false },
        },
        async (args) => {
          try {
            const { simulations, total } = await client.listSimulations(args.limit ?? 20);
    
            const result = {
              total,
              simulations: simulations.map((s) => ({
                simulation_id: s.simulation_id,
                project_name: s.project_name,
                state: s.state,
                entities_count: s.entities_count,
                created_at: s.created_at,
              })),
            };
    
            return { content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }] };
          } catch (err) {
            throw toMcpError(err);
          }
        },
      );
    }
  • Zod input schema for the tool: optional 'limit' (coerced int, 1-100, default 20).
    const inputSchema = {
      limit: z.coerce.number().int().min(1).max(100).optional().describe("Max results to return (default 20)"),
    };
  • HTTP client method listSimulations() that GETs /api/simulation/history with a limit param and returns {simulations, total}.
    async listSimulations(limit = 20): Promise<{ simulations: SimulationSummary[]; total: number }> {
      const resp = await this.http.get<MirofishApiResponse<SimulationSummary[]>>(
        "/api/simulation/history",
        { params: { limit } },
      );
      const sims = resp.data?.data ?? [];
      return { simulations: sims, total: resp.data?.count ?? sims.length };
    }
  • Tool registration: imports and calls registerListSimulations(server, client) inside registerAllTools().
    export function registerAllTools(server: McpServer, client: MirofishClient): void {
      registerCreateSimulation(server, client);
      registerSimulationStatus(server, client);
      registerGetReport(server, client);
      registerInterviewAgent(server, client);
      registerListSimulations(server, client);
      registerSearchSimulations(server, client);
      registerUploadDocument(server, client);
      registerSimulationData(server, client);
      registerCancelSimulation(server, client);
    }
  • Backend Python service: SimulationManager.list_simulations() queries SurrealDB storage for simulations filtered by user_id and falls back to file store when user_id is None.
    def list_simulations(
        self,
        project_id: Optional[str] = None,
        user_id: Optional[str] = None,
    ) -> list[SimSnapshot]:
        """List sims. If user_id is given, filter via SurrealDB first."""
        results: list[SimSnapshot] = []
        seen: set[str] = set()
    
        storage = _get_surreal_storage()
        if storage:
            try:
                rows = storage.list_simulations(limit=200, user_id=user_id)
                for row in rows:
                    sid = row.get("simulation_id", "")
                    if not sid:
                        continue
                    if project_id and row.get("project_id") != project_id:
                        continue
                    snap = store.get(sid)
                    if snap is not None:
                        results.append(snap)
                        seen.add(sid)
            except Exception as exc:
                logger.warning("SurrealDB list_simulations failed: %s", exc)
    
        # File fallback: pick up anything not in SurrealDB (e.g. local
        # dev without a DB, or sims created before a DB migration).
        #
        # Critical: when user_id is set (hosted mode), we MUST NOT fall
        # back to the file store — those rows have no user_id metadata,
        # so returning them would leak other users' sims to whoever
        # asked. Self-hosted callers (user_id=None) get everything.
        if user_id is None:
            for snap in store.list(project_id=project_id):
                if snap.simulation_id in seen:
                    continue
                results.append(snap)
    
        return results
Behavior3/5

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

Annotations already indicate readOnlyHint=true and destructiveHint=false. The description adds that the tool returns status and metadata, but does not disclose ordering, pagination, or any side effects beyond what annotations imply.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence is concise and front-loaded with the core purpose. Minimal waste, but could benefit from additional structure or more details without becoming verbose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is simple with one optional parameter and no output schema. The description covers basic functionality, but missing details like output format, ordering, or pagination behavior. With no output schema, more context would be helpful.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% for the single 'limit' parameter, covering its type, range, and default. The description does not add further parameter details, which is acceptable given the schema's completeness.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'List' and the resource 'past simulation runs' with included data (status and metadata). It distinguishes from sibling tools like search_simulations which likely involve filtering, though not explicitly.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives such as search_simulations or get_report. Agents must infer from the name alone.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kakarot-dev/deepmiro'

If you have feedback or need assistance with the MCP directory API, please join our Discord server