Repository navigation
fix(mcp): tighten tool and input descriptions #3396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
25ad7ee
fix(mcp): tighten tool and input descriptions
brandon-pereira 063d287
fix(mcp): address review feedback on tool descriptions
brandon-pereira 0c0ed30
fix(mcp): address inline review minors on tool descriptions
brandon-pereira 121e998
fix(mcp): clarify alert schedule and chart-level whereLanguage defaults
brandon-pereira 198947c
refactor(mcp): move dashboard sub-schema descriptions into common-uti…
brandon-pereira 2ba7990
test(mcp): narrow input-description walker without a type assertion
brandon-pereira 7635679
test(mcp): fix walker type error
brandon-pereira 22c59b1
fix(mcp): correct return-shape, threshold, and alertable-tile descrip…
brandon-pereira 12d4720
fix(mcp): use totalTimeMs consistently in trace breakdown description
brandon-pereira 22deef6
test(mcp): narrow schema node with in instead of a cast
brandon-pereira 17d1449
fix(mcp): clarify saved-search whereLanguage and event-delta topDelta…
brandon-pereira cbca7c2
fix(mcp): color rules compare the raw value; exponential histograms a…
brandon-pereira 2d731d3
Merge branch 'main' into agent/mcp-tool-descriptions
kodiakhq[bot] 2cb13fd
Merge branch 'main' into agent/mcp-tool-descriptions
kodiakhq[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| '@hyperdx/api': patch | ||
| '@hyperdx/common-utils': patch | ||
| --- | ||
|
|
||
| fix(mcp): describe every MCP tool input, drop descriptions that restate schema constraints, and keep tool descriptions under Claude Code's 2 KB limit |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import { McpContext } from '@/mcp/tools/types'; | ||
|
|
||
| import { createTestClient } from './mcpTestUtils'; | ||
|
|
||
| describe('MCP tool descriptions', () => { | ||
| const context: McpContext = { teamId: 'team-id', userId: 'user-id' }; | ||
|
|
||
| // Claude Code truncates tool descriptions and server instructions past | ||
| // this many UTF-8 bytes. | ||
| const CLAUDE_CODE_METADATA_LIMIT = 2048; | ||
|
|
||
| it('keeps tool descriptions and server instructions within the Claude Code limit', async () => { | ||
| const client = await createTestClient(context); | ||
| const { tools } = await client.listTools(); | ||
| expect(tools.length).toBeGreaterThan(0); | ||
|
|
||
| const texts = [ | ||
| ['instructions', client.getInstructions() ?? ''] as const, | ||
| ...tools.map(tool => [tool.name, tool.description ?? ''] as const), | ||
| ]; | ||
|
|
||
| expect( | ||
| texts.filter(([, text]) => text.trim() === '').map(([name]) => name), | ||
| ).toEqual([]); | ||
|
|
||
| const oversized = texts | ||
| .map(([name, text]) => [name, Buffer.byteLength(text, 'utf8')] as const) | ||
| .filter(([, bytes]) => bytes > CLAUDE_CODE_METADATA_LIMIT); | ||
|
|
||
|
brandon-pereira marked this conversation as resolved.
Resolved
brandon-pereira marked this conversation as resolved.
Resolved
|
||
| expect(oversized).toEqual([]); | ||
| }); | ||
| }); | ||
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.