Skip to content

Add deterministic snippet IDs to MCP server outputs#2

Open
lolipopshock wants to merge 1 commit intomainfrom
feat/snippet-ids-in-mcp-server
Open

Add deterministic snippet IDs to MCP server outputs#2
lolipopshock wants to merge 1 commit intomainfrom
feat/snippet-ids-in-mcp-server

Conversation

@lolipopshock
Copy link
Contributor

Summary

  • Adds a snippet_id field to every document/result returned by MCP search and browse tools
  • IDs are deterministic (UUID5 from URL), so the same URL always produces the same 8-char ID
  • Duplicate URLs within a single tool call get -1, -2 suffixes to stay unique
  • This means tool call outputs match what the model sees at inference time, without needing post-processing in the tool interface layer

Tools updated

Tool snippet_id source
semantic_scholar_search data[].url
semantic_scholar_snippet_search data[].paper.url
pubmed_search data[].url
massive_serve_search data[].doc_id
serper_google_webpage_search organic[].link
serper_google_scholar_search organic[].link
serper_fetch_webpage_content input URL
jina_fetch_webpage_content input URL
crawl4ai_fetch_webpage_content input URL
crawl4ai_docker_fetch_webpage_content input URL
webthinker_fetch_webpage_content input URL
webthinker_fetch_webpage_content_async input URL

Test plan

  • Verify snippet IDs appear in search tool JSON responses
  • Verify same URL produces same snippet_id across calls
  • Verify duplicate URLs in snippet search get unique suffixed IDs

🤖 Generated with Claude Code

Generate a UUID5-based snippet_id for each document/result returned by
MCP search and browse tools, so that tool call outputs include snippet
IDs directly without needing post-processing in the tool interface layer.

Co-Authored-By: Shannon's Claude <257597027+shannonshen49@users.noreply.github.com>
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.

1 participant