Skip to main content
Glama

list_publications

Retrieve all accessible publications using the API key to manage or analyze content within the Beehiiv platform.

Instructions

List all publications accessible with this API key.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'list_publications' tool, decorated with @mcp.tool() for registration. It fetches and formats the list of publications from the Beehiiv API.
    @mcp.tool() async def list_publications() -> str: """ List all publications accessible with this API key. """ data = await beehiiv_request("GET", "/publications") if not data or "data" not in data: return "Failed to fetch publications." pubs = data["data"] return "\n".join(f"{p['id']}: {p['name']}" for p in pubs)
  • Supporting helper utility 'beehiiv_request' used by the list_publications handler to perform authenticated HTTP requests to the Beehiiv API.
    async def beehiiv_request( method: str, path: str, params: Optional[dict[str, Any]] = None, json_body: Optional[dict[str, Any]] = None ) -> Optional[dict[str, Any]]: """ Helper to call the beehiiv API v2. Args: method: HTTP method (GET, POST, etc.) path: API path (e.g. '/publications') params: Query parameters json_body: Request JSON body """ headers = { "Authorization": f"Bearer {BEEHIIV_API_KEY}", "Content-Type": "application/json" } url = f"{BASE_URL}{path}" async with httpx.AsyncClient() as client: try: response = await client.request( method, url, headers=headers, params=params, json=json_body, timeout=30.0 ) response.raise_for_status() return response.json() except httpx.HTTPError as e: return {"error": str(e)}

Other Tools

Related 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/reymerekar7/beehiiv-mcp-server'

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