Skip to content

fix: wrap JSON data in object for CypherEngine graph build#64

Merged
sonesuke merged 1 commit intomainfrom
fix/mcp-graph-build-error
Apr 4, 2026
Merged

fix: wrap JSON data in object for CypherEngine graph build#64
sonesuke merged 1 commit intomainfrom
fix/mcp-graph-build-error

Conversation

@sonesuke
Copy link
Copy Markdown
Owner

@sonesuke sonesuke commented Apr 4, 2026

Summary

  • Fix MCP search_papers and fetch_paper failing with "Graph build error: Invalid data structure: Cannot find node path"
  • Root cause: CypherEngine::from_json_auto expects {"key": [...]} format, but handlers passed bare JSON arrays from Vec<Paper> serialization

Changes

  • search_papers: wrap papers in {"papers": [...]} object
  • fetch_paper (raw=true): wrap result in {"results": [...]} object
  • fetch_paper (raw=false): wrap paper in {"papers": [...]} object

Test plan

  • mise run pre-commit passes (fmt, clippy, test — 37/37 tests green)
  • Manual: verify MCP search_papers returns graph_schema without error
  • Manual: verify MCP execute_cypher works against search results

🤖 Generated with Claude Code

CypherEngine::from_json_auto expects JSON in {"key": [...]} format
where it can detect a named node path. The MCP handlers were passing
bare JSON arrays (Vec<Paper> serialized directly), causing the schema
analyzer to generate node_path="" which then failed with
"Cannot find node path".

Wrap data in objects with named keys ("papers", "results") so the
auto-detection can find the array and build the graph correctly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sonesuke sonesuke merged commit 083f39d into main Apr 4, 2026
4 checks passed
@sonesuke sonesuke deleted the fix/mcp-graph-build-error branch April 4, 2026 02:10
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.

2 participants