You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Input-validation tests check inline schema copies, not the real tool schemas #99
The input-validation test suite (931 lines, about 120 tests) re-declares a copy of each tool's schema inline and tests the copy. It never imports the real schemas, so it cannot fail when a real schema changes.
Where
mcp-server/src/tools/__tests__/input-validation.test.ts:1-60 (the same pattern runs through the whole file). Examples: serviceLogs at :6-9, prometheusQuery at :214, nodeExec at :818.
Each tool file declares const inputSchema without exporting it, for example mcp-server/src/tools/serviceLogs.ts:6-17.
Details
The file imports only vitest and zod. Each describe builds its own z.object({...}). The copies also omit nodeParam, which every real tool spreads in.
Impact
Deleting confirmParam from a tool, or loosening .min(1), leaves every test green.
Release checklist item 2 in CLAUDE.md ("All new tools have input validation tests") gives false assurance.
Steps to reproduce
Change mcp-server/src/tools/serviceLogs.ts:8 to service: z.string().
Run npm test. Everything still passes.
Suggested fix
Export inputSchema from each tool. Alternatively, capture the schema at registration through a fake McpServer whose tool() records its arguments; integration.test.ts already has captureHandler.
Run the existing assertions against z.object(captured) and delete the inline copies.
Add one table-driven test over all 50 registrations that asserts:
every confirm-gated tool has a required boolean confirm;
every tool except nodeList accepts an optional node.
Filed by repo-audit/full-audit at 9cfe5e3. Severity: medium. Effort: M. audit-key: testing|mcp-server/src/tools/__tests__/input-validation.test.ts|inputSchema
Activity