Skip to content

fix(mcp): claim_token renders real ClaimResponse + sends canonical token#35

Merged
mastermanas805 merged 1 commit into
masterfrom
fix/claim-token-response-shape
May 30, 2026
Merged

fix(mcp): claim_token renders real ClaimResponse + sends canonical token#35
mastermanas805 merged 1 commit into
masterfrom
fix/claim-token-response-shape

Conversation

@mastermanas805

Copy link
Copy Markdown
Member

Summary

  • The claim_token tool was rendering fields from the retired 201 direct-claim shape ({resource_type, token, tier, status, name}) that the api stopped returning on 2026-05-20. Every successful claim printed (see list_resources) four times — the agent learned NOTHING about what just happened, and never surfaced the 24h session_token the api hands back for immediate use.
  • Renderer now mirrors the live ClaimResponse shape (api/openapi.snapshot.json): {ok, team_id, user_id, session_token?, message?}. Branches into a "session token ready to use" block (legacy direct-claim path) vs a "magic link sent, check inbox" block depending on whether session_token came back, so the agent has actionable next-step copy in both cases.
  • Wire body flips from {jwt, email}{token, email}. jwt is deprecated: true in the openapi ClaimRequest schema (api still accepts it — token wins on collision — but the MCP was the last named drift source the ClaimRequest doc explicitly called out; dashboard + sdk-go already moved).

Coverage block

Symptom:        claim_token output prints "(see list_resources)" placeholders
                + wire body uses deprecated `jwt` alias
Enumeration:    rg -n 'resource_type|claimToken|jwt:' mcp/src mcp/test
Sites found:    3 emitters (client.ts ClaimResult, client.ts claimToken body, index.ts claim_token handler)
Sites touched:  3 + 4 test files updated to pin the new contract
Coverage test:  test/client-unit.test.ts deepEqual({token, email}) — fails if wire reverts to `jwt`
                test/tools-unit.test.ts assert.doesNotMatch(/\(see list_resources\)/) — fails if old renderer comes back
                test/integration.test.ts asserts Team ID + Session token lines + the same negative match
Live verified:  Awaiting api-side smoke (no production deploy from this PR).
                MCP is published via npm, so this lands when the operator publishes the next mcp version.

Test plan

  • npm test — 373 passing, 0 failing
  • npm run build — tsc clean
  • After merge: bump version + republish to npm so MCP clients pick it up

…oken`

The claim_token tool was rendering fields from the retired 201 direct-claim
shape ({resource_type, token, tier, status, name}) that the api stopped
returning on 2026-05-20. Every successful claim printed "(see list_resources)"
four times — the agent learned NOTHING about what just happened and never
surfaced the 24h session_token the api hands back for immediate use.

Now mirrors the live ClaimResponse shape (api/openapi.snapshot.json):
{ok, team_id, user_id, session_token?, message?}. Branches into a
"session token ready to use" block (legacy direct-claim path) vs a
"magic link sent, check inbox" block depending on whether session_token
came back, so the agent has actionable next-step copy in both cases.

Wire body also flips from {jwt, email} → {token, email}. `jwt` is marked
deprecated in the openapi ClaimRequest schema; the api still accepts it
(`token` wins on collision) but the MCP was the last drift source the
ClaimRequest doc explicitly called out (dashboard + sdk-go already moved).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mastermanas805 mastermanas805 merged commit 9138ff0 into master May 30, 2026
9 checks passed
@mastermanas805 mastermanas805 deleted the fix/claim-token-response-shape branch May 30, 2026 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant