Skip to main content
Glama

Search tweets with X advanced-search operators

x_search
Read-onlyIdempotent

Search tweets with the same operators as X advanced search, such as from:, since:, min_faves: and lang:. Sort by latest or top and get each tweet's text, author, media, links and engagement counts. Read-only: returns public data and changes nothing. Costs 1 credit per request.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "query": "<query>",
      "count": "<count>"
    },
    "name": "x_search"
  }
}

Input Schema

NameRequiredDescriptionDefault
langNoBCP-47 language filter e.g. "en", "ja" (maps to `lang:XX`).
countYesNumber of results to return (1–20). Defaults to 20.
queryYesRaw search query — supports all X advanced-search operators, e.g. "openai lang:en".
cursorNoThe previous response's `nextCursor`, to fetch the next page. Omit it for the first page.
cacheOnlyNoReturn only a cached result and never scrape live. With `cacheMaxAgeHours`, only a result that recent is returned; without it, the latest cached result of any age. Responds 404, at no cost, when there is none, e.g. true.
sortOrderNoResult ordering: "Latest" = chronological newest-first (default), "Top" = X's engagement ranking.
withinHoursNoOnly return tweets newer than this many hours.
cacheMaxAgeHoursNoAccept a cached result scraped up to this many hours ago. A cached result costs no credits, and its `cachedAt` says when it was scraped. When no cached result is that recent, the data is scraped live at the normal price. Leave it out to always scrape live, e.g. 24.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / lang / pattern
      Previous value: -"^[A-Za-z]{2,3}(-[A-Za-z0-9]+)?$"New value: +"^[A-Za-z]{2,3}(-[A-Za-z0-9]+)*$"
  2. Changed2 schema fields changed
    • changedInput schema / properties / count / default
      Previous value: -10New value: +20
    • changedInput schema / properties / count / description
      Previous value: -"Number of results to return (1–20). Defaults to 10."New value: +"Number of results to return (1–20). Defaults to 20."
  3. Changed2 schema fields changed
    • addedInput schema / properties / cacheMaxAgeHours
      Added value: +{
      +  "description": "Accept a cached result scraped up to this many hours ago. A cached result costs no credits, and its `cachedAt` says when it was scraped. When no cached result is that recent, the data is scraped live at the normal price. Leave it out to always scrape live, e.g. 24.",
      +  "exclusiveMinimum": 0,
      +  "maximum": 9007199254740991,
      +  "type": "integer"
      +}
    • addedInput schema / properties / cacheOnly
      Added value: +{
      +  "description": "Return only a cached result and never scrape live. With `cacheMaxAgeHours`, only a result that recent is returned; without it, the latest cached result of any age. Responds 404, at no cost, when there is none, e.g. true.",
      +  "type": "boolean"
      +}
  4. First observed

TDQS

A3.8/5.0
Behavior3/5

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

The "Read-only: returns public data and changes nothing" sentence largely restates the supplied readOnlyHint/destructiveHint annotations and earns little credit. The genuine addition is "Costs 1 credit per request," which is real behavioral context an agent cannot get from structured fields, but the description stays silent on pagination behavior, the no-cost cache path (cacheOnly / cacheMaxAgeHours), and what a 404/no-result looks like — all of which matter for an agent managing cost and paging.

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

Conciseness5/5

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

Three tight sentences: capability, return shape, then safety/cost. The most decision-relevant facts (search semantics, cost) are front-loaded, and the closing "Read-only... Costs 1 credit" pairing gives the agent the risk/cost profile in one line. No filler or repetition.

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

Completeness4/5

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

For an 8-parameter, no-output-schema tool with full schema coverage, the description covers the essentials: what it searches, how results are ordered, what fields come back, and the per-request credit cost. It stops short of explaining pagination and the cost-free cached-result path, which are documented in the schema but are consequential enough that a sentence in the description would have closed the gap.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents count limits, cursor, cacheOnly, cacheMaxAgeHours, sortOrder, and withinHours in more detail than the description does. The description's operator examples (from:, since:, min_faves:, lang:) and "sort by latest or top" map onto query and sortOrder but add only marginal meaning over the schema's own examples and enum. Baseline 3 applies.

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?

States a specific verb and resource ("Search tweets") plus the distinguishing mechanism ("same operators as X advanced search") with concrete operator examples. It also enumerates what comes back (text, author, media, links, engagement counts), which cleanly separates it from siblings like x_get_user_tweets or x_get_tweet_detail that retrieve known tweets rather than query-driven results.

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

Usage Guidelines3/5

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

Usage is implied rather than stated: the operator list signals "use when you have a search query," and the read-only/cost line hints at budget considerations. However, there is no explicit "use this instead of x_get_user_tweets/x_search_users when..." routing, and no prerequisites or exclusions are given for an 8-parameter tool with several overlapping retrieval siblings.

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