Skip to main content
Glama

openapi_v2_keyword_trend

Get keyword trend

  1. Function

Return raw weekly time-series data for one or more keywords between dateFrom and dateTo, not precomputed trend conclusions. Both single and batch requests return data.context + data.items[].series[]. The date range cannot exceed 93 days; split longer history into multiple requests.

  1. Use cases

Use trend to plot weekly search demand and ranking history or inspect when changes occurred. Use trend-profile for precomputed direction, volatility and supporting evidence over fixed windows selected by date + windowPeriods.

Responses:

200: Successful Response (Success Response) Content-Type: application/json

Example Response:

{
  "success": true,
  "meta": {
    "requestId": "Requestid",
    "timestamp": "Timestamp"
  }
}

Output Schema:

{
  "properties": {
    "success": {
      "type": "boolean",
      "title": "Success",
      "description": "Whether the request was successful",
      "default": true
    },
    "data": {
      "description": "Response data payload"
    },
    "error": {
      "description": "Error details if request failed"
    },
    "meta": {
      "description": "Metadata for API responses.\n\nCredit fields follow the ADR-0003 parallel-fields strategy (Option 3):\n- `credits_remaining` / `credits_consumed` (int): legacy fields, rounded\n  to whole credits, kept for zero-breaking-change to existing SDK clients.\n- `credits_remaining_exact` / `credits_consumed_exact` (float): new\n  precision-aware fields for clients that opt in to decimal credits.\n\nSee ADR-0003 decision 5 and the \u00a78 deprecation timeline.\n\nTODO(2026-11, ADR-0003 \u00a78 +6mo): mark `credits_remaining` /\n`credits_consumed` as `deprecated=True` in their Field() definitions\nand announce in customer changelog.\nTODO(2027-05, ADR-0003 \u00a78 +12mo): remove the legacy int fields via a\nmajor-version bump of the OpenAPI surface.",
      "properties": {
        "requestId": {
          "type": "string",
          "title": "Requestid",
          "description": "Unique request identifier"
        },
        "timestamp": {
          "type": "string",
          "title": "Timestamp",
          "description": "Response timestamp in ISO 8601 format"
        },
        "total": {
          "title": "Total",
          "description": "Total number of records"
        },
        "page": {
          "title": "Page",
          "description": "Current page number"
        },
        "pageSize": {
          "title": "Pagesize",
          "description": "Number of records per page"
        },
        "totalPages": {
          "title": "Totalpages",
          "description": "Total number of pages"
        },
        "creditsRemaining": {
          "title": "Creditsremaining",
          "description": "Remaining API credits (rounded to whole credits; see creditsRemainingExact for precise value)"
        },
        "creditsConsumed": {
          "title": "Creditsconsumed",
          "description": "Credits consumed by this request (rounded; see creditsConsumedExact for precise value)"
        },
        "creditsRemainingExact": {
          "title": "Creditsremainingexact",
          "description": "Remaining API credits, precise to 1 decimal place"
        },
        "creditsConsumedExact": {
          "title": "Creditsconsumedexact",
          "description": "Credits consumed by this request, precise to 1 decimal place"
        },
        "tokensUsage": {
          "description": "Provider token-usage block \u2014 populated on terminal video polls only, null on every non-video endpoint. See TokensUsage for its fields."
        }
      },
      "type": "object",
      "required": [
        "requestId",
        "timestamp"
      ],
      "title": "ResponseMeta"
    }
  },
  "type": "object",
  "required": [
    "meta"
  ],
  "title": "OpenApiResponse[KeywordTrendData]",
  "examples": []
}

422: Validation Error Content-Type: application/json

Example Response:

{
  "detail": [
    {
      "loc": [],
      "msg": "Message",
      "type": "Error Type",
      "ctx": {}
    }
  ]
}

Output Schema:

