Skip to main content
Glama

list_posts

Retrieve all posts for a specific Beehiiv publication using the publication ID. This tool integrates with the Beehiiv API v2 to provide access to post data for analysis or management purposes.

Instructions

List all posts for a given publication.

Args:
    publication_id: e.g. 'pub_00000000-0000-0000-0000-000000000000'

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
publication_idYes

Implementation Reference

  • The handler function for the 'list_posts' tool. It uses the beehiiv_request helper to fetch the latest 5 confirmed posts from the specified publication and formats them as a string list of ID: title.
    @mcp.tool()
    async def list_posts(publication_id: str) -> str:
        """
        List all posts for a given publication.
    
        Args:
            publication_id: e.g. 'pub_00000000-0000-0000-0000-000000000000'
        """
        params = {
            "order_by": "publish_date",
            "direction": "desc",
            "limit": 5,
            "status": "confirmed"
        }
        path = f"/publications/{publication_id}/posts"
        data = await beehiiv_request("GET", path, params=params)
        if not data or "data" not in data:
            return f"API error: {data.get('error', 'Unknown error')}"
        return "\n".join(f"{p['id']}: {p['title']}" for p in data["data"])
  • Shared helper function that performs authenticated HTTP requests to the Beehiiv API v2, handling errors and used by the list_posts handler.
    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)}
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states it's a list operation but doesn't mention whether it's read-only, paginated, rate-limited, or what permissions are required. For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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 appropriately sized and front-loaded, with the core purpose stated first followed by parameter details. Every sentence earns its place with no wasted words, making it efficient and easy to parse.

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

Completeness3/5

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

Given the tool's low complexity (1 parameter, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose and parameter but lacks details about output format, error handling, or behavioral traits that would make it more complete for agent use.

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 description adds meaningful context for the single parameter by providing an example format ('pub_00000000-0000-0000-0000-000000000000'), which is valuable since schema description coverage is 0%. However, it doesn't explain where to find this ID or what happens if an invalid ID is provided.

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

Purpose4/5

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

The description clearly states the tool's purpose with a specific verb ('List') and resource ('posts for a given publication'), making it easy to understand what it does. However, it doesn't explicitly differentiate from sibling tools like 'list_publications' or 'get_post', which would be needed for a perfect score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'list_publications' or 'get_post'. It mentions the required parameter but offers no context about appropriate use cases, prerequisites, or exclusions.

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

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