fix(mcp): surface stored metadata and updated_at in detailed recall format#184
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the MCP SSE server’s /recall tool formatting so the detailed output surfaces updated_at and (size-capped) metadata, aligning MCP output more closely with the existing REST /recall payload and addressing the “metadata is write-only” complaint from #111. It also adds contract-style tests and corrects documentation around metadata visibility.
Changes:
- MCP
formatRecallAsItems(..., { detailed: true })now renders anUpdated:line and a 300-char capped single-lineMetadata:JSON (omitted when empty/missing). - Added Node tests to pin detailed metadata truncation/omission behavior and to pin
format=jsonpassthrough ofmetadata,updated_at, andlast_accessed. - Added a REST roundtrip test for storing metadata via
POST /memoryand verifying it surfaces inGET /recall; updated docs accordingly.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
tests/test_api_endpoints.py |
Adds a REST contract test ensuring stored metadata + timestamps round-trip through /recall. |
mcp-sse-server/test/server.test.js |
Extends formatting tests for detailed metadata/updated output and adds a transport-level json passthrough test. |
mcp-sse-server/server.js |
Implements Updated: rendering and size-capped Metadata: rendering in detailed recall formatting; updates tool format description. |
docs/METADATA_BEHAVIOR.md |
Corrects documentation to reflect that MCP detailed now renders (capped) metadata and Updated: when present. |
…ormat (#111) The REST /recall API already returns parsed memory.metadata plus updated_at/last_accessed; the gap was the MCP server's detailed formatter, which omitted them entirely. The detailed format now renders: - an Updated: line when updated_at is present (parallel to the existing Last accessed handling), and - a size-capped Metadata: line — single-line JSON truncated to 300 chars with a trailing ellipsis, omitted when metadata is missing or empty — so provenance fields surface without dumping raw metadata verbosely. The json format remains a raw passthrough (already exposed metadata) and is now locked by a transport-level test. text/items formats are unchanged. Adds a REST contract test (test_recall_metadata_roundtrip) locking the store -> recall metadata/timestamp round-trip, and fixes docs/METADATA_BEHAVIOR.md, which over-claimed that the detailed format already exposed metadata. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
a4f8c57 to
85e5eb0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The REST
/recallAPI already returnsmetadata,updated_at, andlast_accessed— the gap was the MCP server'sdetailedformat, which omitted them (making custom metadata effectively write-only for MCP agents, the actual complaint in #111).formatRecallAsItems()detailed branch now renders anUpdated:line and a size-capped single-lineMetadata:JSON (300 chars + ellipsis; omitted when empty) — capped because a prior raw-dump attempt was rejected for verbosity.jsonformat was already a raw passthrough; now pinned by a transport-level test.text/itemsformats unchanged.test_recall_metadata_roundtrip) locks the server-side behavior;docs/METADATA_BEHAVIOR.mdcorrected (it over-claimed that detailed already exposed metadata).Testing
npm test, includes truncation-boundary and empty-metadata cases)Closes #111
🤖 Generated with Claude Code