Skip to content

fix(mcp): pause/resume tools use PATCH /v1/cues/{id}#1

Merged
govindkavaturi-art merged 1 commit into
mainfrom
fix/pause-resume-patch
Apr 17, 2026
Merged

fix(mcp): pause/resume tools use PATCH /v1/cues/{id}#1
govindkavaturi-art merged 1 commit into
mainfrom
fix/pause-resume-patch

Conversation

@govindkavaturi-art
Copy link
Copy Markdown
Member

Root cause

The `cueapi_pause_cue` and `cueapi_resume_cue` tools call endpoints that don't exist on the CueAPI server:

  • `POST /v1/cues/{id}/pause` → 404 at runtime
  • `POST /v1/cues/{id}/resume` → 404 at runtime

CueAPI doesn't expose dedicated pause/resume routes. Status is mutated via `PATCH /v1/cues/{id}` with `{"status": "..."}`. The CLI has been doing this correctly all along — see `cueapi-cli/cueapi/cli.py:290-314`.

Allowed status values from the Cue model's CHECK constraint (`cueapi-core/app/models/cue.py:35`):

```python
status IN ('active', 'paused', 'completed', 'failed')
```

Changes

File Change
`src/tools.ts` `cueapi_pause_cue` → `PATCH /v1/cues/{id}` body `{status: "paused"}`; `cueapi_resume_cue` → body `{status: "active"}`. Input schemas unchanged. Comments reference the CLI + Cue model.
`tests/tools.test.ts` 3 new behavioral tests that stub the client and pin the HTTP contract (method, path, body, URL-encoding). The original suite was surface-only (tool count, names, schemas) and never exercised handlers — which is how this bug shipped.
`package.json` `0.1.2` → `0.1.3`
`README.md` New "Changelog" section with 0.1.0 / 0.1.2 / 0.1.3 entries

No changes to `src/client.ts` — its generic `request(method, path, body?, query?)` method already supports PATCH.

Test plan

```
$ npm test
✓ tests/tools.test.ts (9 tests) 2ms

Test Files 1 passed (1)
Tests 9 passed (9)

$ npm run build

tsc — clean compile

```

All 9 tests pass (6 existing + 3 new behavioral). TypeScript compiles cleanly.

How this bug was found

Surfaced during a read-only architecture audit for an external prospect evaluating Cue for a multi-agent setup. Comparing the MCP server's tool implementations against the CLI's `pause`/`resume` commands revealed the mismatch. No customer reports yet — the pause/resume tools were likely rarely invoked from MCP hosts.

Not doing in this PR

  • Not publishing to npm. Waiting for explicit approval after review. Once approved, `npm publish` from main after merge.
  • Not adding a dedicated pause/resume endpoint to the server. The PATCH model is the one the CLI uses and is the supported contract; the bug was in the MCP server, not the server API.

Test plan checklist

  • `npm ci` succeeds
  • `npm test` passes 9/9
  • `npm run build` compiles cleanly
  • Behavioral test confirms PATCH method + correct body for both tools
  • URL-encoding test confirms cue_id is escaped
  • CI on this PR green

The `cueapi_pause_cue` and `cueapi_resume_cue` tools previously called
`POST /v1/cues/{id}/pause` and `/resume` respectively. Those endpoints
do not exist on the CueAPI server — calls returned runtime 404s.

Status is mutated via `PATCH /v1/cues/{id}` with body `{status: "..."}`,
matching the CLI's behavior (cueapi-cli/cueapi/cli.py:290-314). The
allowed status values come from the Cue model's CHECK constraint
(cueapi-core/app/models/cue.py:35):
    status IN ('active', 'paused', 'completed', 'failed')

Changes:
- src/tools.ts: pause handler now PATCHes with {status: "paused"};
  resume handler PATCHes with {status: "active"}.
- tests/tools.test.ts: added 3 behavioral tests that stub the client
  and pin the HTTP contract (method, path, body). The original test
  suite was surface-only (tool count, names, schemas) and did not
  exercise handlers, which is how the bug shipped. 9/9 tests pass.
- package.json: 0.1.2 → 0.1.3.
- README.md: changelog section with entries for 0.1.0, 0.1.2, 0.1.3.

No client.ts changes required — the existing generic `request(method,
path, body?, query?)` method supports PATCH without modification.
No changes to the Zod input schema.

Do NOT publish to npm until this PR is reviewed.
@govindkavaturi-art govindkavaturi-art merged commit de4c6f7 into main Apr 17, 2026
govindkavaturi-art pushed a commit that referenced this pull request Apr 17, 2026
Actually releases the PR #1 pause/resume PATCH fix to npm.

0.1.3 was published prematurely with this note but without the
merged code — the fix landed in PR #1 (merged 2026-04-17, commit
de4c6f7). 0.1.4 is the release that actually contains it.

Changelog updated to reflect this honestly: 0.1.3 entry is now
marked as superseded; 0.1.4 carries the full fix description.

No code changes. Build + tests still green (9/9).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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