MCP: stacked improvements (5 commits for upstream PRs)#15
Draft
endolith wants to merge 6 commits into
Draft
Conversation
f178e1d to
994be4a
Compare
This was referenced Jun 25, 2026
994be4a to
1918da5
Compare
Return body_text as a paginated slice instead of the full message body. Adds offset, center_at, max_chars (default 2000, max 4000), body_length, body_returned, and has_more so agents can page through long messages or jump to a match via center_at (byte offset from search_in_message). Values above maxBodyChars clamp to 4000; zero or negative max_chars use the default. Guard against Engine.GetMessage returning (nil, nil) for not-found. Return UTF-8-adjusted offset, body_returned, and has_more so sequential paging (offset += body_returned) does not skip multibyte characters. Co-authored-by: endolith <endolith@gmail.com>
1918da5 to
6482bda
Compare
New tool finds all occurrences of a term in one message body, returning char_offset, line, and a centered snippet per match. Adds extractContextChar helper (used by search results in a follow-up PR) with UTF-8-safe windows. Co-authored-by: endolith <endolith@gmail.com>
search_messages (no mode) searches metadata only via SearchFast — subject, snippet, sender, labels, dates. Full-body keyword search moves to the new search_message_bodies tool with context excerpts around matched terms. Vector/hybrid modes stay on search_messages; hybrid results hydrate via GetMessageSummariesByIDs (no per-hit GetMessage) matching upstream kenn-io#388. Co-authored-by: endolith <endolith@gmail.com>
Add ChunkScoringBackend.ScoreMessageChunks to score every embedded chunk within a message against the query vector. - search_messages mode=vector|hybrid: each hit includes matches[] (up to 5 chunks, best similarity first; optional min_score) - search_in_message mode=vector: paginated semantic chunk matches - search_message_bodies: context_snippets renamed to matches[] with char_offset and line for consistency across search tools Hybrid engine returns QueryVector in ResultMeta to avoid re-embedding when enriching search results. Co-authored-by: endolith <endolith@gmail.com>
Document supported search_messages query operators (subset of Gmail syntax), metadata-only default search vs search_message_bodies for body FTS, body query syntax (ANDed terms, quoted phrases, filter vs free-text), and matches_truncated on capped excerpt lists. Clarify aggregate group_by=time buckets by calendar year. Add schema contract tests and toolPropertyDescription helper for mcp-go map schemas. Update docs/usage/chat.md. Co-authored-by: endolith <endolith@gmail.com>
Rebase left duplicate bodyByteSlice/contextWindow helpers; keep a single bodyByteSliceRange-based implementation. Use local assert helpers in new tests for testify-helper-check. Co-authored-by: endolith <endolith@gmail.com>
6482bda to
9c1f7d3
Compare
Owner
Author
|
(See kenn-io#388 and kenn-io#421) |
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
Five independent commits on
main, each suitable for a separate upstream PR. This PR is the full stack (commit 5 of 5); merge in order or review commit-by-commit.Commit stack (oldest → newest)
098a7fesplit/mcp1-get-message-pagingget_messagebody reading (+ max_chars clamp)d819d71split/mcp2-search-in-messagesearch_in_messagetoolcc0b70bsplit/mcp3-search-message-bodiessearch_message_bodies; metadata-onlysearch_messages; hybrid bulk hydrationb9f1ef6split/mcp4-vector-chunk-matchesmatches[]; unified match shape across search tools994be4asplit/mcp5-tool-schema-docsPagination (
search_messages/list_messageslimits) is already on upstreammain(kenn-io#388).Supersedes
Closes the scattered fork PRs #8–#12, #14 in favor of this stack.
Usage
search_messages(omitmode)search_message_bodies→matches[]search_messagesmode=vector|hybrid→matches[]with scoressearch_in_message(mode=keywordormode=vector)get_messagewithoffset/center_at