Skip to content

feat(mcp): attach existing webhooks to agents (PRO-1951) - #33

Merged
prat11m merged 1 commit into
mainfrom
feature/pro-1951-featmcp-attach-existing-webhooks-to-agents-agent
Jul 24, 2026
Merged

feat(mcp): attach existing webhooks to agents (PRO-1951)#33
prat11m merged 1 commit into
mainfrom
feature/pro-1951-featmcp-attach-existing-webhooks-to-agents-agent

Conversation

@prat11m

@prat11m prat11m commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #32 (PRO-1950). That pass only exposed org-level /webhook CRUD, which forced "create + attach" every time and let the model assume event types. The backend actually has an agent-scoped subscription API to attach an already-created webhook to an agent — this PR wraps it.

New tools

Tool Route
attach_agent_webhook POST /agent/:id/webhook-subscriptions {webhookId, eventTypes[]}
get_agent_webhooks GET /agent/:id/webhook-subscriptions
detach_agent_webhooks DELETE /agent/:id/webhook-subscriptions

Behavior fixes (the actual asks)

  • Attach from the existing list, don't recreate: attach_agent_webhook points an agent at an existing webhook. create_webhook's description now steers callers to use it (and to get_webhooks first) instead of registering a duplicate.
  • Never assume events: event_types is required on attach, and every event field carries an explicit "do not guess — ask the user" instruction.
  • create_webhook.events is now optional (backend accepts an empty array) so you can register an endpoint-only webhook, then attach separately.

Important backend semantics (documented in the tool)

POST /agent/:id/webhook-subscriptions replaces the agent's subscriptions — it deletes all existing subs for the agent, then recreates them for the given webhook only. So an agent points at one webhook at a time via this endpoint. (agent.controller.ts:972-996)

Flow

get_webhooks (pick from the list) → attach_agent_webhook (with the events the user chose).

Test plan

  • get_webhooks lists existing endpoints.
  • attach_agent_webhook with an existing webhook_id + explicit event_types → agent receives those events; verify via get_agent_webhooks.
  • Re-attaching a different webhook replaces the prior subscriptions (not additive).
  • detach_agent_webhooks clears them.
  • create_webhook without events registers an endpoint-only webhook.

Linear

PRO-1951

🤖 Generated with Claude Code

Adds agent-scoped webhook subscription tools wrapping
/agent/:id/webhook-subscriptions:
- attach_agent_webhook: attach an existing webhook to an agent for
  chosen events (replaces the agent's existing subscriptions)
- get_agent_webhooks: list an agent's subscriptions
- detach_agent_webhooks: remove all of an agent's subscriptions

Also makes create_webhook events optional (endpoint-only registration)
and steers callers to attach_agent_webhook for existing endpoints.
Event types are required and must not be assumed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@prat11m
prat11m merged commit 30fbaf8 into main Jul 24, 2026
1 check passed
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.

2 participants