Skip to content

refactor(repo-search): compose SDE search and minify repository search output#37

Open
sanzog03 wants to merge 1 commit intodevelopfrom
enhance/akd-ext-23-repo_search_tool-minify_response
Open

refactor(repo-search): compose SDE search and minify repository search output#37
sanzog03 wants to merge 1 commit intodevelopfrom
enhance/akd-ext-23-repo_search_tool-minify_response

Conversation

@sanzog03
Copy link
Copy Markdown
Collaborator

Summary

This PR reduces MCP/tool response payload size for RepositorySearchTool to control context growth and token cost.
It refactors the tool from inheritance to composition and enforces a strict minified output schema.

What it does

  • Refactors RepositorySearchTool to compose SDECodeSearchTool instead of extending it.
  • Minifies each result item to only:
    • url
    • full_text
    • reliability_score
    • repository_metadata
  • Removes legacy/heavy response fields from repository search output (title, query, content, extra, etc.).
  • Preserves GitHub metadata enrichment and reliability scoring behavior.
  • Adds stricter GitHub URL parsing for metadata enrichment.

How it does this

  • RepositorySearchTool now extends BaseTool and internally instantiates SDECodeSearchTool with mapped config.
  • SDE result content is explicitly mapped to full_text in the minified response.
  • Output model is now a plain Pydantic BaseModel to avoid framework-added _response payload noise.
  • Repository metadata + reliability score are computed as before using existing utility functions.
  • Tests now assert exact output keys and confirm removed fields are not present.

Files changed

  • akd_ext/tools/code_search/repository_search.py
  • tests/tools/code_search/test_repository_search.py

Testing

  • Command:
    • uv run pytest tests/tools/code_search/test_repository_search.py -q
  • Result:
    • 8 passed

…ults

  - Replace RepositorySearchTool inheritance with composition over SDECodeSearchTool
  - Minify output schema to only url, full_text, reliability_score, repository_metadata
  - Map SDE indexed content to full_text and drop legacy heavy fields (extra/title/query/content)
  - Keep GitHub enrichment + reliability scoring, with safer GitHub URL parsing
  - Update repository search tests to enforce strict minified response shape
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