{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {},
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          },
          "input": {
            "title": "Input"
          },
          "ctx": {
            "type": "object",
            "title": "Context"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateToYesTrend end date (YYYY-MM-DD); on or after `dateFrom`, with a maximum 93-day range. Actual range is `resolvedDateFrom` through `resolvedDateTo`.
keywordNoSingle keyword to look up; mutually exclusive with `keywords`. Surrounding whitespace is trimmed; letter case is accepted.
dateFromYesTrend start date (YYYY-MM-DD).
keywordsNoKeywords to look up in batch, up to 20; mutually exclusive with `keyword`. Must equal `LOWER(TRIM(value))`; uppercase letters and surrounding whitespace are rejected. Duplicate keywords are rejected.
granularityNoData period granularity. Only `week` is currently supported.week
marketplaceNoAmazon marketplace code. Only 'US' is currently supported.US

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed18 schema fields changed
    • addedInput schema / oneOf
      Added value: +[
      +  {
      +    "required": [
      +      "keyword"
      +    ]
      +  },
      +  {
      +    "required": [
      +      "keywords"
      +    ]
      +  }
      +]
    • changedInput schema / properties / dateFrom / description
      Previous value: -"Trend start date in YYYY-MM-DD format. The response contains weekly snapshots within the requested date range."New value: +"Trend start date (YYYY-MM-DD)."
    • addedInput schema / properties / dateFrom / format
      Added value: +"date"
    • addedInput schema / properties / dateFrom / pattern
      Added value: +"^\\d{4}-(0[1-9]|1[0-2])-([0-2]\\d|3[01])$"
    • changedInput schema / properties / dateTo / description
      Previous value: -"Trend end date in YYYY-MM-DD format. The response contains weekly snapshots within the requested date range."New value: +"Trend end date (YYYY-MM-DD); on or after `dateFrom`, with a maximum 93-day range. Actual range is `resolvedDateFrom` through `resolvedDateTo`."
    • addedInput schema / properties / dateTo / format
      Added value: +"date"
    • addedInput schema / properties / dateTo / pattern
      Added value: +"^\\d{4}-(0[1-9]|1[0-2])-([0-2]\\d|3[01])$"
    • addedInput schema / properties / granularity
      Added value: +{
      +  "const": "week",
      +  "default": "week",
      +  "description": "Data period granularity. Only `week` is currently supported.",
      +  "title": "granularity",
      +  "type": "string"
      +}
    • removedInput schema / properties / keyword / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  }
      -]
    • changedInput schema / properties / keyword / description
      Previous value: -"Keyword to look up."New value: +"Single keyword to look up; mutually exclusive with `keywords`. Surrounding whitespace is trimmed; letter case is accepted."
    • addedInput schema / properties / keyword / minLength
      Added value: +1
    • addedInput schema / properties / keyword / pattern
      Added value: +"\\S"
    • removedInput schema / properties / keywords / anyOf
      Removed value: -[
      -  {
      -    "items": {
      -      "type": "string"
      -    },
      -    "maxItems": 20,
      -    "minItems": 1,
      -    "type": "array"
      -  }
      -]
    • changedInput schema / properties / keywords / description
      Previous value: -"Keywords to look up in batch, up to 20."New value: +"Keywords to look up in batch, up to 20; mutually exclusive with `keyword`. Must equal `LOWER(TRIM(value))`; uppercase letters and surrounding whitespace are rejected. Duplicate keywords are rejected."
    • addedInput schema / properties / keywords / items
      Added value: +{
      +  "minLength": 1,
      +  "pattern": "^[^A-Z\\s](?:[^A-Z]*[^A-Z\\s])?$",
      +  "type": "string"
      +}
    • addedInput schema / properties / keywords / maxItems
      Added value: +20
    • addedInput schema / properties / keywords / minItems
      Added value: +1
    • addedInput schema / properties / keywords / uniqueItems
      Added value: +true
  2. Changed1 schema field changed
    • removedInput schema / properties / granularity
      Removed value: -{
      -  "const": "week",
      -  "default": "week",
      -  "description": "Time granularity. Keyword trend currently supports `week` only.",
      -  "title": "granularity",
      -  "type": "string"
      -}
  3. Changed3 schema fields changed
    • addedInput schema / properties / marketplace / const
      Added value: +"US"
    • changedInput schema / properties / marketplace / description
      Previous value: -"Amazon marketplace code"New value: +"Amazon marketplace code. Only 'US' is currently supported."
    • removedInput schema / properties / marketplace / enum
      Removed value: -[
      -  "US",
      -  "UK"
      -]
  4. Changed2 schema fields changed
    • changedInput schema / properties / dateFrom / description
      Previous value: -"Trend start date in YYYY-MM-DD format. Data is aggregated at weekly granularity, and the response returns snapshot data within the requested date range."New value: +"Trend start date in YYYY-MM-DD format. The response contains weekly snapshots within the requested date range."
    • changedInput schema / properties / dateTo / description
      Previous value: -"Trend end date in YYYY-MM-DD format. Data is aggregated at weekly granularity, and the response returns snapshot data within the requested date range."New value: +"Trend end date in YYYY-MM-DD format. The response contains weekly snapshots within the requested date range."
  5. Changed4 schema fields changed
    • addedInput schema / properties / granularity
      Added value: +{
      +  "const": "week",
      +  "default": "week",
      +  "description": "Time granularity. Keyword trend currently supports `week` only.",
      +  "title": "granularity",
      +  "type": "string"
      +}
    • addedInput schema / properties / keyword / anyOf
      Added value: +[
      +  {
      +    "type": "string"
      +  }
      +]
    • addedInput schema / properties / keywords
      Added value: +{
      +  "anyOf": [
      +    {
      +      "items": {
      +        "type": "string"
      +      },
      +      "maxItems": 20,
      +      "minItems": 1,
      +      "type": "array"
      +    }
      +  ],
      +  "description": "Keywords to look up in batch, up to 20.",
      +  "title": "keywords",
      +  "type": "array"
      +}
    • changedInput schema / required
      Previous value: -[
      -  "keyword",
      -  "dateFrom",
      -  "dateTo"
      -]New value: +[
      +  "dateFrom",
      +  "dateTo"
      +]
  6. Changed4 schema fields changed
    • changedInput schema / properties / dateFrom / description
      Previous value: -"趋势起始日期,格式 YYYY-MM-DD。数据按周粒度统计,返回该起止区间内的快照数据。"New value: +"Trend start date in YYYY-MM-DD format. Data is aggregated at weekly granularity, and the response returns snapshot data within the requested date range."
    • changedInput schema / properties / dateTo / description
      Previous value: -"趋势结束日期,格式 YYYY-MM-DD。数据按周粒度统计,返回该起止区间内的快照数据。"New value: +"Trend end date in YYYY-MM-DD format. Data is aggregated at weekly granularity, and the response returns snapshot data within the requested date range."
    • changedInput schema / properties / keyword / description
      Previous value: -"要查询趋势的关键词"New value: +"Keyword to look up."
    • changedInput schema / properties / marketplace / description
      Previous value: -"亚马逊站点代码"New value: +"Amazon marketplace code"
  7. Added

