feat(mcp): update formatters for rich search results#75
Merged
Conversation
Implements #70 - Richer Search Results (sub-issue 4/5) Changes: - Add FormatterOptions: includeSnippets, includeImports, maxSnippetLines - Update CompactFormatter: - Add optional snippet rendering (off by default) - Add optional imports rendering (off by default, max 5 shown) - Add truncateSnippet and indentText helpers - Update token estimation for new content - Update VerboseFormatter: - Add snippet rendering (on by default) - Add imports rendering (on by default) - Show location with line range (start-end) - Update token estimation for new content Features: - Compact: snippets/imports off by default (token efficient) - Verbose: snippets/imports on by default (full context) - Configurable maxSnippetLines (default: 10 compact, 20 verbose) - Long snippets truncated with '// ... N more lines' - Long import lists truncated with '...' (compact only) Testing: - 17 new tests for snippet/import formatting - All 1282 tests passing Closes #70
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
Implements #70 - Fourth sub-issue of Epic #66 (Richer Search Results)
Changes
packages/mcp-server/src/formatters/types.tsincludeSnippets?: booleanincludeImports?: booleanmaxSnippetLines?: numberpackages/mcp-server/src/formatters/compact-formatter.tsformatHeader(),truncateSnippet(),indentText()helpersestimateTokens()for new contentpackages/mcp-server/src/formatters/verbose-formatter.tsfile.ts:45-67)estimateTokens()for new contentpackages/mcp-server/src/formatters/__tests__/formatters.test.tsExample Output
Compact (with options enabled)
Verbose (default)
Testing
Related Issues