get_x_posts
Retrieve X (Twitter) posts from a Metricool account within a specified date range using start date, end date, and blog ID. Simplify social media data extraction for analysis or reporting.
Instructions
Get the list of X (Twitter) Posts from your Metricool account.
Args: init date: Init date of the period to get the data. The format is YYYYMMDD end date: End date of the period to get the data. The format is YYYYMMDD blog id: Blog id of the Metricool brand account.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| blog_id | Yes | ||
| end_date | Yes | ||
| init_date | Yes |
Implementation Reference
- src/mcp_metricool/tools/tools.py:226-244 (handler)The core handler function for the 'get_x_posts' tool. It is registered via the @mcp.tool() decorator. Fetches X (formerly Twitter) posts data from the Metricool API using a GET request to the /stats/twitter/posts endpoint, with parameters for date range and blog ID. Returns the API response or an error message if the request fails.@mcp.tool() async def get_x_posts(init_date: str, end_date: str, blog_id: int) -> str | dict[str, Any]: """ Get the list of X (Twitter) Posts from your Metricool account. Args: init date: Init date of the period to get the data. The format is YYYYMMDD end date: End date of the period to get the data. The format is YYYYMMDD blog id: Blog id of the Metricool brand account. """ url = f"{METRICOOL_BASE_URL}/stats/twitter/posts?start={init_date}&end={end_date}&blogId={blog_id}&userId={METRICOOL_USER_ID}&integrationSource=MCP" response = await make_get_request(url) if not response: return ("Failed to get X Posts") return response