Skip to content

fix(sequentialthinking): correct readOnlyHint and idempotentHint annotations - #4747

Closed
somuai wants to merge 1 commit into
modelcontextprotocol:mainfrom
somuai:fix-sequential-thinking-annotations
Closed

somuai wants to merge 1 commit into
modelcontextprotocol:mainfrom
somuai:fix-sequential-thinking-annotations

Conversation

@somuai

@somuai somuai commented Sep 3, 2026

Copy link
Copy Markdown

Resolves #4721.

Problem

The sequentialthinking tool annotations previously specified readOnlyHint: true and idempotentHint: true. However:

  1. The server maintains per-session instance state (thoughtHistory and branches), which mutates on every processThought invocation. It is therefore stateful, not read-only.
  2. Repeated calls with identical arguments yield different thoughtHistoryLength values (and mutate branches), making the tool non-idempotent by definition. Clients relying on readOnlyHint (e.g. for parallel execution safety) or idempotentHint (e.g. for caching or automatic retries) would encounter unexpected side effects.

Solution

  • Set readOnlyHint: false and idempotentHint: false in src/sequentialthinking/index.ts.
  • Added regression test in src/sequentialthinking/__tests__/input-schema.test.ts verifying that advertised tool annotations accurately reflect statefulness.

… annotations

- Set readOnlyHint: false because the server maintains per-session thoughtHistory and branches state
- Set idempotentHint: false because sequential calls produce different history lengths
- Add regression assertion in input-schema.test.ts
- Fixes modelcontextprotocol#4721
@cliffhall

Copy link
Copy Markdown
Member

Thanks for this contribution! #4721 has been resolved on the v2/main line by #5015, so I'm closing this PR as superseded. If anything is missing from that fix, please comment on #4721 or open a PR against v2/main.

@cliffhall cliffhall closed this Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sequential-thinking: readOnlyHint and idempotentHint annotations are inaccurate (server is stateful, non-idempotent)

2 participants