Repository navigation
Description
Summary
index.ts has 53 imports plus 53 register calls, input-validation.test.ts and confirm-gates.test.ts keep their own maps, and seven tools have no schema tests as a result.
Where
mcp-server/src/index.ts:6-58, :67-119mcp-server/src/tools/__tests__/input-validation.test.ts:3-108mcp-server/src/tools/__tests__/confirm-gates.test.ts:18-46mcp-server/src/tools/__tests__/registration.test.ts:22-56
Details
input-validation.test.ts is missing composePs, composePull, networkInfo, piStatus, serviceHealth, sshTest and uptimeKumaStatus (which has a regex-validated slug and, for composePull, stacks). registration.test.ts already discovers tools with import.meta.glob but keeps a separate gated list, also restated in CLAUDE.md and SECURITY.md.
Impact
Adding a tool needs four or more coordinated edits, and the checklist item "All new tools have input validation tests" is not enforced.
Suggested fix
- Add
src/tools/registry.tsexportingTOOLS. - index.ts loops over it; the registration test asserts it matches the directory.
- input-validation and confirm-gates import
TOOLS. - Derive the gated set from annotations plus a
confirmfield; keep the expected list only as a fixture. - Add a test that every tool with a non-node input has at least one input-validation case.
Acceptance criteria
- One source of truth for the tool list
- Missing input-validation cases added
Getting started
- Relevant files:
mcp-server/src/index.ts,mcp-server/src/tools/__tests__/input-validation.test.ts,mcp-server/src/tools/__tests__/confirm-gates.test.ts,mcp-server/src/tools/__tests__/registration.test.ts - How to run tests:
cd mcp-server && npm install && npm test(andnpm run typecheck); structure tests:pip install -r requirements-test.txt && pytest tests/ -v - Conventions: see
CLAUDE.mdandCONTRIBUTING.md
Filed by repo-audit/full-audit at 636fefb. Severity: low. Effort: S. audit-key: tech-debt|mcp-server/src/index.ts|register
Activity
TMHSDigital commentedon Nov 19, 2026
Fixed in 8ab448d: src/tool-registry.ts exports TOOLS; index.ts loops over it; input-validation and confirm-gates use it; registration.test.ts asserts it matches src/tools. Added validation cases for composePull, serviceHealth and uptimeKumaStatus (composePs, networkInfo, piStatus and sshTest take only node), plus a coverage test that fails for any tool with a non-node input and no validation case. The gated set is still an explicit list in the tests (step 4 of the suggestion not done). Build, typecheck, Vitest and structure tests pass.