Repository navigation
Closed
Description
Context
The new MCP tools search_repository_files and read_repository_file provide the foundation for agent-driven search-then-read loops over Model Context Protocol. To ensure long-term stability and prevent regressions, comprehensive automated tests must exercise the tools through the MCP catalog, verifying authorization guards, semantic relevance, literal grep, chunked reading, and error handling. Furthermore, the MCP tool coverage matrix, developer guide, and operator documentation must be updated to document the new tools, their parameters, and their freshness guarantees.
Requirements
- Automated Test Suite:
- Create
packages/api/test/mcpRepositoryRetrieval.test.tstesting both tools throughexecuteTooland catalog dispatch. - Test
search_repository_files:- Semantic search with an indexed repository (verifying ranked paths, relevance reasons, and freshness state).
- Semantic search with an unindexed repository (verifying graceful degradation with freshness caveat).
- Literal grep search with exact matches (verifying file paths, match counts, and line match previews).
- Literal grep with case sensitivity (
caseSensitive: truevscaseSensitive: false). - Literal grep with no matches (verifying empty result array and
totalMatches: 0, not an error). - Pagination (
offset,limit, andnextOffset). - Subpath filter (verifying results are restricted to the given prefix).
- Test
read_repository_file:- Whole file read.
- Line range read with
startLineandendLine. - Output bounds enforcement (
maxLinesandmaxBytes) settingtruncated: true. - Non-existent file returning 404
FILE_NOT_FOUND. - Binary file returning 400
BINARY_FILE. - Directory traversal (
../) returning 400INVALID_PATH.
- Test Authorization:
- Verify both tools reject an unauthorized repository with 403
REPOSITORY_FORBIDDEN.
- Verify both tools reject an unauthorized repository with 403
- Create
- Update Tool Coverage Matrix:
- Add
search_repository_filesandread_repository_filetodocs/mcp-coverage.mdunder repository context inspection tools.
- Add
- Update MCP Developer and Operator Guides:
- Update
docs/mcp.mdwith tool signatures, parameters, return shapes, and an example search-then-read agent loop. - Update
docs/docs/features/mcp.mdunder the Common operator workflows table.
- Update
Implementation Specification
- File:
packages/api/test/mcpRepositoryRetrieval.test.ts(new file) - File:
docs/mcp-coverage.md(modify) - File:
docs/docs/features/mcp.md(modify) - File:
docs/mcp.md(modify)
Acceptance Criteria
- All tests in
packages/api/test/mcpRepositoryRetrieval.test.tspass cleanly. docs/mcp-coverage.md,docs/mcp.md, anddocs/docs/features/mcp.mdaccurately documentsearch_repository_filesandread_repository_filewith parameter details, freshness caveats, and usage examples.
Created by ProPR AI Planner
Activity
propr-dev commentedon Oct 6, 2026
Suggested Implementation:
Implementation Approach
This task establishes test coverage and documentation for
search_repository_filesandread_repository_file. We create an end-to-end test suite inpackages/api/test/mcpRepositoryRetrieval.test.tsutilizing Node's built-in test runner (node:test) and in-memory SQLite with real ProPR database migrations, matching existing MCP test suites (mcpWorkflows.test.ts,mcpDocs.test.ts). The tests exercise tool dispatch through the real MCP catalog andMcpPolicyboundary, ensuring authorization enforcement, error mapping, pagination, and data contracts are validated under real execution conditions. Finally, we updatedocs/mcp-coverage.md,docs/mcp.md, anddocs/docs/features/mcp.mdso operators and AI clients understand the capabilities, parameters, and indexing caveats of the search-then-read primitives.File:
packages/api/test/mcpRepositoryRetrieval.test.ts(new file)Why this file: Provides comprehensive integration tests for
search_repository_filesandread_repository_fileexecuted through the MCP catalog. It tests authorization rejection, semantic relevance fallback, literal grep matching, chunked line reading, binary file rejection, and path traversal protection.File:
docs/mcp-coverage.mdWhy this file:
docs/mcp-coverage.mdprovides the comprehensive matrix mapping all ProPR operations and domain capabilities to their corresponding MCP tools. Adding the new repository retrieval primitives ensures clients and evaluators see the full capability catalog.File:
docs/docs/features/mcp.mdWhy this file:
docs/docs/features/mcp.mdis the user-facing feature guide for MCP in the ProPR documentation site. Addingsearch_repository_filesandread_repository_fileto the Common operator workflows table allows users and agent developers to discover how to perform code retrieval.File:
docs/mcp.mdWhy this file:
docs/mcp.mdis the definitive technical manual for MCP tool behavior, payload schemas, and operator workflows. This change adds documentation forsearch_repository_filesandread_repository_file, explaining how agents can run an iterative search-then-read loop, the distinction between semantic and literal search, and indexing freshness caveats.propr-dev commentedon Oct 6, 2026
🤖 AI processing has started for this issue using claude agent with claude-opus-5-5 model.
I'll analyze the problem and work on a solution. This may take a few minutes.
Processing Details:
claudeclaude-opus-5-52799/claude-opus-5-5-add-mcp-integration-tests-20261006-1553-7ho2797-epic-repository-search-sgjissue-2799-20261006-1553-claude-opus-5-5-7ho🔍 Track Task Execution