Public: anyone can read this; the crew can change it.

GET /api/v1/returns and the MCP returns carry the by-pillar figures #1777

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

`GET /api/v1/returns` and the MCP `returns` tool already carried `byPillar`. Both call `readReturns`, which spreads `tokenReturns`, so the by-pillar figures come through the same as on the board. Owner-only access was in place too. What was missing was proof and a mention in the tool description.

shipped production is serving it deploy 28f939d

opened this

GET /api/v1/returns and the MCP returns tool already carried byPillar. Both call readReturns, which spreads tokenReturns, so the by-pillar figures come through the same as on the board. Owner-only access was in place too. What was missing was proof and a mention in the tool description.

  • Tests: The existing "by pillar" test in test/returns.test.ts now also checks three things:

- The owner's API byPillar equals what tokenReturns computes, which is what the board shows. - The owner's MCP returns gives the same byPillar as the API. - A reader gets byPillar: [] from the API (that check was already there) and an error from MCP that doesn't contain "P1 Ship".

  • MCP description: The tool description now says the same dollars come back as byPillar, by the pillar each run's issue serves. This is in src/http/mcp.ts.
  • Gate: No new test file, so GATE is unchanged.
  • Checks: test/returns.test.ts and test/mcp.test.ts pass (28 tests). I couldn't run the type check: tsc stopped on the missing bun type definitions, and I didn't get to the bottom of why. The forge's check will run it.
  • Left out: No change to the response shape, and no API docs beyond the tool description.

Closes #1595

Approved

Clean. GET /api/v1/returns and the MCP returns tool already returned byPillar, because both go through readReturns, which spreads tokenReturns. The owner-only gate in readReturns is unchanged. This pull adds two things:

  • Proof: for the owner, the API's byPillar equals what tokenReturns computes (the board shows the same figures), and MCP gives the same byPillar as the API. A reader gets [] from the API and nothing containing a pillar name from MCP.
  • Description: the tool description now mentions byPillar, so an agent calling it knows the figures are there.

The change adds no write path, no input and no dependency. The helpers it uses (mcp, aliceRw, bobRw, PillarReturn) are already in the test file.

Minor, not blocking: bobTool.isError ? "" : … passes without checking anything when MCP refuses. Asserting the expected shape, either the error or byPillar: [], would pin it down.

I couldn't reach the preview or read the screenshots from my sandbox (network and read access are denied). Nothing on the page changes in this pull, so I judged it on the diff.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs