Problem
The search_pdf tool can return responses that are too large for the MCP context when searching yields many matches across a large PDF. This causes failures when the response exceeds context limits, preventing users from seeing all search results.
Proposed Solution
Add offset/continuation parameters to search_pdf to enable paginated search results:
offset: Starting index for search results (default: 0)
limit: Maximum number of matches to return (default: current behavior)
- Include metadata about total matches found and whether more are available
- Maintain consistent search state for pagination
Example Usage
// Get first 20 search results
search_pdf({ path: "document.pdf", search_pattern: "budget", offset: 0, limit: 20 })
// Get next 20 search results
search_pdf({ path: "document.pdf", search_pattern: "budget", offset: 20, limit: 20 })
Implementation Notes
- Should work with existing
max_results parameter (offset within max_results)
- Include response metadata:
total_matches_found: Total number of matches discovered
has_more_results: Boolean indicating if more results are available
next_offset: Suggested offset for next request
- Consider caching search results temporarily to avoid re-scanning entire PDF
- Ensure consistent ordering of results across paginated requests
Related
This complements the existing max_results and max_pages_scanned parameters but focuses on chunking the response rather than limiting the search scope.
Priority
Medium - affects usability when searching large PDFs with many matches
Problem
The
search_pdftool can return responses that are too large for the MCP context when searching yields many matches across a large PDF. This causes failures when the response exceeds context limits, preventing users from seeing all search results.Proposed Solution
Add offset/continuation parameters to
search_pdfto enable paginated search results:offset: Starting index for search results (default: 0)limit: Maximum number of matches to return (default: current behavior)Example Usage
Implementation Notes
max_resultsparameter (offset within max_results)total_matches_found: Total number of matches discoveredhas_more_results: Boolean indicating if more results are availablenext_offset: Suggested offset for next requestRelated
This complements the existing
max_resultsandmax_pages_scannedparameters but focuses on chunking the response rather than limiting the search scope.Priority
Medium - affects usability when searching large PDFs with many matches