Skip to content

mcp: long runs return every time step, flooding the agent's context #337

Open

Description

@bpowers

MCP tools return a value for every saved time step, so a long or finely saved run produces a very large response that wastes the calling agent's context.
They should return a bounded number of points by default and say when they have sampled.

Where it happens:

  • Simulate in simlin-serve returns time plus one full series per variable.
    Callers can already limit the variables, and can coarsen the save step through simSpecsOverride, but nothing limits points by default.
  • ReadModel and EditModel return time and, for every loop, an importance series of the same length (values are already rounded to 3 significant figures).
    There is no way to limit these.

Not tied to a specific report; the size scales with saved steps times variables or loops, so large models such as C-LEARN are where it bites.

Fix

Add an optional maxPoints input with a modest default, pick evenly spaced saved steps that always include the first and last, and return a sampled: true flag (plus the original step count) when it applies, in line with how these tools already flag enumerationComplete.
Sampling should keep the series aligned with time.
Alternative for Simulate only: document simSpecsOverride.saveStep as the way to shrink output; no code, but agents rarely discover it.

Pointers

  • src/simlin-serve/src/mcp/simulate.rs (SimulateOutput)
  • src/simlin-mcp-core/src/tools/read_model.rs, edit_model.rs (time, loop_dominance)
  • src/simlin-mcp-core/src/types.rs (LoopDominanceSummary.importance)

Activity

  1. added
    mcp
    on Jun 8, 2026
  2. added
    enhancement
    on Oct 12, 2026
  3. changed the title [-]In MCP responses we need to sample time series when they're too long[/-] [+]mcp: long runs return every time step, flooding the agent's context[/+] on Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementmcp

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions