Repository navigation
fix(mcp): type every top-level tool parameter and set annotations.title - #3610
Conversation
🦋 Changeset detectedLatest commit: 105aff4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🔵 Tier 2 — Low RiskSmall, isolated change with no API route or data model modifications. Why this tier:
Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns. Stats
|
PR Review✅ No issues found. |
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
Deep Review✅ No critical issues found. This is a tightly-scoped MCP metadata fix: a shared Zod schema constant becomes a per-use factory so both highlighted-attribute params render fully typed instead of the second collapsing to a bare 🔵 P3 nitpicks (1)
Reviewers (6): correctness, testing, maintainability, kieran-typescript, api-contract, project-standards. Testing gaps:
No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond |
E2E Test Results✅ All tests passed • 466 passed • 1 skipped • 1382s
Tests ran across 4 shards in parallel. |
Summary
Improves MCP tool metadata so clients and tool directories that validate it strictly see well-formed tools.
clickstack_save_source.highlightedRowAttributeExpressionshad no type. It shared a Zod schema instance withhighlightedTraceAttributeExpressions, and the Zod-to-JSON-Schema conversion emits a reused instance as a bare$refto its first use. The schema is now built by a factory, so each parameter is fully typed.annotations.title. Every tool already had a top-leveltitle;createRegisterToolnow mirrors it intoannotations.title, which some clients read for display names.Both are covered by new tests: no top-level tool parameter may render as a bare
$ref, and every tool'sannotations.titlemust match itstitle.How to reproduce
Starting point: local checkout,
packages/api.On
main:tools/liston the MCP server and inspectclickstack_save_source's input schema:highlightedRowAttributeExpressionsis{ "$ref": "#/properties/highlightedTraceAttributeExpressions" }with notype, and no tool hasannotations.title.On this branch:
yarn ci:unit src/mcp/__tests__/toolSchemas.test.ts src/mcp/__tests__/toolAnnotations.test.tspasses; the parameter is a typed array and every tool hasannotations.title.References