{
  "openapi": "3.1.0",
  "info": {
    "title": "TikTok Ads MCP Server",
    "description": "TikTok Marketing API for short-form video advertising",
    "version": "1.0.0",
    "contact": {
      "name": "Hopkin",
      "url": "https://hopkin.ai"
    }
  },
  "servers": [
    {
      "url": "https://tiktok.mcp.hopkin.ai",
      "description": "Production MCP endpoint"
    }
  ],
  "paths": {
    "/tools": {
      "get": {
        "operationId": "listTools",
        "summary": "List available tools",
        "description": "Returns all tools registered on this server with their names, descriptions, and input schemas.",
        "tags": [
          "discovery"
        ],
        "responses": {
          "200": {
            "description": "Tool list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ToolList"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpError"
                }
              }
            }
          }
        }
      }
    },
    "/tools/tiktok_ads_list_ad_groups": {
      "post": {
        "operationId": "tiktok_ads_list_ad_groups",
        "summary": "List TikTok Ad Groups",
        "description": "List TikTok ad groups for an advertiser. Shows name, status, targeting, and budget.",
        "tags": [
          "ad-groups"
        ],
        "x-mcp-annotations": {
          "readOnlyHint": true,
          "destructiveHint": false,
          "idempotentHint": true,
          "openWorldHint": true
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "default": 20,
                    "description": "Maximum number of results to return (1–100). Default: 20."
                  },
                  "cursor": {
                    "type": "string",
                    "description": "Opaque pagination cursor from a previous response."
                  },
                  "refresh": {
                    "type": "boolean",
                    "default": false,
                    "description": "Force a fresh fetch bypassing the cache."
                  },
                  "advertiser_id": {
                    "type": "string",
                    "minLength": 1,
                    "description": "TikTok advertiser ID."
                  },
                  "adgroup_id": {
                    "type": "string",
                    "description": "Fetch a single ad group by ID."
                  },
                  "adgroup_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "minItems": 1,
                    "maxItems": 50,
                    "description": "Fetch specific ad groups by IDs."
                  },
                  "campaign_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "minItems": 1,
                    "maxItems": 50,
                    "description": "Filter by parent campaign IDs."
                  },
                  "status": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "STATUS_ALL",
                        "STATUS_ON",
                        "STATUS_OFF",
                        "STATUS_BUDGET_EXCEED",
                        "STATUS_DONE",
                        "STATUS_DELETE"
                      ]
                    },
                    "description": "Filter by primary status."
                  },
                  "search": {
                    "type": "string",
                    "description": "Search ad groups by name (case-insensitive)."
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500,
                    "description": "Why this tool call is needed"
                  }
                },
                "required": [
                  "advertiser_id",
                  "reason"
                ],
                "additionalProperties": false,
                "$schema": "http://json-schema.org/draft-07/schema#"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Markdown-formatted result with structured content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpToolResult"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpError"
                }
              }
            }
          },
          "404": {
            "description": "Tool not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          },
          "422": {
            "description": "Invalid parameters — request body failed schema validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          }
        }
      }
    },
    "/tools/tiktok_ads_get_ad_group": {
      "post": {
        "operationId": "tiktok_ads_get_ad_group",
        "summary": "Get TikTok Ad Group",
        "description": "Get details for a single TikTok ad group by ID.",
        "tags": [
          "ad-group"
        ],
        "x-mcp-annotations": {
          "readOnlyHint": true,
          "destructiveHint": false,
          "idempotentHint": true,
          "openWorldHint": true
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "advertiser_id": {
                    "type": "string",
                    "minLength": 1,
                    "description": "TikTok advertiser ID."
                  },
                  "adgroup_id": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Ad group ID."
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500,
                    "description": "Why this tool call is needed"
                  }
                },
                "required": [
                  "advertiser_id",
                  "adgroup_id",
                  "reason"
                ],
                "additionalProperties": false,
                "$schema": "http://json-schema.org/draft-07/schema#"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Markdown-formatted result with structured content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpToolResult"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpError"
                }
              }
            }
          },
          "404": {
            "description": "Tool not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          },
          "422": {
            "description": "Invalid parameters — request body failed schema validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          }
        }
      }
    },
    "/tools/tiktok_ads_list_ads": {
      "post": {
        "operationId": "tiktok_ads_list_ads",
        "summary": "List TikTok Ads",
        "description": "List TikTok ads for an advertiser. Shows name, status, creative, and ad group association.",
        "tags": [
          "ads"
        ],
        "x-mcp-annotations": {
          "readOnlyHint": true,
          "destructiveHint": false,
          "idempotentHint": true,
          "openWorldHint": true
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "default": 20,
                    "description": "Maximum number of results to return (1–100). Default: 20."
                  },
                  "cursor": {
                    "type": "string",
                    "description": "Opaque pagination cursor from a previous response."
                  },
                  "refresh": {
                    "type": "boolean",
                    "default": false,
                    "description": "Force a fresh fetch bypassing the cache."
                  },
                  "advertiser_id": {
                    "type": "string",
                    "minLength": 1,
                    "description": "TikTok advertiser ID."
                  },
                  "ad_id": {
                    "type": "string",
                    "description": "Fetch a single ad by ID."
                  },
                  "ad_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "minItems": 1,
                    "maxItems": 50,
                    "description": "Fetch specific ads by IDs."
                  },
                  "campaign_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "minItems": 1,
                    "maxItems": 50,
                    "description": "Filter by parent campaign IDs."
                  },
                  "adgroup_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "minItems": 1,
                    "maxItems": 50,
                    "description": "Filter by parent ad group IDs."
                  },
                  "status": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "STATUS_ALL",
                        "STATUS_ON",
                        "STATUS_OFF",
                        "STATUS_BUDGET_EXCEED",
                        "STATUS_DONE",
                        "STATUS_DELETE"
                      ]
                    },
                    "description": "Filter by primary status."
                  },
                  "search": {
                    "type": "string",
                    "description": "Search ads by name (case-insensitive)."
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500,
                    "description": "Why this tool call is needed"
                  }
                },
                "required": [
                  "advertiser_id",
                  "reason"
                ],
                "additionalProperties": false,
                "$schema": "http://json-schema.org/draft-07/schema#"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Markdown-formatted result with structured content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpToolResult"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpError"
                }
              }
            }
          },
          "404": {
            "description": "Tool not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          },
          "422": {
            "description": "Invalid parameters — request body failed schema validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          }
        }
      }
    },
    "/tools/tiktok_ads_get_ad": {
      "post": {
        "operationId": "tiktok_ads_get_ad",
        "summary": "Get TikTok Ad",
        "description": "Get details for a single TikTok ad by ID.",
        "tags": [
          "ad"
        ],
        "x-mcp-annotations": {
          "readOnlyHint": true,
          "destructiveHint": false,
          "idempotentHint": true,
          "openWorldHint": true
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "advertiser_id": {
                    "type": "string",
                    "minLength": 1,
                    "description": "TikTok advertiser ID."
                  },
                  "ad_id": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Ad ID."
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500,
                    "description": "Why this tool call is needed"
                  }
                },
                "required": [
                  "advertiser_id",
                  "ad_id",
                  "reason"
                ],
                "additionalProperties": false,
                "$schema": "http://json-schema.org/draft-07/schema#"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Markdown-formatted result with structured content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpToolResult"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpError"
                }
              }
            }
          },
          "404": {
            "description": "Tool not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          },
          "422": {
            "description": "Invalid parameters — request body failed schema validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          }
        }
      }
    },
    "/tools/tiktok_ads_list_advertisers": {
      "post": {
        "operationId": "tiktok_ads_list_advertisers",
        "summary": "List TikTok Advertisers",
        "description": "List TikTok advertiser accounts accessible to the authenticated user. Shows name, ID, status, currency, and timezone.",
        "tags": [
          "advertisers"
        ],
        "x-mcp-annotations": {
          "readOnlyHint": true,
          "destructiveHint": false,
          "idempotentHint": true,
          "openWorldHint": true
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "default": 20,
                    "description": "Maximum number of results to return (1–100). Default: 20."
                  },
                  "cursor": {
                    "type": "string",
                    "description": "Opaque pagination cursor from a previous response."
                  },
                  "refresh": {
                    "type": "boolean",
                    "default": false,
                    "description": "Force a fresh fetch bypassing the cache."
                  },
                  "advertiser_id": {
                    "type": "string",
                    "description": "Fetch a single advertiser by ID."
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500,
                    "description": "Why this tool call is needed"
                  }
                },
                "required": [
                  "reason"
                ],
                "additionalProperties": false,
                "$schema": "http://json-schema.org/draft-07/schema#"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Markdown-formatted result with structured content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpToolResult"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpError"
                }
              }
            }
          },
          "404": {
            "description": "Tool not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          },
          "422": {
            "description": "Invalid parameters — request body failed schema validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          }
        }
      }
    },
    "/tools/tiktok_ads_get_advertiser": {
      "post": {
        "operationId": "tiktok_ads_get_advertiser",
        "summary": "Get TikTok Advertiser",
        "description": "Get details for a single TikTok advertiser by ID.",
        "tags": [
          "advertiser"
        ],
        "x-mcp-annotations": {
          "readOnlyHint": true,
          "destructiveHint": false,
          "idempotentHint": true,
          "openWorldHint": true
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "advertiser_id": {
                    "type": "string",
                    "minLength": 1,
                    "description": "TikTok advertiser ID."
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500,
                    "description": "Why this tool call is needed"
                  }
                },
                "required": [
                  "advertiser_id",
                  "reason"
                ],
                "additionalProperties": false,
                "$schema": "http://json-schema.org/draft-07/schema#"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Markdown-formatted result with structured content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpToolResult"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpError"
                }
              }
            }
          },
          "404": {
            "description": "Tool not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          },
          "422": {
            "description": "Invalid parameters — request body failed schema validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          }
        }
      }
    },
    "/tools/tiktok_ads_list_audiences": {
      "post": {
        "operationId": "tiktok_ads_list_audiences",
        "summary": "List TikTok Audiences",
        "description": "List custom and lookalike audiences for a TikTok advertiser.",
        "tags": [
          "audiences"
        ],
        "x-mcp-annotations": {
          "readOnlyHint": true,
          "destructiveHint": false,
          "idempotentHint": true,
          "openWorldHint": true
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "default": 20,
                    "description": "Maximum number of results to return (1–100). Default: 20."
                  },
                  "cursor": {
                    "type": "string",
                    "description": "Opaque pagination cursor from a previous response."
                  },
                  "refresh": {
                    "type": "boolean",
                    "default": false,
                    "description": "Force a fresh fetch bypassing the cache."
                  },
                  "advertiser_id": {
                    "type": "string",
                    "minLength": 1,
                    "description": "TikTok advertiser ID."
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500,
                    "description": "Why this tool call is needed"
                  }
                },
                "required": [
                  "advertiser_id",
                  "reason"
                ],
                "additionalProperties": false,
                "$schema": "http://json-schema.org/draft-07/schema#"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Markdown-formatted result with structured content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpToolResult"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpError"
                }
              }
            }
          },
          "404": {
            "description": "Tool not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          },
          "422": {
            "description": "Invalid parameters — request body failed schema validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          }
        }
      }
    },
    "/tools/tiktok_ads_check_auth_status": {
      "post": {
        "operationId": "tiktok_ads_check_auth_status",
        "summary": "Check TikTok Ads Authentication Status",
        "description": "Check whether the user's TikTok Ads account is authenticated. Returns auth method and email. Use ONLY when the user asks about auth status or connectivity — to get advertiser accounts, use tiktok_ads_list_advertisers instead.",
        "tags": [
          "auth"
        ],
        "x-mcp-annotations": {
          "readOnlyHint": true,
          "destructiveHint": false,
          "idempotentHint": true,
          "openWorldHint": true
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500,
                    "description": "Why this tool call is needed"
                  }
                },
                "required": [
                  "reason"
                ],
                "additionalProperties": false,
                "$schema": "http://json-schema.org/draft-07/schema#"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Markdown-formatted result with structured content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpToolResult"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpError"
                }
              }
            }
          },
          "404": {
            "description": "Tool not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          },
          "422": {
            "description": "Invalid parameters — request body failed schema validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          }
        }
      }
    },
    "/tools/tiktok_ads_get_login_url": {
      "post": {
        "operationId": "tiktok_ads_get_login_url",
        "summary": "Get TikTok Ads Login URL",
        "description": "Get the URL to connect a TikTok Ads account via OAuth.",
        "tags": [
          "login-url"
        ],
        "x-mcp-annotations": {
          "readOnlyHint": true,
          "destructiveHint": false,
          "idempotentHint": true,
          "openWorldHint": false
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500,
                    "description": "Why this tool call is needed"
                  }
                },
                "required": [
                  "reason"
                ],
                "additionalProperties": false,
                "$schema": "http://json-schema.org/draft-07/schema#"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Markdown-formatted result with structured content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpToolResult"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpError"
                }
              }
            }
          },
          "404": {
            "description": "Tool not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          },
          "422": {
            "description": "Invalid parameters — request body failed schema validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          }
        }
      }
    },
    "/tools/tiktok_ads_get_user_info": {
      "post": {
        "operationId": "tiktok_ads_get_user_info",
        "summary": "Get TikTok Ads User Info",
        "description": "Get detailed profile information about the authenticated TikTok Ads user (email, display name, role). Use this for user profile details — for checking auth status or listing advertiser IDs, use tiktok_ads_check_auth_status instead.",
        "tags": [
          "user-info"
        ],
        "x-mcp-annotations": {
          "readOnlyHint": true,
          "destructiveHint": false,
          "idempotentHint": true,
          "openWorldHint": true
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500,
                    "description": "Why this tool call is needed"
                  }
                },
                "required": [
                  "reason"
                ],
                "additionalProperties": false,
                "$schema": "http://json-schema.org/draft-07/schema#"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Markdown-formatted result with structured content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpToolResult"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpError"
                }
              }
            }
          },
          "404": {
            "description": "Tool not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          },
          "422": {
            "description": "Invalid parameters — request body failed schema validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          }
        }
      }
    },
    "/tools/tiktok_ads_list_campaigns": {
      "post": {
        "operationId": "tiktok_ads_list_campaigns",
        "summary": "List TikTok Campaigns",
        "description": "List TikTok ad campaigns for an advertiser. Shows name, status, objective, and budget.",
        "tags": [
          "campaigns"
        ],
        "x-mcp-annotations": {
          "readOnlyHint": true,
          "destructiveHint": false,
          "idempotentHint": true,
          "openWorldHint": true
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "default": 20,
                    "description": "Maximum number of results to return (1–100). Default: 20."
                  },
                  "cursor": {
                    "type": "string",
                    "description": "Opaque pagination cursor from a previous response."
                  },
                  "refresh": {
                    "type": "boolean",
                    "default": false,
                    "description": "Force a fresh fetch bypassing the cache."
                  },
                  "advertiser_id": {
                    "type": "string",
                    "minLength": 1,
                    "description": "TikTok advertiser ID."
                  },
                  "campaign_id": {
                    "type": "string",
                    "description": "Fetch a single campaign by ID."
                  },
                  "campaign_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "minItems": 1,
                    "maxItems": 50,
                    "description": "Fetch specific campaigns by IDs."
                  },
                  "status": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "STATUS_ALL",
                        "STATUS_ON",
                        "STATUS_OFF",
                        "STATUS_BUDGET_EXCEED",
                        "STATUS_DONE",
                        "STATUS_DELETE"
                      ]
                    },
                    "description": "Filter by primary status."
                  },
                  "search": {
                    "type": "string",
                    "description": "Search campaigns by name (case-insensitive)."
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500,
                    "description": "Why this tool call is needed"
                  }
                },
                "required": [
                  "advertiser_id",
                  "reason"
                ],
                "additionalProperties": false,
                "$schema": "http://json-schema.org/draft-07/schema#"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Markdown-formatted result with structured content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpToolResult"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpError"
                }
              }
            }
          },
          "404": {
            "description": "Tool not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          },
          "422": {
            "description": "Invalid parameters — request body failed schema validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          }
        }
      }
    },
    "/tools/tiktok_ads_get_campaign": {
      "post": {
        "operationId": "tiktok_ads_get_campaign",
        "summary": "Get TikTok Campaign",
        "description": "Get details for a single TikTok campaign by ID.",
        "tags": [
          "campaign"
        ],
        "x-mcp-annotations": {
          "readOnlyHint": true,
          "destructiveHint": false,
          "idempotentHint": true,
          "openWorldHint": true
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "advertiser_id": {
                    "type": "string",
                    "minLength": 1,
                    "description": "TikTok advertiser ID."
                  },
                  "campaign_id": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Campaign ID."
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500,
                    "description": "Why this tool call is needed"
                  }
                },
                "required": [
                  "advertiser_id",
                  "campaign_id",
                  "reason"
                ],
                "additionalProperties": false,
                "$schema": "http://json-schema.org/draft-07/schema#"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Markdown-formatted result with structured content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpToolResult"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpError"
                }
              }
            }
          },
          "404": {
            "description": "Tool not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          },
          "422": {
            "description": "Invalid parameters — request body failed schema validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          }
        }
      }
    },
    "/tools/tiktok_ads_preview_ads": {
      "post": {
        "operationId": "tiktok_ads_preview_ads",
        "summary": "Preview TikTok Ads",
        "description": "Preview TikTok ad creatives with visual content (images/videos) and configurable metrics in an interactive UI.",
        "tags": [
          "ads"
        ],
        "x-mcp-annotations": {
          "readOnlyHint": true,
          "destructiveHint": false,
          "idempotentHint": true,
          "openWorldHint": false
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "advertiser_id": {
                    "type": "string",
                    "minLength": 1,
                    "description": "TikTok advertiser ID"
                  },
                  "ads": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "ad_id": {
                          "type": "string",
                          "minLength": 1,
                          "description": "The ad ID to preview"
                        },
                        "metrics": {
                          "type": "object",
                          "additionalProperties": {
                            "type": [
                              "string",
                              "number"
                            ]
                          },
                          "description": "Metric name-value pairs to display"
                        }
                      },
                      "required": [
                        "ad_id"
                      ],
                      "additionalProperties": false
                    },
                    "minItems": 1,
                    "maxItems": 20,
                    "description": "Ads to preview (1-20)"
                  },
                  "metric_labels": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string"
                    },
                    "description": "Display labels for metric keys"
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500,
                    "description": "Why this tool call is needed"
                  }
                },
                "required": [
                  "advertiser_id",
                  "ads",
                  "reason"
                ],
                "additionalProperties": false,
                "$schema": "http://json-schema.org/draft-07/schema#"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Markdown-formatted result with structured content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpToolResult"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpError"
                }
              }
            }
          },
          "404": {
            "description": "Tool not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          },
          "422": {
            "description": "Invalid parameters — request body failed schema validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          }
        },
        "x-mcp-tool-type": "app"
      }
    },
    "/tools/tiktok_ads_developer_feedback": {
      "post": {
        "operationId": "tiktok_ads_developer_feedback",
        "summary": "Submit Developer Feedback",
        "description": "Submit feedback about missing tools, improvements, bugs, or workflow gaps in the TikTok Ads MCP toolset. Not for user-facing issues like auth or API errors.",
        "tags": [
          "feedback"
        ],
        "x-mcp-annotations": {
          "readOnlyHint": false,
          "destructiveHint": false,
          "idempotentHint": true,
          "openWorldHint": true
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "feedback_type": {
                    "type": "string",
                    "enum": [
                      "new_tool",
                      "improvement",
                      "bug",
                      "workflow_gap"
                    ],
                    "description": "Feedback category: new_tool (request new capability), improvement (enhance existing tool), bug (report issue), workflow_gap (missing workflow)"
                  },
                  "title": {
                    "type": "string",
                    "minLength": 5,
                    "maxLength": 200,
                    "description": "Concise title summarizing the feedback"
                  },
                  "description": {
                    "type": "string",
                    "minLength": 20,
                    "maxLength": 2000,
                    "description": "What is needed and why"
                  },
                  "current_workaround": {
                    "type": "string",
                    "maxLength": 1000,
                    "description": "Current workaround, if any"
                  },
                  "priority": {
                    "type": "string",
                    "enum": [
                      "low",
                      "medium",
                      "high"
                    ],
                    "default": "medium",
                    "description": "Impact level: low (nice-to-have), medium (improves workflow), high (blocking issue)"
                  },
                  "interface": {
                    "type": "string",
                    "enum": [
                      "MCP",
                      "CLI"
                    ],
                    "default": "MCP",
                    "description": "Interface the feedback originated from: MCP (default) or CLI"
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500,
                    "description": "Why this tool call is needed"
                  }
                },
                "required": [
                  "feedback_type",
                  "title",
                  "description",
                  "reason"
                ],
                "additionalProperties": false,
                "$schema": "http://json-schema.org/draft-07/schema#"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Markdown-formatted result with structured content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpToolResult"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpError"
                }
              }
            }
          },
          "404": {
            "description": "Tool not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          },
          "422": {
            "description": "Invalid parameters — request body failed schema validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          }
        }
      }
    },
    "/tools/tiktok_ads_ping": {
      "post": {
        "operationId": "tiktok_ads_ping",
        "summary": "Ping TikTok Ads MCP Server",
        "description": "Health check for the TikTok Ads MCP server.",
        "tags": [
          "auth"
        ],
        "x-mcp-annotations": {
          "readOnlyHint": true,
          "destructiveHint": false,
          "idempotentHint": true,
          "openWorldHint": false
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "message": {
                    "type": "string",
                    "maxLength": 100,
                    "description": "Optional message to echo back"
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500,
                    "description": "Why this tool call is needed"
                  }
                },
                "required": [
                  "reason"
                ],
                "additionalProperties": false,
                "$schema": "http://json-schema.org/draft-07/schema#"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Markdown-formatted result with structured content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpToolResult"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpError"
                }
              }
            }
          },
          "404": {
            "description": "Tool not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          },
          "422": {
            "description": "Invalid parameters — request body failed schema validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          }
        }
      }
    },
    "/tools/tiktok_ads_store_preference": {
      "post": {
        "operationId": "tiktok_ads_store_preference",
        "summary": "Store TikTok Ads Preference",
        "description": "Store a persistent preference for a TikTok ad entity. Use when you infer a recurring preference about analysis, reporting, or management. Updates existing keys. Entity type \"ad_set\" maps to TikTok ad groups.",
        "tags": [
          "preferences"
        ],
        "x-mcp-annotations": {
          "readOnlyHint": false,
          "destructiveHint": false,
          "idempotentHint": true,
          "openWorldHint": false
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entity_type": {
                    "type": "string",
                    "enum": [
                      "ad_account",
                      "campaign",
                      "ad_set",
                      "ad"
                    ],
                    "description": "Type of ad entity: ad_account, campaign, ad_set (Meta ad sets / Google ad groups), or ad"
                  },
                  "entity_id": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The platform entity ID (e.g. act_123456, 23842453456789)"
                  },
                  "key": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "Preference key (e.g. preferred_conversion_metric, budget_alert_threshold)"
                  },
                  "value": {
                    "description": "Preference value — string, number, boolean, or JSON object"
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "agent",
                      "user",
                      "system"
                    ],
                    "default": "agent",
                    "description": "Who set this preference: agent (default), user, or system"
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 500,
                    "description": "Optional context about why this preference was set"
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500,
                    "description": "Why this tool call is needed"
                  }
                },
                "required": [
                  "entity_type",
                  "entity_id",
                  "key",
                  "reason"
                ],
                "additionalProperties": false,
                "$schema": "http://json-schema.org/draft-07/schema#"
              },
              "examples": {
                "set-metric": {
                  "summary": "Set metric",
                  "value": {
                    "entity_type": "ad_account",
                    "entity_id": "7012345678901234567",
                    "key": "preferred_conversion_metric",
                    "value": "complete_payment",
                    "reason": "User wants payment completions as default metric"
                  }
                },
                "set-threshold": {
                  "summary": "Set threshold",
                  "value": {
                    "entity_type": "campaign",
                    "entity_id": "1234567890123",
                    "key": "budget_alert_threshold",
                    "value": 0.8,
                    "reason": "Alert at 80% budget"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Markdown-formatted result with structured content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpToolResult"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpError"
                }
              }
            }
          },
          "404": {
            "description": "Tool not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          },
          "422": {
            "description": "Invalid parameters — request body failed schema validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          }
        }
      }
    },
    "/tools/tiktok_ads_get_preferences": {
      "post": {
        "operationId": "tiktok_ads_get_preferences",
        "summary": "Get TikTok Ads Preferences",
        "description": "Get all stored preferences for a TikTok ad entity. Preferences are also automatically attached to entity-listing responses as _stored_preferences, so you often don't need to call this explicitly.",
        "tags": [
          "preferences"
        ],
        "x-mcp-annotations": {
          "readOnlyHint": true,
          "destructiveHint": false,
          "idempotentHint": true,
          "openWorldHint": false
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entity_type": {
                    "type": "string",
                    "enum": [
                      "ad_account",
                      "campaign",
                      "ad_set",
                      "ad"
                    ],
                    "description": "Type of ad entity: ad_account, campaign, ad_set, or ad"
                  },
                  "entity_id": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The platform entity ID"
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500,
                    "description": "Why this tool call is needed"
                  }
                },
                "required": [
                  "entity_type",
                  "entity_id",
                  "reason"
                ],
                "additionalProperties": false,
                "$schema": "http://json-schema.org/draft-07/schema#"
              },
              "examples": {
                "get-prefs": {
                  "summary": "Get prefs",
                  "value": {
                    "entity_type": "ad_account",
                    "entity_id": "7012345678901234567",
                    "reason": "Check stored preferences"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Markdown-formatted result with structured content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpToolResult"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpError"
                }
              }
            }
          },
          "404": {
            "description": "Tool not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          },
          "422": {
            "description": "Invalid parameters — request body failed schema validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          }
        }
      }
    },
    "/tools/tiktok_ads_delete_preference": {
      "post": {
        "operationId": "tiktok_ads_delete_preference",
        "summary": "Delete TikTok Ads Preference",
        "description": "Delete a stored preference for a TikTok ad entity by key. No-op if the preference doesn't exist.",
        "tags": [
          "preferences"
        ],
        "x-mcp-annotations": {
          "readOnlyHint": false,
          "destructiveHint": true,
          "idempotentHint": true,
          "openWorldHint": false
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entity_type": {
                    "type": "string",
                    "enum": [
                      "ad_account",
                      "campaign",
                      "ad_set",
                      "ad"
                    ],
                    "description": "Type of ad entity: ad_account, campaign, ad_set, or ad"
                  },
                  "entity_id": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The platform entity ID"
                  },
                  "key": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The preference key to delete"
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500,
                    "description": "Why this tool call is needed"
                  }
                },
                "required": [
                  "entity_type",
                  "entity_id",
                  "key",
                  "reason"
                ],
                "additionalProperties": false,
                "$schema": "http://json-schema.org/draft-07/schema#"
              },
              "examples": {
                "delete-pref": {
                  "summary": "Delete pref",
                  "value": {
                    "entity_type": "campaign",
                    "entity_id": "1234567890123",
                    "key": "budget_alert_threshold",
                    "reason": "User no longer wants budget alerts"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Markdown-formatted result with structured content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpToolResult"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpError"
                }
              }
            }
          },
          "404": {
            "description": "Tool not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          },
          "422": {
            "description": "Invalid parameters — request body failed schema validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          }
        }
      }
    },
    "/tools/tiktok_ads_get_performance_report": {
      "post": {
        "operationId": "tiktok_ads_get_performance_report",
        "summary": "Get TikTok Ads Performance Report",
        "description": "Get a performance report for a TikTok advertiser. Returns spend, impressions, clicks, CPC, CPM, CTR, reach, frequency, conversions, cost_per_conversion, conversion_rate, result, and cost_per_result — broken down by day. Supports entity filters: pass campaign_id to get only ads/ad groups within a specific campaign, or adgroup_id to narrow to a specific ad group. This is the primary tool for standard delivery and conversion performance — use get_insights only for audience demographic breakdowns (age, gender, country).",
        "tags": [
          "reporting"
        ],
        "x-mcp-annotations": {
          "readOnlyHint": true,
          "destructiveHint": false,
          "idempotentHint": true,
          "openWorldHint": true
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "advertiser_id": {
                    "type": "string",
                    "minLength": 1,
                    "description": "TikTok advertiser ID."
                  },
                  "level": {
                    "type": "string",
                    "enum": [
                      "campaign",
                      "adgroup",
                      "ad"
                    ],
                    "description": "Reporting level — mapped to data_level internally."
                  },
                  "date_preset": {
                    "type": "string",
                    "enum": [
                      "last_7d",
                      "last_14d",
                      "last_30d"
                    ],
                    "description": "Shortcut date range. Overridden by explicit start_date/end_date."
                  },
                  "start_date": {
                    "type": "string",
                    "description": "Start date in YYYY-MM-DD format."
                  },
                  "end_date": {
                    "type": "string",
                    "description": "End date in YYYY-MM-DD format."
                  },
                  "campaign_id": {
                    "type": "string",
                    "description": "Filter results to a specific campaign by its ID. When the user asks about a specific campaign, always pass this parameter to scope the report."
                  },
                  "adgroup_id": {
                    "type": "string",
                    "description": "Filter to a specific ad group."
                  },
                  "page": {
                    "type": "integer",
                    "minimum": 1,
                    "default": 1,
                    "description": "Page number (1-indexed). Default: 1."
                  },
                  "page_size": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000,
                    "default": 20,
                    "description": "Results per page. Default: 20."
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500,
                    "description": "Why this tool call is needed"
                  }
                },
                "required": [
                  "advertiser_id",
                  "level",
                  "reason"
                ],
                "additionalProperties": false,
                "$schema": "http://json-schema.org/draft-07/schema#"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON report data",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpToolResult"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpError"
                }
              }
            }
          },
          "404": {
            "description": "Tool not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          },
          "422": {
            "description": "Invalid parameters — request body failed schema validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          }
        }
      }
    },
    "/tools/tiktok_ads_get_insights": {
      "post": {
        "operationId": "tiktok_ads_get_insights",
        "summary": "Get TikTok Ads Insights",
        "description": "Get audience demographic breakdowns and custom dimension analysis for TikTok ads (age, gender, country, placement). Use this only when you need demographic or placement-level segmentation. For standard performance metrics (spend, clicks, conversions, CPC, CPM, CTR, cost_per_conversion, conversion_rate), use tiktok_ads_get_performance_report instead — it already includes all conversion metrics. For video/creative metrics, use tiktok_ads_get_creative_report.",
        "tags": [
          "insights"
        ],
        "x-mcp-annotations": {
          "readOnlyHint": true,
          "destructiveHint": false,
          "idempotentHint": true,
          "openWorldHint": true
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "advertiser_id": {
                    "type": "string",
                    "minLength": 1,
                    "description": "TikTok advertiser ID."
                  },
                  "report_type": {
                    "type": "string",
                    "enum": [
                      "BASIC",
                      "AUDIENCE"
                    ],
                    "default": "BASIC",
                    "description": "Type of report. AUDIENCE for demographic breakdowns (age, gender, country). Default: BASIC."
                  },
                  "data_level": {
                    "type": "string",
                    "enum": [
                      "AUCTION_ADVERTISER",
                      "AUCTION_CAMPAIGN",
                      "AUCTION_ADGROUP",
                      "AUCTION_AD"
                    ],
                    "description": "Granularity level for the report."
                  },
                  "dimensions": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "minItems": 1,
                    "description": "Grouping dimensions, e.g. [\"campaign_id\", \"stat_time_day\"]."
                  },
                  "metrics": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Metrics to retrieve. Defaults to standard funnel metrics if omitted."
                  },
                  "start_date": {
                    "type": "string",
                    "description": "Start date in YYYY-MM-DD format."
                  },
                  "end_date": {
                    "type": "string",
                    "description": "End date in YYYY-MM-DD format."
                  },
                  "lifetime": {
                    "type": "boolean",
                    "description": "If true, return lifetime metrics instead of date-ranged."
                  },
                  "page": {
                    "type": "integer",
                    "minimum": 1,
                    "default": 1,
                    "description": "Page number (1-indexed). Default: 1."
                  },
                  "page_size": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000,
                    "default": 20,
                    "description": "Results per page. Default: 20."
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500,
                    "description": "Why this tool call is needed"
                  }
                },
                "required": [
                  "advertiser_id",
                  "data_level",
                  "dimensions",
                  "reason"
                ],
                "additionalProperties": false,
                "$schema": "http://json-schema.org/draft-07/schema#"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON report data",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpToolResult"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpError"
                }
              }
            }
          },
          "404": {
            "description": "Tool not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          },
          "422": {
            "description": "Invalid parameters — request body failed schema validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          }
        }
      }
    },
    "/tools/tiktok_ads_get_creative_report": {
      "post": {
        "operationId": "tiktok_ads_get_creative_report",
        "summary": "Get TikTok Ads Creative Report",
        "description": "Get video creative performance metrics for TikTok ads — video views, watch time, completion rates (p25/p50/p75/p100), engagement, and per-creative breakdowns. Supports filtering by campaign_id or adgroup_id to narrow results. Use this tool for video-specific metrics and creative-level analysis.",
        "tags": [
          "creative-report"
        ],
        "x-mcp-annotations": {
          "readOnlyHint": true,
          "destructiveHint": false,
          "idempotentHint": true,
          "openWorldHint": true
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "advertiser_id": {
                    "type": "string",
                    "minLength": 1,
                    "description": "TikTok advertiser ID."
                  },
                  "campaign_id": {
                    "type": "string",
                    "description": "Filter to a specific campaign."
                  },
                  "adgroup_id": {
                    "type": "string",
                    "description": "Filter to a specific ad group."
                  },
                  "start_date": {
                    "type": "string",
                    "description": "Start date in YYYY-MM-DD format."
                  },
                  "end_date": {
                    "type": "string",
                    "description": "End date in YYYY-MM-DD format."
                  },
                  "page": {
                    "type": "integer",
                    "minimum": 1,
                    "default": 1,
                    "description": "Page number (1-indexed). Default: 1."
                  },
                  "page_size": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000,
                    "default": 20,
                    "description": "Results per page. Default: 20."
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500,
                    "description": "Why this tool call is needed"
                  }
                },
                "required": [
                  "advertiser_id",
                  "reason"
                ],
                "additionalProperties": false,
                "$schema": "http://json-schema.org/draft-07/schema#"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Markdown-formatted result with structured content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpToolResult"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpError"
                }
              }
            }
          },
          "404": {
            "description": "Tool not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          },
          "422": {
            "description": "Invalid parameters — request body failed schema validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          }
        }
      }
    },
    "/tools/tiktok_ads_get_smart_plus_report": {
      "post": {
        "operationId": "tiktok_ads_get_smart_plus_report",
        "summary": "Get TikTok Smart+ Creative Material Report",
        "description": "Get Smart+ creative material performance breakdown. Use this when analyzing Smart+ campaign creative variants — breaks down performance by creative material (video/image), text, and enhancement (CTA) combinations. Required for accurate Smart+ reporting, as the standard reporting tools only show parent ad-level data.",
        "tags": [
          "smart-plus-report"
        ],
        "x-mcp-annotations": {
          "readOnlyHint": true,
          "destructiveHint": false,
          "idempotentHint": true,
          "openWorldHint": true
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "advertiser_id": {
                    "type": "string",
                    "minLength": 1,
                    "description": "TikTok advertiser account ID."
                  },
                  "dimensions": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "minItems": 1,
                    "description": "Creative dimensions to break down by. Examples: material/creative type, text, enhancement/CTA."
                  },
                  "start_date": {
                    "type": "string",
                    "description": "Start date in YYYY-MM-DD format."
                  },
                  "end_date": {
                    "type": "string",
                    "description": "End date in YYYY-MM-DD format."
                  },
                  "metrics": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Metrics to retrieve. Defaults to spend, impressions, clicks, conversions, and cost metrics."
                  },
                  "campaign_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Filter by campaign IDs."
                  },
                  "adgroup_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Filter by ad group IDs."
                  },
                  "smart_plus_ad_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Filter by Smart+ ad IDs."
                  },
                  "main_material_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Filter by material (video/image) IDs."
                  },
                  "main_material_types": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Filter by material types."
                  },
                  "sort_field": {
                    "type": "string",
                    "default": "spend",
                    "description": "Sort by field. Default: spend."
                  },
                  "sort_type": {
                    "type": "string",
                    "enum": [
                      "ASC",
                      "DESC"
                    ],
                    "default": "DESC",
                    "description": "Sort direction. Default: DESC."
                  },
                  "page": {
                    "type": "integer",
                    "minimum": 1,
                    "default": 1,
                    "description": "Page number (1-indexed). Default: 1."
                  },
                  "page_size": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000,
                    "default": 20,
                    "description": "Results per page. Default: 20."
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500,
                    "description": "Why this tool call is needed"
                  }
                },
                "required": [
                  "advertiser_id",
                  "dimensions",
                  "start_date",
                  "end_date",
                  "reason"
                ],
                "additionalProperties": false,
                "$schema": "http://json-schema.org/draft-07/schema#"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Markdown-formatted result with structured content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpToolResult"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpError"
                }
              }
            }
          },
          "404": {
            "description": "Tool not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          },
          "422": {
            "description": "Invalid parameters — request body failed schema validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          }
        }
      }
    },
    "/tools/tiktok_ads_get_smart_plus_overview": {
      "post": {
        "operationId": "tiktok_ads_get_smart_plus_overview",
        "summary": "Get TikTok Smart+ Creative Material Overview",
        "description": "Get Smart+ creative material overview. Returns aggregate performance summaries for Smart+ creative materials with optional lifetime queries. Use alongside tiktok_ads_get_smart_plus_report for full Smart+ creative analysis.",
        "tags": [
          "smart-plus-overview"
        ],
        "x-mcp-annotations": {
          "readOnlyHint": true,
          "destructiveHint": false,
          "idempotentHint": true,
          "openWorldHint": true
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "advertiser_id": {
                    "type": "string",
                    "minLength": 1,
                    "description": "TikTok advertiser account ID."
                  },
                  "dimensions": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "minItems": 1,
                    "description": "Creative dimensions to group by."
                  },
                  "start_date": {
                    "type": "string",
                    "description": "Start date in YYYY-MM-DD format."
                  },
                  "end_date": {
                    "type": "string",
                    "description": "End date in YYYY-MM-DD format."
                  },
                  "query_lifetime": {
                    "type": "boolean",
                    "description": "If true, return lifetime metrics instead of date-ranged."
                  },
                  "metrics": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Metrics to retrieve."
                  },
                  "campaign_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Filter by campaign IDs."
                  },
                  "adgroup_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Filter by ad group IDs."
                  },
                  "smart_plus_ad_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Filter by Smart+ ad IDs."
                  },
                  "sort_field": {
                    "type": "string",
                    "default": "spend",
                    "description": "Sort by field. Default: spend."
                  },
                  "sort_type": {
                    "type": "string",
                    "enum": [
                      "ASC",
                      "DESC"
                    ],
                    "default": "DESC",
                    "description": "Sort direction. Default: DESC."
                  },
                  "page": {
                    "type": "integer",
                    "minimum": 1,
                    "default": 1,
                    "description": "Page number (1-indexed). Default: 1."
                  },
                  "page_size": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000,
                    "default": 20,
                    "description": "Results per page. Default: 20."
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500,
                    "description": "Why this tool call is needed"
                  }
                },
                "required": [
                  "advertiser_id",
                  "dimensions",
                  "reason"
                ],
                "additionalProperties": false,
                "$schema": "http://json-schema.org/draft-07/schema#"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Markdown-formatted result with structured content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpToolResult"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpError"
                }
              }
            }
          },
          "404": {
            "description": "Tool not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          },
          "422": {
            "description": "Invalid parameters — request body failed schema validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Supabase JWT or hpk_live_... API key"
      }
    },
    "schemas": {
      "McpToolResult": {
        "type": "object",
        "properties": {
          "content": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "text",
                    "resource_link"
                  ]
                },
                "text": {
                  "type": "string"
                }
              }
            }
          },
          "structuredContent": {
            "type": "object",
            "additionalProperties": true
          },
          "isError": {
            "type": "boolean"
          }
        }
      },
      "McpError": {
        "type": "object",
        "properties": {
          "isError": {
            "type": "boolean",
            "const": true
          },
          "content": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "const": "text"
                },
                "text": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "RestError": {
        "type": "object",
        "description": "Error response from REST tool endpoints (mapped from JSON-RPC error codes)",
        "properties": {
          "error": {
            "type": "string",
            "description": "Human-readable error message"
          },
          "code": {
            "type": "integer",
            "description": "JSON-RPC error code"
          },
          "data": {
            "description": "Additional error context"
          }
        },
        "required": [
          "error",
          "code"
        ]
      },
      "ToolList": {
        "type": "object",
        "properties": {
          "tools": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "inputSchema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    }
  },
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "discovery",
      "description": "Tool discovery and introspection"
    },
    {
      "name": "ad",
      "description": "Ad tools"
    },
    {
      "name": "ad-group",
      "description": "Ad-group tools"
    },
    {
      "name": "ad-groups",
      "description": "Ad-groups tools"
    },
    {
      "name": "ads",
      "description": "Ads tools"
    },
    {
      "name": "advertiser",
      "description": "Advertiser tools"
    },
    {
      "name": "advertisers",
      "description": "Advertisers tools"
    },
    {
      "name": "audiences",
      "description": "Audiences tools"
    },
    {
      "name": "auth",
      "description": "Auth tools"
    },
    {
      "name": "campaign",
      "description": "Campaign tools"
    },
    {
      "name": "campaigns",
      "description": "Campaigns tools"
    },
    {
      "name": "creative-report",
      "description": "Creative-report tools"
    },
    {
      "name": "feedback",
      "description": "Feedback tools"
    },
    {
      "name": "insights",
      "description": "Insights tools"
    },
    {
      "name": "login-url",
      "description": "Login-url tools"
    },
    {
      "name": "preferences",
      "description": "Preferences tools"
    },
    {
      "name": "reporting",
      "description": "Reporting tools"
    },
    {
      "name": "smart-plus-overview",
      "description": "Smart-plus-overview tools"
    },
    {
      "name": "smart-plus-report",
      "description": "Smart-plus-report tools"
    },
    {
      "name": "user-info",
      "description": "User-info tools"
    }
  ]
}