feat: add resource-based download for MCP patent data#49
Closed
feat: add resource-based download for MCP patent data#49
Conversation
Add resource-based download pattern for MCP patent data retrieval. Search and fetch operations now return a summary with a resource_id, and a new download_result tool allows downloading the full data. This approach keeps tool responses small and efficient while allowing AI agents to download large patent data on-demand using the resource_id. Changes: - Add OperationSummary struct with hits, total_results, and resource_id - Add in-memory HashMap store for patent data keyed by resource_id (UUID) - Update search_patents to return summary and store full results - Update fetch_patent to return summary and store full results (raw mode unchanged) - Add download_result tool to retrieve data by resource_id - Update E2E tests to expect resource_id in responses Usage flow: 1. AI calls search_patents or fetch_patent 2. Receives summary with resource_id 3. Calls download_result with resource_id to get full JSON data This pattern is compatible with MCP's resource approach and works with rmcp 0.16 without requiring full resources API support. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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
Add resource-based download pattern for MCP patent data retrieval. Search and fetch operations now return a summary with a
resource_id, and a newdownload_resulttool allows downloading the full data on-demand.Problem
Previously,
search_patentsandfetch_patenttools returned the full patent data directly in their responses. For large results, this could be inefficient and make tool responses very large.Solution
Implement a resource-based download pattern:
resource_id(UUID)download_resulttool withresource_idto get full dataThis keeps tool responses small and efficient while allowing AI agents to download large data on-demand.
Changes
hits,total_results, andresource_idresource_idresource_idin responsesUsage Flow
Compatibility
This pattern is compatible with MCP's resource approach and works with rmcp 0.16. When rmcp adds full resources API support, this can be migrated to use the official
list_resourcesandread_resourcemethods.Test plan
🤖 Generated with Claude Code