Skip to content

Expose AMS portfolio-queue dashboard as a read-only MCP tool (gittensory_miner_get_portfolio_dashboard) #5155

Description

@JSONbored

Context

collectPortfolioDashboard() in packages/gittensory-miner/lib/portfolio-dashboard.js is already built and tested, and gittensory-miner queue dashboard --json already prints its output locally: per-repo backlog counts by status, oldest-queued age, and totals. None of this is reachable remotely today. This is distinct from Wave 5's miner-ui dashboard views (#4846/#4855/#4856) and miner-ui live fetch (#4859), which are the webapp's own UI/API layer, not an MCP tool for remote/agent-facing introspection.

Dependencies

Requires the MCP scaffold issue in this same batch (gittensory-miner-mcp bin entry) to land first — this tool is added onto that server.

Requirements

  1. Add a new tool (e.g. gittensory_miner_get_portfolio_dashboard) to the AMS MCP server.
  2. Call the existing collectPortfolioDashboard() aggregator directly from packages/gittensory-miner/lib/portfolio-dashboard.js — no new aggregation logic, no reimplementation of counting/aging logic.
  3. Return the same metadata already produced by the aggregator: per-repo backlog counts by status, oldest-queued age, and totals.
  4. The tool must be strictly read-only — it must not mutate the queue/backlog in any way, and must have no side effects beyond invoking the existing pure aggregator.
  5. Do not add new output fields beyond what collectPortfolioDashboard() already returns; if filtering or additional shaping is needed later, that's a separate follow-up issue.

Deliverables / Acceptance Criteria

  • New MCP tool wrapping collectPortfolioDashboard() with no new aggregation logic
  • Tool output verified to structurally match gittensory-miner queue dashboard --json output
  • Unit tests + invariant test added
  • README/doc pointer added for the new tool

Test Coverage Requirements

This PR must ship with full test coverage for every changed line and branch — the repo's Codecov patch gate requires 99%+ coverage and the house standard is to aim for 100%, including both sides of every conditional/nullish-coalescing branch introduced. Add: (1) unit tests covering the tool's success path (multiple repos with backlog items) and failure/edge paths (empty queue, single repo, missing repo data), (2) an invariant test asserting the MCP tool's output is structurally identical to collectPortfolioDashboard()'s direct return value — the wrapper introduces no aggregation drift, and (3) no regression test is needed since this is new functionality, not a bug fix.

Codecov visibility note: packages/gittensory-miner/**, apps/gittensory-miner-ui/**, and apps/gittensory-miner-extension/** currently sit entirely outside vitest's coverage.include glob, so codecov/patch cannot measure changes there yet — closing that gap is exactly what #4864 and #4865 (in this same milestone) do. Any part of this change under packages/gittensory-engine/src/** or the repo's own src/** remains fully Codecov-instrumented as usual. Either way, this does not lower the bar: treat the 100%-including-invariants-and-regression target above as the enforced house standard regardless of what Codecov can currently see, and it becomes gate-enforced for real once #4864/#4865 ship.

Expected Outcome

An operator or an MCP-connected agent gets remote, agent-facing introspection into per-repo backlog health — the same data queue dashboard --json shows locally — without needing miner-ui or local CLI access.

Links & Resources

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:featureGittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions