Catching stale tool-call results in MCP-based agents (small library + demo) #823
bg4ff8mtdn-dotcom
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Pre-submission Checklist
What would you like to share?
Kept running into the same failure shape building agent workflows on MCP: a tool call reads some state, another step acts on that read a bit later, and if the underlying resource changed in between, the action goes through as if the read were still accurate — nothing in the protocol or the client flags that it's gone stale.
There's a recent paper describing this formally in a multi-agent verification setting — delayed verification destabilizing collective belief, with derived instability thresholds for when it tips a system toward the wrong answer.
Built a small library, intervalguard, that catches this: it timestamps tool calls, tracks dependencies between them, and raises before a later action commits on a read that's been superseded. It has an MCP adapter specifically — wraps tool handlers and call_tool dispatchers, and propagates the read-set through request metadata so this works across process boundaries, not just inside one agent loop.
Demo in the repo — two debater agents plus a corrector checking a mock data source that changes mid-flight:
Uninstrumented run:
Instrumented run:
Repo: https://github.com/bg4ff8mtdn-dotcom/intervalguard (MIT, stdlib only)
Curious whether this is a failure mode others building MCP servers or clients have actually hit, and if so how you're handling it today — happy to hear if this overlaps with something that already exists in the spec or a client implementation that I've missed.
Relevant Links
https://github.com/bg4ff8mtdn-dotcom/intervalguard
All reactions