create_webhook_subscription
Creates or replaces a webhook subscription to receive Hevy workout events at a specified HTTPS URL.
Instructions
Create or replace the user's webhook subscription.
url: HTTPS endpoint Hevy will POST events to.event_type: e.g. "workout_created". Hevy only accepts one subscription per key.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | ||
| event_type | No | workout_created |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/hevy_mcp/tools/webhooks.py:19-28 (handler)The actual handler function that creates a webhook subscription by POSTing to /webhook-subscription with url and eventType
@mcp.tool() @tool_guard async def create_webhook_subscription(url: str, event_type: str = "workout_created") -> dict[str, Any]: """Create or replace the user's webhook subscription. - `url`: HTTPS endpoint Hevy will POST events to. - `event_type`: e.g. "workout_created". Hevy only accepts one subscription per key. """ return {"data": await client.post("/webhook-subscription", json={"url": url, "eventType": event_type})} - src/hevy_mcp/tools/webhooks.py:19-28 (schema)Input schema via type hints: url (str) and optional event_type (str, default 'workout_created'). Output is dict[str, Any]
@mcp.tool() @tool_guard async def create_webhook_subscription(url: str, event_type: str = "workout_created") -> dict[str, Any]: """Create or replace the user's webhook subscription. - `url`: HTTPS endpoint Hevy will POST events to. - `event_type`: e.g. "workout_created". Hevy only accepts one subscription per key. """ return {"data": await client.post("/webhook-subscription", json={"url": url, "eventType": event_type})} - src/hevy_mcp/tools/webhooks.py:10-12 (registration)The register() function that's called to attach the tool to the MCP server via @mcp.tool() decorator
def register(mcp, ctx) -> None: client = ctx.client - src/hevy_mcp/tools/__init__.py:3-12 (registration)webhooks module imported and register() called in register_all() at line 11
from . import analytics, folders, routines, templates, webhooks, workouts def register_all(mcp, ctx) -> None: workouts.register(mcp, ctx) routines.register(mcp, ctx) folders.register(mcp, ctx) templates.register(mcp, ctx) webhooks.register(mcp, ctx) analytics.register(mcp, ctx)