delete-webhook-subscription
Delete the active webhook subscription to stop all automatic notifications.
Instructions
Delete the current webhook subscription for this account. This will stop all webhook notifications.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/webhooks.ts:138-167 (handler)The delete-webhook-subscription tool handler: schema definition, server.tool registration with empty schema, async handler that calls hevyClient.deleteWebhookSubscription(), and wraps with error handling. Returns JSON response on success or empty response on failure.
// Delete webhook subscription const deleteWebhookSubscriptionSchema = {} as const; type DeleteWebhookSubscriptionParams = InferToolParams< typeof deleteWebhookSubscriptionSchema >; server.tool( "delete-webhook-subscription", "Delete the current webhook subscription for this account. This will stop all webhook notifications.", deleteWebhookSubscriptionSchema, withErrorHandling(async (_args: DeleteWebhookSubscriptionParams) => { if (!hevyClient) { throw new Error( "API client not initialized. Please provide HEVY_API_KEY.", ); } if (!hevyClient.deleteWebhookSubscription) { throw new Error( "Webhook subscription API not available. Please regenerate the client from the updated OpenAPI spec.", ); } const data = await hevyClient.deleteWebhookSubscription(); if (!data) { return createEmptyResponse( "Failed to delete webhook subscription - no subscription may exist or there was a server error", ); } return createJsonResponse(data); }, "delete-webhook-subscription"), ); - src/tools/webhooks.ts:139-142 (schema)Empty schema (no input params) for delete-webhook-subscription since it requires no arguments.
const deleteWebhookSubscriptionSchema = {} as const; type DeleteWebhookSubscriptionParams = InferToolParams< typeof deleteWebhookSubscriptionSchema >; - src/tools/webhooks.ts:144-167 (registration)Registration of 'delete-webhook-subscription' tool via server.tool() with name, description, schema, and handler.
server.tool( "delete-webhook-subscription", "Delete the current webhook subscription for this account. This will stop all webhook notifications.", deleteWebhookSubscriptionSchema, withErrorHandling(async (_args: DeleteWebhookSubscriptionParams) => { if (!hevyClient) { throw new Error( "API client not initialized. Please provide HEVY_API_KEY.", ); } if (!hevyClient.deleteWebhookSubscription) { throw new Error( "Webhook subscription API not available. Please regenerate the client from the updated OpenAPI spec.", ); } const data = await hevyClient.deleteWebhookSubscription(); if (!data) { return createEmptyResponse( "Failed to delete webhook subscription - no subscription may exist or there was a server error", ); } return createJsonResponse(data); }, "delete-webhook-subscription"), ); - src/index.ts:48-80 (registration)Import and registration of registerWebhookTools function which registers the delete-webhook-subscription tool.
import { registerWebhookTools } from "./tools/webhooks.js"; import { registerWorkoutTools } from "./tools/workouts.js"; import { assertApiKey, parseConfig } from "./utils/config.js"; import { createClient } from "./utils/hevyClient.js"; const HEVY_API_BASEURL = "https://api.hevyapp.com"; const serverConfigSchema = z.object({ apiKey: z .string() .min(1, "Hevy API key is required") .describe("Your Hevy API key (available in the Hevy app settings)."), }); export const configSchema = serverConfigSchema; type ServerConfig = z.infer<typeof serverConfigSchema>; function buildServer(apiKey: string) { const baseServer = new McpServer({ name, version, }); const server = Sentry.wrapMcpServerWithSentry(baseServer); const hevyClient = createClient(apiKey, HEVY_API_BASEURL); console.error("Hevy client initialized with API key"); registerWorkoutTools(server, hevyClient); registerRoutineTools(server, hevyClient); registerTemplateTools(server, hevyClient); registerFolderTools(server, hevyClient); registerBodyMeasurementTools(server, hevyClient); registerWebhookTools(server, hevyClient); - src/utils/hevyClientKubb.ts:204-208 (helper)Stub implementation of deleteWebhookSubscription in the Kubb client (currently throws 'not available' error, pending OpenAPI spec regeneration).
deleteWebhookSubscription: async (): Promise<unknown> => { throw new Error( "Webhook subscription API not available. Please regenerate the client from the updated OpenAPI spec.", ); },