Skip to content

Most tool handlers are untested and tool registration is never verified #101

Closed

Description

@TMHSDigital

Summary

About 40 of the 50 tool handlers never run in any test, and nothing checks that index.ts registers 50 uniquely named tools that match the documentation.

Where

  • mcp-server/src/tools/__tests__/integration.test.ts exercises only healthCheck, diagnostics, nodeList, the piStatus error path, and six confirm gates.
  • mcp-server/src/index.ts:6-121
  • These tools appear in neither test file: piStatus (happy path), serviceHealth, composePull, composePs, networkInfo, uptimeKumaStatus, sshTest.
  • tests/test_docs_consistency.py checks that the doc tables exist, but not that their names match the registered tools.

Impact

  • A tool file added without a register call, or two tools registered under the same name, ships unnoticed.
  • Regressions in how the HTTP-API tools parse JSON returned by curl over SSH are not caught.

Suggested fix

  • Registration test: register every tool on a fake server that records names. Assert there are 50 unique names, each matching ^homelab_[a-z][A-Za-z]+$, and one per file in src/tools.
  • A pytest that parses the tool names from index.ts / src/tools and diffs them against the README and CLAUDE.md tables.
  • Happy-path and error-path tests with mocked SSH for each tool family. Start with the JSON-parsing tools: prometheusQuery, grafanaSnapshot, uptimeKumaStatus, adguardStats, npmProxyHosts, certCheck, inventorySync.
  • Have e2e.test.ts call the real read-only handlers instead of copied command strings (e2e.test.ts:11-25,45-58).

Acceptance criteria

  • The registration test exists and fails on a missing or duplicate tool
  • Every tool family has at least one handler test

Getting started

  • Relevant files: mcp-server/src/index.ts, mcp-server/src/tools/__tests__/, tests/test_docs_consistency.py
  • How to run tests: cd mcp-server && npm test and pytest tests/ -v

Filed by repo-audit/full-audit at 9cfe5e3. Severity: medium. Effort: M. audit-key: testing|mcp-server/src/index.ts|tool-registration

Activity

  1. added
    help wanted
    testing
    severity: medium
    on Nov 3, 2026
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

    help wantedseverity: mediumtesting

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions