delete_webhook
Remove a webhook subscription and all its feed attachments by providing the webhook ID.
Instructions
[write] Delete a webhook subscription and all its feed attachments.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| webhook_id | Yes | Webhook subscriber UUID |
Implementation Reference
- src/tools.ts:72-78 (registration)The delete_webhook tool is defined as a ToolDef in the TOOLS array. It accepts a webhook_id string, has write scope, and its handler makes a DELETE request to /api/v1/webhooks/{webhook_id}.
name: "delete_webhook", description: "Delete a webhook subscription and all its feed attachments.", scope: "write", inputSchema: WebhookIdInput, handler: ({ webhook_id }: any, c) => c.request("DELETE", `/api/v1/webhooks/${webhook_id}`), }, - src/tools.ts:23-25 (schema)Input schema for delete_webhook: a Zod object requiring a string webhook_id (the webhook subscriber UUID).
const WebhookIdInput = z.object({ webhook_id: z.string().describe("Webhook subscriber UUID"), }); - src/tools.ts:76-77 (handler)The handler destructures webhook_id from the input and calls c.request with HTTP DELETE method to the path /api/v1/webhooks/{webhook_id}.
handler: ({ webhook_id }: any, c) => c.request("DELETE", `/api/v1/webhooks/${webhook_id}`), - src/client.ts:23-55 (helper)The FeedbagelClient.request method is the HTTP helper that executes the actual fetch call. For delete_webhook, it sends a DELETE request (no body) to api.feedbagel.com/api/v1/webhooks/{webhook_id} with Bearer token auth.
async request( method: string, path: string, body?: unknown, ): Promise<unknown> { const res = await fetch(`${this.baseUrl}${path}`, { method, headers: { Authorization: `Bearer ${this.apiKey}`, ...(body !== undefined ? { "content-type": "application/json" } : {}), }, body: body !== undefined ? JSON.stringify(body) : undefined, }); const text = await res.text(); let json: unknown = undefined; try { json = text ? JSON.parse(text) : undefined; } catch { json = { raw: text }; } if (!res.ok) { // Surface 429 and 4xx details verbatim so the agent sees the cap info. const err: Error & { status?: number; body?: unknown } = new Error( `HTTP ${res.status} ${res.statusText}`, ); err.status = res.status; err.body = json; throw err; } return json; } - src/index.ts:45-86 (registration)The MCP server registration in index.ts handles the CallToolRequestSchema by looking up the tool by name in the TOOLS array, parsing input with the tool's schema, and dispatching to the tool's handler. This is how delete_webhook gets invoked at runtime.
server.setRequestHandler(CallToolRequestSchema, async (req) => { const tool = TOOLS.find((t) => t.name === req.params.name); if (!tool) { return { isError: true, content: [{ type: "text", text: `Unknown tool: ${req.params.name}` }], }; } const parsed = tool.inputSchema.safeParse(req.params.arguments ?? {}); if (!parsed.success) { return { isError: true, content: [ { type: "text", text: `Invalid arguments: ${parsed.error.message}`, }, ], }; } try { const result = await tool.handler(parsed.data, client); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; } catch (err) { const e = err as Error & { status?: number; body?: unknown }; return { isError: true, content: [ { type: "text", text: JSON.stringify( { error: e.message, status: e.status, body: e.body }, null, 2, ), }, ], }; } });