Skip to main content
Glama

list_webhooks

Retrieve configured webhooks for a Bitbucket repository to monitor URL endpoints, event triggers, and status details.

Instructions

List webhooks configured for a repository.

Args:
    repo_slug: Repository slug
    limit: Maximum number of results (default: 50)

Returns:
    List of webhooks with URL, events, and status

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_slugYes
limitNo

Implementation Reference

  • MCP tool handler: lists repository webhooks via BitbucketClient, formats output using WebhookSummary Pydantic model
    @mcp.tool()
    @handle_bitbucket_error
    @formatted
    def list_webhooks(repo_slug: str, limit: int = 50) -> dict:
        """List webhooks configured for a repository.
    
        Args:
            repo_slug: Repository slug
            limit: Maximum number of results (default: 50)
    
        Returns:
            List of webhooks with URL, events, and status
        """
        client = get_client()
        webhooks = client.list_webhooks(repo_slug, limit=validate_limit(limit))
        return {
            "webhooks": [WebhookSummary.from_api(w).model_dump() for w in webhooks],
        }
  • Pydantic output model WebhookSummary: defines structure and validation for webhook list responses, with from_api factory method
    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"),
            )
  • Tool registration via @mcp.tool() decorator on the handler function
    @mcp.tool()
    @handle_bitbucket_error
    @formatted
  • BitbucketClient helper method: performs paginated GET request to Bitbucket API /hooks endpoint
    def list_webhooks(
        self,
        repo_slug: str,
        limit: int = 50,
    ) -> list[dict[str, Any]]:
        """List webhooks for a repository.
    
        Args:
            repo_slug: Repository slug
            limit: Maximum results to return
    
        Returns:
            List of webhook info dicts
        """
        return self._paginated_list(
            self._repo_path(repo_slug, "hooks"),
            limit=limit,
        )

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