Skip to main content
Glama

get_webhook

Retrieve configuration details for a specific Bitbucket repository webhook, including URL, events, and status, using repository slug and webhook UUID.

Instructions

Get details about a specific webhook.

Args:
    repo_slug: Repository slug
    webhook_uuid: Webhook UUID (from list_webhooks)

Returns:
    Webhook details including URL, events, and status

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_slugYes
webhook_uuidYes

Implementation Reference

  • MCP tool handler and registration for 'get_webhook'. This function is decorated with @mcp.tool() to register it as an MCP tool, fetches webhook details via BitbucketClient, handles not found cases, and serializes using WebhookSummary model.
    @mcp.tool()
    @handle_bitbucket_error
    @formatted
    def get_webhook(repo_slug: str, webhook_uuid: str) -> dict:
        """Get details about a specific webhook.
    
        Args:
            repo_slug: Repository slug
            webhook_uuid: Webhook UUID (from list_webhooks)
    
        Returns:
            Webhook details including URL, events, and status
        """
        client = get_client()
        result = client.get_webhook(repo_slug, webhook_uuid)
        if not result:
            return not_found_response("Webhook", webhook_uuid)
    
        return WebhookSummary.from_api(result).model_dump()
  • Pydantic BaseModel defining the schema for webhook data returned by the get_webhook tool. Includes from_api classmethod to parse Bitbucket API responses.
    class WebhookSummary(BaseModel):
        """Webhook info for list responses."""
    
        uuid: str
        url: str
        description: str = ""
        events: list[str] = []
        active: bool = True
        created: Optional[str] = None
    
        @field_validator("created", mode="before")
        @classmethod
        def truncate_ts(cls, v: Any) -> Optional[str]:
            return truncate_timestamp(v)
    
        @classmethod
        def from_api(cls, data: dict) -> "WebhookSummary":
            return cls(
                uuid=data.get("uuid", ""),
                url=data.get("url", ""),
                description=data.get("description", ""),
                events=data.get("events", []),
                active=data.get("active", True),
                created=data.get("created_at"),
            )
  • Core BitbucketClient method that performs the actual API request to retrieve webhook details. Called by the MCP tool handler.
    def get_webhook(
        self, repo_slug: str, webhook_uid: str
    ) -> Optional[dict[str, Any]]:
        """Get webhook details.
    
        Args:
            repo_slug: Repository slug
            webhook_uid: Webhook UID
    
        Returns:
            Webhook info or None if not found
        """
        webhook_uid = ensure_uuid_braces(webhook_uid)
        return self._request(
            "GET",
            self._repo_path(repo_slug, "hooks", webhook_uid),
        )

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/JaviMaligno/mcp-server-bitbucket'

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