Skip to main content
Glama

get_webhook_subscription

Retrieve your current webhook subscription details, if one exists.

Instructions

Return the user's current webhook subscription, if any.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The `get_webhook_subscription` async function that performs a GET request to /webhook-subscription and returns the response data.
    async def get_webhook_subscription() -> dict[str, Any]:
        """Return the user's current webhook subscription, if any."""
        return {"data": await client.get("/webhook-subscription")}
  • The tool is registered via the @mcp.tool() decorator on line 13, inside the register() function of webhooks.py.
    @mcp.tool()
    @tool_guard
    async def get_webhook_subscription() -> dict[str, Any]:
        """Return the user's current webhook subscription, if any."""
        return {"data": await client.get("/webhook-subscription")}
  • webhooks.register(mcp, ctx) is called from register_all() in the tools package init.
    webhooks.register(mcp, ctx)
  • The `tool_guard` decorator wraps the handler, catching exceptions (HevyApiError, timeout, ValueError, unexpected) and returning structured {error, hint} responses.
    def tool_guard(func: Callable[..., Awaitable[Any]]) -> Callable[..., Awaitable[Any]]:
        """Decorator: convert exceptions into `{error, hint}` and emit structured logs."""
    
        @functools.wraps(func)
        async def wrapper(*args: Any, **kwargs: Any) -> Any:
            start = time.monotonic()
            name = func.__name__
            try:
                result = await func(*args, **kwargs)
                log.info("tool=%s status=ok duration_ms=%.1f", name, (time.monotonic() - start) * 1000)
                return result
            except HevyApiError as e:
                log.warning(
                    "tool=%s status=hevy_error http=%d duration_ms=%.1f msg=%s",
                    name, e.status, (time.monotonic() - start) * 1000, e.message,
                )
                return {"error": e.message, "hint": e.hint, "http_status": e.status}
            except httpx.TimeoutException:
                log.warning("tool=%s status=timeout duration_ms=%.1f", name, (time.monotonic() - start) * 1000)
                return {
                    "error": "Hevy API request timed out.",
                    "hint": "Retry the call. If it keeps timing out, reduce page_size or scope.",
                }
            except ValueError as e:
                log.warning("tool=%s status=bad_input duration_ms=%.1f msg=%s", name, (time.monotonic() - start) * 1000, e)
                return {"error": str(e), "hint": "Re-read the tool's input schema and adjust the arguments."}
            except Exception as e:  # noqa: BLE001 — last-resort guard so Claude never sees a stack trace
                log.exception("tool=%s status=internal_error duration_ms=%.1f", name, (time.monotonic() - start) * 1000)
                return {
                    "error": f"Unexpected internal error: {type(e).__name__}: {e}",
                    "hint": "This is a bug in hevy-mcp. Retry once; if it persists, file an issue with the tool name and inputs.",
                }
    
        return wrapper
  • HevyApiError exception class used by tool_guard to surface structured API errors with status, message, and hint.
    class HevyApiError(Exception):
        def __init__(self, status: int, message: str, hint: str | None = None) -> None:
            super().__init__(message)
            self.status = status
            self.message = message
            self.hint = hint or _default_hint(status)
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description must carry behavioral disclosure. It correctly indicates a read-only operation ('Return') and acknowledges potential null result ('if any'). However, it does not disclose authentication requirements or rate limits, though these are often assumed for read operations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence that conveys the core purpose without any filler. It is front-loaded and every word is meaningful.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has no parameters and an output schema exists to describe return value structure, the description sufficiently covers the tool's behavior for an agent to use it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters and the input schema is empty, so no parameter documentation is needed. The description adds no parameter info but the job is already fully covered by the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states that the tool returns the user's current webhook subscription, using a specific verb ('Return') and resource ('webhook subscription'), which distinguishes it from sibling tools like create_webhook_subscription and delete_webhook_subscription.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no explicit guidance on when to use this tool versus alternatives, nor does it mention any preconditions or exclusions. It is adequate for a simple getter but could benefit from context such as 'Use this when you need to check the current subscription before creating or deleting.'

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Vellarasan/hevy-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server