Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

已关闭 适合新手
#4,721 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@Jack11111eee 已经在做这个了。

开始于 2026年8月30日。

  • #4722 来自 @Jack11111eee —— 未关闭
  • #4747 来自 @somuai —— 未关闭
  • #4749 来自 @teddiesloco —— 未关闭
  • #4784 来自 @Ashfaqbs —— 未关闭

评估

难度
1/5
预计耗时
1 小时以内
新手友好度
88/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript
领域
api

调研方向

从 src/sequentialthinking/index.ts 中的工具注解开始,然后阅读 src/sequentialthinking/lib.ts 中提到的状态字段和变更。确认元数据与服务器的有状态行为一致,并确认更改完成后,关于只读和幂等性的声明是准确的。

由索引模型根据 Issue 内容生成。

描述

Summary

The sequentialthinking tool annotations readOnlyHint: true and idempotentHint: true are inaccurate. The server is stateful and non-idempotent — it maintains per-session thoughtHistory and branches instance state that persists across calls and changes on every invocation.

These annotations were added per #3403's suggestion, but the suggested values were not verified against the server's actual stateful behavior.

Evidence (BETS cycle, 2026-08-30)

Ran a governed Benchmarking/Evaluation/Testing/Standards (BETS) cycle against @modelcontextprotocol/server-sequential-thinking (published npm version, via npx -y). 11 test cases across 4 lanes.

readOnlyHint: true is misleading

The SequentialThinkingServer class (confirmed in src/sequentialthinking/lib.ts on main) holds instance state:

  • private thoughtHistory: ThoughtData[] = [] (line 23-24)
  • private branches: Record<string, ThoughtData[]> = {} (line 25-26)

Each processThought call mutates this state:

  • this.thoughtHistory.push(input) (line 101) — appends to history on every call
  • this.branches[input.branchId].push(input) (line 111-112) — appends to branch when branchFromThought + branchId provided

Observed across 11 calls in one session: thoughtHistoryLength incremented linearly (1, 2, 3, ... 11). The server is not read-only — it accumulates session state with each invocation.

idempotentHint: true is false

A tool is idempotent if repeated calls with the same arguments produce the same result. Calling sequentialthinking twice with identical arguments produces different thoughtHistoryLength values (N, then N+1) and potentially different branches contents. The tool is non-idempotent by definition.

Suggested fix

annotations: {
  readOnlyHint: false,    // server maintains thoughtHistory and branches state
  destructiveHint: false, // accurate — no external side effects
  idempotentHint: false,  // repeated calls produce different history lengths
  openWorldHint: false,   // accurate — operates on internal reasoning state
},

Impact

Clients relying on readOnlyHint: true for safety assumptions (e.g., "safe to call in parallel", "no state side effects to roll back") will miss the session-state accumulation. Clients relying on idempotentHint: true for caching/retry (e.g., "safe to retry without checking result") will misbehave — a retried call produces a different history length and may create a duplicate branch entry.

Source confirmed on main

src/sequentialthinking/index.ts lines 201-209 (current main as of 2026-08-30):

annotations: {
  readOnlyHint: true,     // ← should be false
  destructiveHint: false,
  idempotentHint: true,   // ← should be false
  openWorldHint: false,
},

src/sequentialthinking/lib.ts lines 23-26, 101, 111-112 confirm the stateful behavior.

Context

  • BETS receipt: agents/_state/bets/20260830T092705Z_sequential-thinking.json (HUMMBL internal, available on request)
  • Related: #3403 (added these annotations without verification — the suggestion was accepted as-is)
  • Discovered during a governed BETS cycle on the MCP fleet, not via automated scanner

Happy to open a PR if that's preferred.

主要语言
TypeScript
星标
91.4k
派生
11.8k
平均合并
7 小时 36 分钟
30 天内合并 PR
126

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

modelcontextprotocol/servers 的其他 Issue

查看 modelcontextprotocol/servers 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。