Skip to main content
Glama

search_tweets

Search Twitter/X for recent tweets using keywords, hashtags, or advanced filters. Retrieve matching tweets with IDs, text, and timestamps.

Instructions

Searches Twitter/X for recent tweets matching a query string. Use this tool when the LLM needs to find tweets by keyword, hashtag, mention, or advanced filters (date ranges, language, engagement thresholds). Supports Twitter's full advanced search syntax. Returns a list of matching tweets with their IDs, text, author IDs, and creation timestamps, plus pagination metadata (next_token) for retrieving additional results. Can use alternative backends (XQuik or GetXAPI) when their respective API keys are configured. The count parameter controls how many results (10-100) are returned per call.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesThe Twitter search query string. Supports the full Twitter advanced search syntax, including keywords (separated by spaces), exact phrases (in double quotes), from:username, to:username, #hashtag, @mention, lang:XX (ISO language code), until:YYYY-MM-DD, since:YYYY-MM-DD, min_retweets:N, min_faves:N, and filter:media / filter:links / filter:images. The query is URL-encoded and sent directly to the Twitter search API.
countYesNumber of search results to return per request. Must be between 10 and 100 (inclusive). Higher values return more tweets per invocation but increase response latency and API quota consumption.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
statusYesIndicates the outcome of the operation: "success" or "error".
messageYesA human-readable summary of the search result, e.g. "Search completed successfully".
dataYesContainer holding the array of matched tweets and search metadata.
Behavior5/5

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

No annotations provided, so the description carries full burden. It thoroughly discloses behavior: returns list with fields, pagination metadata, alternative backends, and count parameter effects (latency, quota). No contradictions.

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 a single paragraph that front-loads the main purpose and uses efficient language. Some slight redundancy (e.g., 'Searches' and 'Returns'), but overall each sentence adds value.

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

Completeness5/5

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

Given the tool's low complexity (2 params, no nested objects) and presence of output schema, the description covers purpose, usage, syntax, return fields, pagination, and backend options comprehensively.

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

Parameters5/5

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

Schema coverage is 100%, but description adds significant extra context: query parameter includes detailed advanced syntax examples, count parameter explains range and performance trade-offs. This goes well beyond schema basics.

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 searches for tweets matching a query, using specific verbs and resources. It distinguishes from sibling tools (post_tweet, post_tweet_with_image) by focusing on search/retrieval rather than posting.

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 explicitly states when to use the tool (when needing to find tweets by keyword, hashtag, etc.) and mentions alternative backends. However, it does not provide explicit negative examples or compare to non-sibling tools.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/GenAIwithMS/twitter-mcp'

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