get_thread_posts
Retrieve thread posts from your Metricool brand account within a specified date range using a specific blog ID. Simplify data extraction for analysis or reporting.
Instructions
Get the list of Threads 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
| Name | Required | Description | Default |
|---|---|---|---|
| blog_id | Yes | ||
| end_date | Yes | ||
| init_date | Yes |
Implementation Reference
- src/mcp_metricool/tools/tools.py:206-224 (handler)The main handler function for the 'get_thread_posts' tool, registered via @mcp.tool(). It constructs the Metricool API URL for Threads posts and fetches the data using make_get_request, handling errors by returning a failure message.@mcp.tool() async def get_thread_posts(init_date: str, end_date: str, blog_id: int) -> str | dict[str, Any]: """ Get the list of Threads 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/threads?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 Threads Posts") return response
- src/mcp_metricool/tools/tools.py:206-206 (registration)The @mcp.tool() decorator registers the get_thread_posts function as an MCP tool on the FastMCP instance.@mcp.tool()
- Input schema defined by function parameters (init_date: str, end_date: str, blog_id: int) and detailed in docstring. Output is str (error) or dict[str, Any] (API response).async def get_thread_posts(init_date: str, end_date: str, blog_id: int) -> str | dict[str, Any]: """ Get the list of Threads 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. """