WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@jared03
Copy link

@jared03 jared03 commented Dec 1, 2025

Summary

Fixes schema validation error in read operations (read_graph, search_nodes, open_nodes).

Problem

The JSONL file stores entities with a type field to distinguish them from relations:

{"type":"entity","name":"...","entityType":"...","observations":[...]}

But the output schema only expects {name, entityType, observations} - no type field.

This causes all read operations to fail with:

MCP error -32602: Structured content does not match the tool's output schema: data.entities[0] should NOT have additional properties

Solution

Strip the type field using destructuring before pushing to result arrays:

if (item.type === "entity") {
  const { type, ...entity } = item;
  graph.entities.push(entity as Entity);
}
if (item.type === "relation") {
  const { type, ...relation } = item;
  graph.relations.push(relation as Relation);
}

Testing

  • All 39 existing tests pass
  • All read operations now return valid responses
  • Write operations continue to work correctly
  • Existing JSONL files remain fully compatible

Fixes #3074

The JSONL file stores entities with a 'type' field to distinguish them
from relations. However, the output schema for read operations doesn't
include this field, causing schema validation errors (-32602).

This fix uses destructuring to remove the 'type' field before pushing
entities and relations to the result arrays.

Fixes modelcontextprotocol#3074
@YuGe-Git
Copy link

YuGe-Git commented Dec 6, 2025

你好 @jared03,感谢你修复这个问题!🙏

我正在 Cursor IDE 中使用 @modelcontextprotocol/server-memory,遇到了 #3074 中描述的问题。所有的读操作(read_graphsearch_nodesopen_nodes)都会报错:

MCP error -32602: Structured content does not match the tool's output schema: 
data.entities[0] should NOT have additional properties

由于这个 PR 还未合并,修复还没有发布到 npm 包中,导致我无法在 Cursor 中正常使用 memory MCP 服务器。

问题:

  1. 这个 PR 预计何时会合并?
  2. 合并后,预计何时会发布新版本到 npm?
  3. 在此期间有什么临时解决方案吗?(目前我只能在避免使用读操作,只使用写操作)

感谢你的工作!期待使用修复后的版本。🚀

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.

Memory MCP, schema validation error: MCP error -32602

2 participants