Skip to main content
Glama

get_tiktok_campaign_stats

Retrieve TikTok campaign performance metrics including impressions, clicks, spend, CTR, CPC, and conversions for analysis and optimization.

Instructions

Get performance metrics for a TikTok campaign: impressions, clicks, spend, CTR, CPC, conversions. Requires Pro plan or higher ($69/mo).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
campaign_idYesTikTok campaign ID.
start_dateNoStart date YYYY-MM-DD. Default: 7 days ago.
end_dateNoEnd date YYYY-MM-DD. Default: today.

Implementation Reference

  • Handler logic for the get_tiktok_campaign_stats tool in src/index.ts
    case 'get_tiktok_campaign_stats': {
        const denied = licenseCheck('tiktok');
        if (denied) return fail(denied);
        if (!args.campaign_id) return fail('campaign_id required.');
        const now = new Date(), weekAgo = new Date(now.getTime() - 7 * 86400000);
        const fmt = (d: Date) => d.toISOString().split('T')[0];
        return ok(await tikTokGet('/report/integrated/get/', {
            advertiser_id: cfg.tikTokAdvId(), report_type: 'BASIC',
            dimensions: '["campaign_id","stat_time_day"]',
            metrics: '["spend","impressions","clicks","ctr","cpc","conversion","cost_per_conversion"]',
            data_level: 'AUCTION_CAMPAIGN',
            start_date: (args.start_date as string) || fmt(weekAgo),
            end_date:   (args.end_date   as string) || fmt(now),
            filtering: JSON.stringify([{ field_name: 'campaign_ids', filter_type: 'IN', filter_value: `["${args.campaign_id}"]` }]),
        }));
    }
  • Registration and schema definition for the get_tiktok_campaign_stats tool in src/index.ts
        name: 'get_tiktok_campaign_stats',
        description: 'Get performance metrics for a TikTok campaign: impressions, clicks, spend, CTR, CPC, conversions. Requires Pro plan or higher ($69/mo).',
        inputSchema: {
            type: 'object',
            properties: {
                campaign_id: { type: 'string', description: 'TikTok campaign ID.' },
                start_date:  { type: 'string', description: 'Start date YYYY-MM-DD. Default: 7 days ago.' },
                end_date:    { type: 'string', description: 'End date YYYY-MM-DD. Default: today.' },
            },
            required: ['campaign_id'],
        },
    },
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden and adds valuable behavioral context beyond the schema. It discloses the Pro plan requirement (authentication/access level constraint) and lists the specific metrics returned, which helps understand what data will be available.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two concise sentences with zero waste. First sentence states purpose and metrics, second sentence provides crucial usage requirement. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a read operation with 100% schema coverage but no annotations or output schema, the description does well by listing metrics and access requirements. However, it doesn't mention data freshness, rate limits, or error conditions that would be helpful for a stats retrieval tool.

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 100%, so the schema already documents all three parameters thoroughly. The description doesn't add any parameter-specific information beyond what's in the schema, maintaining the baseline score of 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get performance metrics') and the resource ('TikTok campaign'), listing specific metrics (impressions, clicks, spend, CTR, CPC, conversions). It distinguishes from siblings like 'get_meta_campaign_stats' by specifying TikTok platform.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit usage context by stating 'Requires Pro plan or higher ($69/mo)', which helps determine when this tool can be used. However, it doesn't explicitly mention when to use alternatives like 'get_meta_campaign_stats' or other TikTok campaign tools.

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

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/Nolas-Shadow/agent1st-ads-mcp'

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