Skip to main content
Glama

get_post

Retrieve a specific post by its ID from a Beehiiv publication using the MCP server, enabling structured access to content via the Beehiiv API v2. Input includes publication_id and post_id for precise data fetching.

Instructions

Retrieve a single post by ID.

Args:
    publication_id: ID of the publication
    post_id:        ID of the post

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
post_idYes
publication_idYes

Implementation Reference

  • The main handler function for the 'get_post' tool. It is decorated with @mcp.tool() for registration, fetches post data from the Beehiiv API using the helper function, and returns a formatted string with title, subtitle, URL, status, and authors.
    @mcp.tool()
    async def get_post(publication_id: str, post_id: str) -> str:
        """
        Retrieve a single post by ID.
    
        Args:
            publication_id: ID of the publication
            post_id:        ID of the post
        """
        path = f"/publications/{publication_id}/posts/{post_id}"
        data = await beehiiv_request("GET", path)
        if not data or "data" not in data:
            return "Failed to fetch the post."
        post = data["data"]
        return (
            f"Title: {post.get('title')}\n"
            f"Subtitle: {post.get('subtitle')}\n"
            f"URL: {post.get('web_url')}\n"
            f"Status: {post.get('status')}\n"
            f"Authors: {post.get('authors')}"
        )
  • Supporting utility function 'beehiiv_request' used by the get_post handler to make 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)}
  • The @mcp.tool() decorator registers the get_post function as an MCP tool.
    @mcp.tool()
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states 'retrieve' (implying a read operation) but doesn't cover critical aspects like authentication needs, rate limits, error handling (e.g., what happens if IDs are invalid), or response format. For a tool with zero annotation coverage, this is a significant gap, scoring 2 for minimal transparency.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded: the first sentence states the purpose clearly, followed by a structured 'Args' section. There's no wasted text, but the structure could be slightly improved by integrating the parameter explanations more seamlessly. Overall, it's efficient, earning a 4.

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

Completeness2/5

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

Given the complexity (a read operation with 2 required parameters), lack of annotations, and no output schema, the description is incomplete. It doesn't explain return values, error cases, or behavioral traits like idempotency. For a tool with no structured support, this leaves the agent under-informed, scoring 2 for inadequate completeness.

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

Parameters3/5

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

Schema description coverage is 0%, so the description must compensate. It lists both parameters ('publication_id' and 'post_id') with brief explanations, adding meaning beyond the schema's basic types. However, it doesn't specify format (e.g., UUID, numeric), constraints, or examples, leaving gaps. This partial compensation justifies a baseline 3.

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: 'Retrieve a single post by ID.' This specifies the verb ('retrieve') and resource ('post'), and distinguishes it from siblings like 'list_posts' (which retrieves multiple posts) and 'get_post_content' (which likely retrieves content details). However, it doesn't explicitly differentiate from 'create_new_post' or 'list_publications', keeping it at 4 rather than 5.

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. It doesn't mention when to choose 'get_post' over 'list_posts' (e.g., for a specific post vs. browsing) or 'get_post_content' (e.g., for metadata vs. full content). Without such context, the agent lacks explicit usage instructions, scoring 2 for no guidance.

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