Skip to content

Tool list is hand-maintained in index.ts and in several test files #165

Closed

Description

@TMHSDigital

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-119
  • mcp-server/src/tools/__tests__/input-validation.test.ts:3-108
  • mcp-server/src/tools/__tests__/confirm-gates.test.ts:18-46
  • mcp-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

  1. Add src/tools/registry.ts exporting TOOLS.
  2. index.ts loops over it; the registration test asserts it matches the directory.
  3. input-validation and confirm-gates import TOOLS.
  4. Derive the gated set from annotations plus a confirm field; keep the expected list only as a fixture.
  5. 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 (and npm run typecheck); structure tests: pip install -r requirements-test.txt && pytest tests/ -v
  • Conventions: see CLAUDE.md and CONTRIBUTING.md

Filed by repo-audit/full-audit at 636fefb. Severity: low. Effort: S. audit-key: tech-debt|mcp-server/src/index.ts|register

Activity

  1. added
    good first issue
    tech-debt
    severity: low
    on Nov 18, 2026
  2. TMHSDigital commented on Nov 19, 2026

    @TMHSDigital
    OwnerAuthor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueseverity: lowtech-debt

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions