Skip to content

feat: accept connection name or ID in pause/unpause commands#277

Merged
leggetter merged 3 commits intomainfrom
auto-implement-issue-276
Mar 27, 2026
Merged

feat: accept connection name or ID in pause/unpause commands#277
leggetter merged 3 commits intomainfrom
auto-implement-issue-276

Conversation

@leggetter
Copy link
Copy Markdown
Collaborator

@leggetter leggetter commented Mar 27, 2026

Summary

Implements issue #276: hookdeck connection pause / unpause (and hookdeck gateway connection pause / unpause) accept a connection name or ID, using the same resolution as connection get (resolveConnectionID).

The gateway MCP tool hookdeck_connections is aligned: get, pause, and unpause accept the connection ID or name via resolveMCPConnectionID (same rules as the CLI).

Behavior

  • ID-shaped values (conn_*, web_*): GetConnection first; on 404, fall through to list by name (so a name that looks like an ID still works).
  • Other values: ListConnections with name=; 0 results → not found; >1 → ambiguous name error (use ID).

CLI

  • connection pause / connection unpause: Use, annotations, and Long text updated; examples for ID and name.
  • Resolution: resolveConnectionID before PauseConnection / UnpauseConnection.

MCP (hookdeck_connections)

  • get: resolves ID or name, then fetches the connection.
  • pause / unpause: resolve then call API.
  • Resolver errors use TranslateAPIError (e.g. 401 matches other tools).
  • Missing parameter: id or name is required for get/pause/unpause.
  • Tool description / tool_help / JSON schema copy updated for get-by-name; merged with main wording on project scoping (hookdeck_projects).

Tests

  • Unit (pkg/cmd): connection_get_resolve_test.go — httptest coverage for resolveConnectionID.
  • MCP (pkg/gateway/mcp): mocks GET /connections/{id} before pause/unpause; list mocks include pagination limit so name resolution is not treated as empty; get/pause/unpause by name; missing-id assertions.
  • Acceptance (//go:build connection): TestConnectionPauseUnpauseByName — create connection, pause/unpause by name, assert paused_at via get.

Merge

  • main merged into this branch; conflict in pkg/gateway/mcp/tools.go resolved by keeping ID or name in the connections tool description and project scoping text from main.

Verification

go test ./... -count=1

Acceptance slice (requires API key): go test -tags=connection ./test/acceptance/... (see test/acceptance/README.md).

Closes #276

@leggetter
Copy link
Copy Markdown
Collaborator Author

We need some acceptance tests and potentially some unit tests for this.

Completes the pause/unpause name-or-ID work from the parent commit and
aligns MCP, tests, and user-facing copy.

CLI
- Document pause/unpause with examples (ID and name) in command Long text.
- Add httptest coverage for resolveConnectionID: direct web_* ID, lookup
  by name via ListConnections, and web_* GET 404 falling back to name.

Gateway MCP (hookdeck_connections)
- Resolve connection ID or name for get, pause, and unpause using the same
  rules as the CLI (prefix probe, then list-by-name).
- Surface API errors during resolution through TranslateAPIError so
  responses match other tools (e.g. authentication failures).
- Validation errors: id or name is required for get/pause/unpause.
- Refresh tool description, static help, and JSON schema text for get by
  name.

Tests
- MCP server tests: stub GET /connections/{id} before pause/unpause;
  include pagination limit in list mocks so name resolution succeeds;
  add get/pause/unpause-by-name cases; update missing-parameter assertions.
- Acceptance: TestConnectionPauseUnpauseByName exercises pause/unpause by
  name against the real API and checks paused_at via connection get.

Refs: #276
Made-with: Cursor
@leggetter leggetter marked this pull request as ready for review March 27, 2026 13:03
Made-with: Cursor

# Conflicts:
#	pkg/gateway/mcp/tools.go
@leggetter leggetter merged commit a0060d0 into main Mar 27, 2026
15 of 16 checks passed
@leggetter leggetter deleted the auto-implement-issue-276 branch March 27, 2026 14:00
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.

CLI: connection pause/unpause should accept connection name or ID

1 participant