get_tiktokads_campaigns
Retrieve TikTok Ads campaign data from your Metricool brand account by specifying the blog ID, start date, and end date for analysis and reporting purposes.
Instructions
Get the list of Tiktok Ads Campaigns 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:386-404 (handler)The main handler function for the 'get_tiktokads_campaigns' tool. It makes a GET request to the Metricool API to retrieve TikTok Ads campaigns data for the specified date range and blog ID. The @mcp.tool() decorator registers this function as an MCP tool and defines its schema via type hints and docstring.@mcp.tool() async def get_tiktokads_campaigns(init_date: str, end_date: str, blog_id: int) -> str | dict[str, Any]: """ Get the list of Tiktok Ads Campaigns 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/campaigns/tiktokads?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 Tiktok Ads Campaigns") return response