Skip to content

Commit 05c3d67

Browse files
authored
Merge pull request #5015 from modelcontextprotocol/v2/fix/4721-sequentialthinking-annotations
fix(sequentialthinking): set readOnlyHint and idempotentHint to false
2 parents 15563b3 + 7a24a11 commit 05c3d67

3 files changed

Lines changed: 21 additions & 14 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@modelcontextprotocol/server-sequential-thinking": patch
3+
---
4+
5+
Advertise the `sequentialthinking` tool as `readOnlyHint: false` and `idempotentHint: false`. Every call appends to the server's thought history, and a call with both `branchFromThought` and `branchId` also appends to that branch, so the tool was never read-only or idempotent. `destructiveHint` and `openWorldHint` stay `false`. (#4721)

‎src/sequentialthinking/__tests__/tools-list.test.ts‎

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
// Pins what a client sees when it connects and lists tools: the server's
22
// identity and capabilities, and the one tool's name, title, description,
33
// annotations, input schema and output schema, exactly as SDK 1.x emits them
4-
// today. These are characterization tests: where today's value is known to be
5-
// wrong (#4721 annotations) the test pins the current value and cites the
6-
// issue, so the fix shows up as a deliberate assertion change rather than a
7-
// silent drift. The 2781-character description (#799) is pinned as current
8-
// design: the 1024 cap is an OpenAI/Azure client limit, not the MCP spec.
4+
// today. These are characterization tests. The annotations assert the values
5+
// fixed in #4721 (the tool is stateful, so neither read-only nor idempotent).
6+
// The 2781-character description (#799) is pinned as current design: the
7+
// 1024 cap is an OpenAI/Azure client limit, not the MCP spec.
98

109
import { describe, it, expect, beforeAll, afterAll } from "vitest";
1110
import { createRequire } from "node:module";
@@ -52,15 +51,15 @@ describe("sequentialthinking: initialize and tools/list", () => {
5251
expect(tool.title).toBe("Sequential Thinking");
5352
});
5453

55-
// KNOWN BUG #4721: pins current (wrong) behavior; the fix changes this assertion.
56-
// #4721: the server keeps a thought history and branch map that every call
57-
// mutates, so readOnlyHint: true and idempotentHint: true are wrong for it.
58-
// Pinned as they are today; the fix changes this assertion on purpose.
59-
it("carries today's annotations (#4721: read-only and idempotent, though the tool is stateful)", () => {
54+
// #4721: every call appends to the server's thought history, and a call with
55+
// both branchFromThought and branchId also appends to that branch, so the
56+
// tool is neither read-only nor idempotent. It is still not destructive (it
57+
// only appends) and not open-world.
58+
it("advertises the tool as stateful: not read-only, not idempotent, not destructive, closed-world", () => {
6059
expect(tool.annotations).toEqual({
61-
readOnlyHint: true,
60+
readOnlyHint: false,
6261
destructiveHint: false,
63-
idempotentHint: true,
62+
idempotentHint: false,
6463
openWorldHint: false,
6564
});
6665
});

‎src/sequentialthinking/index.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,12 @@ You should:
138138
.describe("If more thoughts are needed"),
139139
},
140140
annotations: {
141-
readOnlyHint: true,
141+
// Every call appends to the server's in-memory thought history, and a
142+
// call with both branchFromThought and branchId also appends to that
143+
// branch, so the tool is neither read-only nor idempotent (#4721).
144+
readOnlyHint: false,
142145
destructiveHint: false,
143-
idempotentHint: true,
146+
idempotentHint: false,
144147
openWorldHint: false,
145148
},
146149
outputSchema: {

0 commit comments

Comments
 (0)