feat(mcp): read_paper folds annotations by default (#185 PR1/5)#186
Merged
feat(mcp): read_paper folds annotations by default (#185 PR1/5)#186
Conversation
`read_paper` now returns a JSON envelope with paper, annotations[], source_version, extractor, path, truncated, total_chars. An agent calling the natural extraction endpoint will no longer silently miss human comments — closing one of the three legs of #185 (agent↔human comment loop). Pass `with_annotations: false` for the legacy text shape so existing clients can opt out. `get_annotated_paper` is documented as superseded by `read_paper` for fetches that also need the extracted body. Refs #185. [tape-exempt: MCP-only tool surface change; no TUI/CLI source touched]
Review nits on the prior commit: - assemble_read_paper_response now takes &Paper instead of paper_id + paper_title, dropping the second paper_repo.get on the with_annotations path. read_paper_tool already loaded the paper for the extraction cache check. - New `read_paper_with_annotations_replies_carry_root_id` test mirrors the existing get_annotated_paper test so future refactors of build_annotations_json don't silently break parent_id/root_id propagation through the read_paper envelope. Refs #185. [tape-exempt: MCP-only refactor + test, no TUI/CLI surface touched]
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
First of 5 PRs landing #185 (agent↔human comment-and-reply loop). Closes the silent-miss bug where an agent calling the natural extraction tool (
read_paper) would never observe a human comment.read_papernow Returns: JSON{paper, annotations[] (live, with parent_id/root_id and full anchor), source_version, extractor, path, truncated, total_chars}by defaultwith_annotations: falsepreserves the legacy text shape byte-identically (escape hatch for any existing client)get_annotated_paperis documented as superseded byread_paperfor fetches that also need the bodybuild_annotations_jsonhelper so both tools agree on shapeTest plan
cargo test -p scitadel-mcp --libpasscargo clippy -p scitadel-mcp --tests -- -D warningscleancargo fmt --checkclean[tape-exempt: MCP-only tool surface change; no TUI/CLI source touched]
Refs #185.