TDQS

A3.9/5.0
Behavior3/5

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

With no annotations provided, the description must carry the burden of behavior disclosure. It does mention the data return format (data.context + data.items[].series[]), the 93-day range limit, and that batch and single requests return the same structure. However, it does not explicitly state whether the operation is read-only (destructive hint absent), authentication requirements, or any rate limits. Given the tool is likely a read operation, some behavioral context is missing but the description is not misleading.

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

Conciseness4/5

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

The description is well-structured with numbered sections ('1. Function', '2. Use cases') that front-load the core purpose and key constraint. It is concise, with no redundant filler, and the sibling comparison is included in the use cases. The inclusion of full response schemas in the description is necessary for completeness but is external to the description text itself. Minor redundancy exists with the schema (e.g., 93-day limit repeated), but overall it is efficient.

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

Completeness4/5

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

Given the input schema is detailed and complete (100% coverage, clear constraints), and the output schema is provided in the description, the description covers what the tool does, when to use it, the data shape, and the key limitation (93-day range). It lacks explicit mention of pagination (though output schema includes page/pageSize), but this is covered by the output schema. The description is complete enough for an agent to call the tool correctly without additional context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema thoroughly documents each parameter: dateFrom/dateTo formats and constraints, keyword vs keywords mutual exclusivity, max items, case sensitivity, and granularity/marketplace consts. The description adds minimal value beyond mentioning the 93-day limit (already in schema) and the data return shape. Baseline 3 is appropriate because the schema is doing the heavy lifting.

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

Purpose5/5

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

The description clearly states the tool returns raw weekly time-series data for keywords over a date range, with 'not precomputed trend conclusions' explicitly distinguishing it from trend-profile. It explicitly names the sibling tool trend-profile for precomputed conclusions, making it easy for an agent to choose the correct tool.

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

Usage Guidelines4/5

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

The description explains when to use this tool (plotting weekly search demand/ranking history, inspecting changes) and when to use trend-profile instead (precomputed direction/volatility over fixed windows). It does not explicitly mention exclusions for other siblings like keyword_detail or keyword_search_results, but the use-case guidance is clear and actionable for the most relevant alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources