Skip to main content

Search Promo Text (Messaging)

messagingmcp-search_promo_text

Relevance-scored text search across promo description / conditions / categories / codes.

The searched text is plain English (extraction translates all source languages), and the corpus targets quantified-discount promotions — free shipping, loyalty perks, and single-product sales are excluded by policy, so searching for them is unreliable (compound offers like "20% off plus free shipping" do match; a few stray pure records exist); see explain_promo_data. Returns one entry per distinct promotion (highest-scoring row per promo), each with the list_promos field set plus active_window, any_inferred, and a raw BM25 score (ordering only — not a probability). total_matched and coverage mirror list_promos.

Double-quote a span to match it as an exact phrase ("40% off"); quotes can be mixed with loose terms and repeated, but everything is OR-combined — a hit needs only one of the phrases/terms, so a mixed query does NOT require the phrase. To require a phrase, send it alone. Phrasing matches adjacent words, not literal punctuation. categories is a keyword field — it only matches a whole value exactly, not individual words.

Parameters​

NameTypeRequiredConstraintsDescription
querystringyes—Keyword or short phrase to match across promo text. Lean, specific terms work best — the corpus is already filtered to promos so generic words match everything. Wrap a span in double quotes to match it as an exact phrase, e.g. "40% off" — quotes can be mixed with loose terms and repeated, e.g. "buy one get one" student. Phrasing matches adjacent words, not literal punctuation (a % is not indexed).
fieldsstring[]no—Which text fields to search. Subset of ['description', 'conditions', 'categories', 'codes']. Omit for all four (description and codes boosted).
retailersstring[]no—Retailer slugs to filter by, e.g. ['zara', 'h-m']. Omit for all; matches any listed retailer. Slugs match exactly and are case-sensitive, so take them from list_retailers: match the request against retailer_name, then pass that row's retailer slug and one of the regions it reports.
regionsstring[]no—Regions to filter by, e.g. ['UK', 'US']. Omit for all; matches any listed region. Exact match, so use the values list_retailers reports for the retailer.
start_datestringno—Start of the active-date window (inclusive, YYYY-MM-DD).
end_datestringno—End of the active-date window (inclusive, YYYY-MM-DD).
include_inferredbooleannodefault: trueInclude inferred promotions (default True). False = observed only.
limitintegernodefault: 10 · 1–20Max distinct promotions.

Returns​

  • On success: {"result": {"total_matched", "coverage", "returned",
  • "promos": [...], "filter_echo"}}.
  • On failure: {"error": {code, message}}
  • code is invalid_input, upstream_unavailable, or
  • not_entitled (authorization refused).

Try it​

Loading interactive widget…

Code examples​

curl -s https://mcp.edited.com/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "MCP-Protocol-Version: 2025-06-18" \
-H "x-api-key: $MCP_API_KEY" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "messagingmcp-search_promo_text",
"arguments": {
"query": "Nike",
"start_date": "example",
"end_date": "example",
"include_inferred": true,
"limit": 10
}
}
}'

Input schema​

{
"type": "object",
"properties": {
"query": {
"description": "Keyword or short phrase to match across promo text. Lean, specific terms work best — the corpus is already filtered to promos so generic words match everything. Wrap a span in double quotes to match it as an exact phrase, e.g. \"40% off\" — quotes can be mixed with loose terms and repeated, e.g. \"buy one get one\" student. Phrasing matches adjacent words, not literal punctuation (a `%` is not indexed).",
"type": "string"
},
"fields": {
"description": "Which text fields to search. Subset of ['description', 'conditions', 'categories', 'codes']. Omit for all four (description and codes boosted).",
"items": {
"type": "string"
},
"type": "array"
},
"retailers": {
"description": "Retailer slugs to filter by, e.g. ['zara', 'h-m']. Omit for all; matches any listed retailer. Slugs match exactly and are case-sensitive, so take them from `list_retailers`: match the request against `retailer_name`, then pass that row's `retailer` slug and one of the regions it reports.",
"items": {
"type": "string"
},
"type": "array"
},
"regions": {
"description": "Regions to filter by, e.g. ['UK', 'US']. Omit for all; matches any listed region. Exact match, so use the values `list_retailers` reports for the retailer.",
"items": {
"type": "string"
},
"type": "array"
},
"start_date": {
"description": "Start of the active-date window (inclusive, YYYY-MM-DD).",
"format": "date",
"type": "string"
},
"end_date": {
"description": "End of the active-date window (inclusive, YYYY-MM-DD).",
"format": "date",
"type": "string"
},
"include_inferred": {
"default": true,
"description": "Include inferred promotions (default True). False = observed only.",
"type": "boolean"
},
"limit": {
"default": 10,
"description": "Max distinct promotions.",
"maximum": 20,
"minimum": 1,
"type": "integer"
}
},
"required": [
"query"
]
}

Output schema​

Describes both branches of the envelope — result on success, error on a refusal. Validate against this rather than pattern-matching the prose above; see Concepts → Response shape.

{
"type": "object",
"properties": {
"result": {
"properties": {
"total_matched": {
"description": "Distinct promotions, counted exactly to 40,000 and estimated above that (within roughly half a percent). The full count; the page in promos may be smaller.",
"type": "integer"
},
"coverage": {
"description": "The dataset frontier, ignoring the query's own filters.\n\nend is the latest observed (non-inferred) promotion date, so a promo still\nrunning at the frontier can be told from one that genuinely closed. Either\nbound is null on an empty index.",
"properties": {
"start": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"end": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
}
},
"required": [
"start",
"end"
],
"type": "object"
},
"returned": {
"type": "integer"
},
"promos": {
"items": {
"properties": {
"promo_id": {
"type": "string"
},
"image_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null
},
"retailer": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The retailer slug — this is the value the retailers filter accepts."
},
"retailer_name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Display name, not filterable."
},
"region": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null
},
"channel_type": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null
},
"promo_description": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null
},
"promo_type": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null
},
"promo_depth": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
],
"default": null
},
"promo_currency": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null
},
"promo_codes": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null
},
"promo_categories": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null
},
"promo_conditions": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null
},
"all_observed_codes": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Union across every banner folded into this record; the singular field of the same name is unaffected by it."
},
"all_observed_categories": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Union across every banner folded into this record; the singular field of the same name is unaffected by it."
},
"all_observed_conditions": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Union across every banner folded into this record; the singular field of the same name is unaffected by it."
},
"promo_gender": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null
},
"promo_start_date": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null
},
"active_window": {
"anyOf": [
{
"description": "A promo's outer first-to-last span, computed per query.\n\nduration_days is the inclusive calendar span start..end, not a count of\nactive days — the window may contain gaps.",
"properties": {
"start": {
"type": "string"
},
"end": {
"type": "string"
},
"duration_days": {
"type": "integer"
}
},
"required": [
"start",
"end",
"duration_days"
],
"type": "object"
},
{
"type": "null"
}
],
"description": "Null when either span bound is missing."
},
"any_inferred": {
"description": "Whether ANY backing row is forward-projected — campaign-level provenance.",
"type": "boolean"
},
"score": {
"description": "Raw BM25, for ordering only — not a probability, not comparable across tools.",
"type": "number"
}
},
"required": [
"promo_id",
"active_window",
"any_inferred",
"score"
],
"type": "object"
},
"type": "array"
},
"filter_echo": {
"properties": {
"retailers": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null
},
"regions": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null
},
"start_date": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null
},
"end_date": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null
},
"include_inferred": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"default": null
},
"query": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null
},
"fields": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null
},
"limit": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null
}
},
"type": "object"
}
},
"required": [
"total_matched",
"coverage",
"returned",
"promos",
"filter_echo"
],
"type": "object"
},
"error": {
"type": "object",
"description": "Present instead of `result` when the call was rejected. Branch on `code`; never string-match `message`.",
"properties": {
"code": {
"type": "string",
"enum": [
"invalid_input",
"not_entitled",
"upstream_unavailable",
"internal"
]
},
"message": {
"type": "string"
},
"field": {
"type": "string",
"description": "Offending parameter, when the failure is attributable to one."
},
"details": {
"type": "object",
"additionalProperties": true
}
},
"required": [
"code",
"message"
]
}
},
"oneOf": [
{
"required": [
"result"
]
},
{
"required": [
"error"
]
}
],
"x-fastmcp-wrap-result": true
}