Skip to main content
Glama
metricool

mcp-metricool

Official
by metricool

get_bluesky_posts

Retrieve Bluesky posts from your Metricool brand account within a specified date range by providing the init date, end date, and blog ID for organized data access.

Instructions

Get the list of Bluesky Posts from your Metricool brand account.

Args: init date: Init date of the period to get the data. The format is YYYY-MM-DD end date: End date of the period to get the data. The format is YYYY-MM-DD blog id: Blog id of the Metricool brand account.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
blog_idYes
end_dateYes
init_dateYes

Implementation Reference

  • Handler function decorated with @mcp.tool() that implements the get_bluesky_posts tool. It fetches Bluesky posts from the Metricool API for a given date range and blog ID, using make_get_request utility. The function signature and docstring define the input schema and description.
    @mcp.tool()
    async def get_bluesky_posts(init_date: str, end_date: str, blog_id: int) -> str | dict[str, Any]:
        """
        Get the list of Bluesky Posts from your Metricool brand account.
    
        Args:
         init date: Init date of the period to get the data. The format is YYYY-MM-DD
         end date: End date of the period to get the data. The format is YYYY-MM-DD
         blog id: Blog id of the Metricool brand account.
        """
    
        url = f"{METRICOOL_BASE_URL}/v2/analytics/posts/bluesky?from={init_date}T00%3A00%3A00&to={end_date}T23%3A59%3A59&blogId={blog_id}&userId={METRICOOL_USER_ID}&integrationSource=MCP"
    
        response = await make_get_request(url)
    
        if not response:
            return ("Failed to get Bluesky Posts")
    
        return response
  • Utility function used by the handler to make authenticated GET requests to the Metricool API.
    async def make_get_request(url: str) -> dict[str, Any] | None:
        """Make a get request to the Metricool API with proper error handling."""
        headers = {
            "X-Mc-Auth": METRICOOL_USER_TOKEN,
        }
        async with httpx.AsyncClient() as client:
            try:
                response = await client.get(url, headers=headers, timeout=30.0)
                response.raise_for_status()
                return response.json()
            except Exception:
                return None
  • Server file that imports the mcp instance from tools (where tools are registered via @mcp.tool() decorators) and runs the MCP server.
    from .tools import tools
    
    mcp = tools.mcp
    
    if __name__ == "__main__":
        # Initialize and run the server
        mcp.run(transport='stdio')

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/metricool/mcp-metricool'

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