Skip to content

Tool consistency: duplicated status scripts, same-named params, unchecked remote JSON #166

Closed

Description

@TMHSDigital

Summary

Small consistency problems that make the tools harder for an LLM caller to use correctly and for maintainers to keep in sync.

Where

  • See checklist

Details

  • piStatus vs nodeStatus (piStatus.ts:6-21, nodeStatus.ts:20-32): separate copies of the same status script; nodeStatus lacks the throttle section and both accept node: "all". Build both from one section list or make nodeStatus an alias.
  • since means three things: sinceSchema (30m, 7d, ISO) in serviceLogs/logSearch, free journalctl text in journalLogs (journalLogs.ts:20-23), and an unvalidated string in ntfyTopics (ntfyTopics.ts:30-34). Use sinceSchema everywhere and convert per backend.
  • Result size is lines, count or limit depending on the tool. Pick one name for new tools and keep old names as aliases.
  • service is an exact container name in serviceLogs/serviceRestart/logSearch but a docker ps --filter name= substring in serviceHealth (grafana also matches grafana-renderer). Anchor or document it.
  • Remote JSON: getNpmToken returns JSON.parse(output).token without checking it exists (service-http.ts:98-99), producing Bearer undefined and a generic auth hint; adguardFilterToggle casts the status response without validation (line 87); certList skips completeJson. Use zod schemas with a specific "unexpected response" error.

Impact

Arguments that work for one tool fail or behave differently in another, and unexpected API responses give misleading errors.

Suggested fix

Work through the checklist; each item is independent.

Acceptance criteria

  • Every checklist item resolved

Getting started

  • Relevant files: mcp-server/src/tools/piStatus.ts, mcp-server/src/tools/nodeStatus.ts, mcp-server/src/utils/since-param.ts, mcp-server/src/utils/service-http.ts, mcp-server/src/tools/adguardFilterToggle.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: M. audit-key: quality|mcp-server/src/utils/since-param.ts|sinceSchema

Activity

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

    @TMHSDigital
    OwnerAuthor

    Fixed in 77abf53, every checklist item: piStatus/nodeStatus share BASE_STATUS_SECTIONS; since uses sinceSchema in journalLogs and ntfyTopics with per-backend conversion (toJournalSince/toNtfySince, unit-tested); result-size naming convention recorded in CLAUDE.md (new tools use limit, old names kept); serviceHealth anchors the docker name filter (exact name, regex chars escaped); adguardFilterToggle validates the status JSON with zod, certList applies completeJson (getNpmToken was removed in #162). Note: journalLogs no longer accepts free-form values like '1 hour ago'. 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

    severity: lowtech-debt

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions