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

memory: create_entities, create_relations and add_observations could declare idempotentHint: true

未关闭 适合新手
#5,153 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@syedmustafan 已经在做这个了。

开始于 2026年10月17日。

  • #1 来自 @syedmustafan —— 未关闭

评估

难度
1/5
预计耗时
1 小时以内
新手友好度
78/100
Issue 类型
重构
描述清晰度
描述清楚
活跃度
活跃
领域
api

调研方向

这三个工具在 v2/main 分支的 src/memory/index.ts 中声明,大约在第 797、842 和 888 行,目前它们的 idempotentHint 为 false。请先检查 createEntities、createRelations 和 addObservations 处理函数是否已经跳过重复的工作,然后将这三个提示改为 true,与删除类工具保持一致。完成的标准是:声明已更新,并且记忆服务器的工具列表输出中这三个工具显示为 true。

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

描述

enhancement v2
Which server?

memory (@modelcontextprotocol/server-memory)

Protocol era

Both, or not era-specific

MCP client

mcp-groundtruth's own JSON-RPC stdio client (test harness, protocolVersion 2025-11-25)

The problem

create_entities, create_relations and add_observations declare idempotentHint: false, although a repeated identical call has no additional effect. Clients that respect the hint may therefore decline to auto-retry them, for example after a timeout. The three delete tools already declare idempotentHint: true for the same reason: a repeat has nothing left to do.

All three already skip work that has been done (src/memory/index.ts at bbb701e, the commit tested):

  • createEntities skips names that already exist or repeat earlier in the batch (L517–L532).
  • createRelations skips relations that already exist or repeat in the batch (L534–L564).
  • addObservations skips contents the entity already has (L566–L585).

v2/main at 38569bd still declares false (L797, L842, L888), and the three methods are unchanged between the two commits.

Solution you have in mind (optional)

Set idempotentHint: true on these three tools. Their behaviour doesn't change; only the declared hint does, matching the delete tools.

Which MCP feature does it demonstrate? (optional)

Tool annotations (idempotentHint). Reference servers are widely copied, so their hints are often reused as a model for what each one means.
https://modelcontextprotocol.io/specification/2025-11-25/server/tools

Alternatives or workarounds you have tried

Leaving it as is is safe: clients just retry less than they could. A client could hardcode a per-tool override, but that defeats the purpose of declaring hints on the server.

Already built it locally?

No local change, so no prompt to share. How this was verified:

I tested the three tools against a seeded graph with mcp-groundtruth, a conformance harness I maintain, sandboxed, on Node 24. There were 12 argument sets: existing names with a different type or new observations, duplicates within a batch, a missing relation endpoint, a partly invalid batch, and mixes of new and existing items. In every set a second identical call left the stored graph unchanged, and calls that returned errors wrote nothing. Reports and review.

Reproduce, with Node 24 first on PATH:

git clone https://github.com/shreyasbhakta/mcp-groundtruth && cd mcp-groundtruth
git checkout 9ba8f289e6f11aa1d334c0af57b803548d3883a1
uv run mcpgt prepare memory
uv run mcpgt run memory --audit --observe-concurrent --tool create_entities --tool create_relations --tool add_observations

Limits:

  • Only repeated identical arguments were tested; that is what the hint covers.
  • The concurrent evidence is weak. In 180 two-process attempts the requests overlapped on the wire and none diverged, but the lock file serializes writes.
  • One seed graph and 12 hand-chosen argument sets, on macOS only.

Environment: server built from source at bbb701e and run over stdio; client sends protocolVersion: "2025-11-25" and the server answers with the same; macOS, Node 24.21.0.

Before you submit
  • I searched existing issues and this is not a duplicate.
  • This is a request for this repository or one of its servers, not a new server, the MCP specification or an SDK.
主要语言
JavaScript
星标
91.2k
派生
11.8k
平均合并
7 小时 51 分钟
30 天内合并 PR
121

环境准备

从这里开始

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

modelcontextprotocol/servers 的其他 Issue

查看 modelcontextprotocol/servers 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

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