Skip to main content
Glama

create_new_post

Publish a new blog post on Beehiiv by providing a publication ID, title, subtitle, and HTML content. Simplifies content creation through structured inputs.

Instructions

Create a new post using provided HTML content.

Args:
    publication_id: ID of the publication
    title: Title of the new post
    subtitle: Subtitle of the new post
    html_content: HTML content for the post

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
html_contentYes
publication_idYes
subtitleYes
titleYes

Implementation Reference

  • The core handler function for the 'create_new_post' MCP tool. It is registered via @mcp.tool() decorator and implements the logic to create a new post in Beehiiv by posting title, subtitle, and HTML content to the API endpoint.
    @mcp.tool()
    # have not tested this as I am not an enterprise customer, but leaving here for reference
    async def create_new_post(publication_id: str, title: str, subtitle: str, html_content: str) -> str:
        """
        Create a new post using provided HTML content.
    
        Args:
            publication_id: ID of the publication
            title: Title of the new post
            subtitle: Subtitle of the new post
            html_content: HTML content for the post
        """
        path = f"/publications/{publication_id}/posts"
        
        post_data = {
            "title": title,
            "subtitle": subtitle,
            "content": {
                "free": {
                    "web": html_content,
                    "email": html_content,  # You might want to format this differently for email
                    "rss": html_content    # And for RSS
                }
            }
        }
        
        response = await beehiiv_request("POST", path, json_body=post_data)
        
        if not response or "data" not in response:
            return f"Failed to create post: {response.get('error', 'Unknown error')}"
        
        new_post = response["data"]
        return {
            "status": "success",
            "post_id": new_post.get("id"),
            "web_url": new_post.get("web_url")
        }
  • Supporting helper function 'beehiiv_request' used by the create_new_post handler to make authenticated API calls to Beehiiv.
    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 create_new_post function as an MCP tool.
    @mcp.tool()
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 creation tool, implying mutation, but lacks details on permissions, side effects (e.g., whether the post is published immediately), error handling, or response format. This is a significant gap for a mutation tool without annotation coverage.

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 with the main purpose in the first sentence. The parameter list is structured but could be more integrated; overall, it avoids unnecessary verbosity, though minor improvements in flow are possible.

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 of a mutation tool with no annotations, no output schema, and 0% schema description coverage, the description is incomplete. It lacks crucial details like behavioral traits, return values, and error conditions, making it inadequate for safe and effective agent use.

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 all four parameters with brief explanations (e.g., 'ID of the publication'), adding basic meaning beyond the schema's titles. However, it doesn't provide deeper context like format constraints or examples, leaving some semantic gaps.

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 action ('Create a new post') and specifies the resource ('using provided HTML content'), making the purpose evident. However, it doesn't explicitly differentiate from sibling tools like 'get_post' or 'list_posts', which are read operations versus this creation tool.

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 prerequisites (e.g., needing a valid publication_id from 'list_publications'), exclusions, or comparisons to siblings like 'get_post' for retrieval, leaving the agent to infer usage context.

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