Overview
Use the X Live Search MCP server from your ATXP-powered agent to search X (formerly Twitter) for posts and conversations using xAI’s Grok models. Powered by xAI’s Agentic Search Tools API, the server uses AI agents that autonomously explore and make follow-up queries to provide comprehensive search results with citations.Example prompts
- “What are the latest updates from Stripe?”
- “Find popular tweets about AI from the last week with at least 100 likes”
- “Search for posts from @elonmusk about SpaceX”
Tools
x_live_search
x_live_search
Searches X (formerly Twitter) for posts matching the query and optional filters using xAI’s Agentic Search Tools API. The AI agent autonomously explores and makes follow-up queries to provide comprehensive results with citations to source posts.
Arguments
Accepts a JSON object with the following properties:The search query to execute on X (formerly Twitter). Natural language queries work best with the agentic search API.
List of X handles to include in search (up to 10). Format without @ symbol, e.g., [“elonmusk”, “OpenAI”].
List of X handles to exclude from search (up to 10). Format without @ symbol.
Start date for posts in ISO8601 format (YYYY-MM-DD).
End date for posts in ISO8601 format (YYYY-MM-DD).
Enable AI analysis of images in posts. Increases token usage.
Enable AI analysis of videos in X posts. Increases token usage.
Enable web search beyond X to find additional context and information.
When web search is enabled, limit results to these domains (e.g., [“arxiv.org”, “openai.com”]).
Minimum number of likes/favorites. Only returns posts with at least this many likes.
Minimum number of retweets. Only returns posts with at least this many retweets.
Minimum number of replies. Only returns posts with at least this many replies.
Response
Returns a JSON object with the following properties:The status of the search operation. Returns “success” when the search completes successfully, or “error” on failure.
The original search query that was executed.
AI-generated summary of the search findings. Only present when status is “success”.
Array of X post URLs used as sources for the summary. Only present when status is “success”.
Array of tool calls made by the AI agent during search, showing what searches were performed. Each object contains function name and arguments. Only present when status is “success”.
Error details if the search failed. Only present when status is “error”.
x_live_search_async
x_live_search_async
Starts an asynchronous search of X (formerly Twitter) for posts matching the query and optional filters using xAI’s Agentic Search Tools API. Returns a task ID immediately that can be used to check status and retrieve results. This is useful for avoiding timeouts on long-running searches.
Arguments
Accepts a JSON object with the following properties:The search query to execute on X (formerly Twitter). Natural language queries work best with the agentic search API.
List of X handles to include in search (up to 10). Format without @ symbol, e.g., [“elonmusk”, “OpenAI”].
List of X handles to exclude from search (up to 10). Format without @ symbol.
Start date for posts in ISO8601 format (YYYY-MM-DD).
End date for posts in ISO8601 format (YYYY-MM-DD).
Enable AI analysis of images in posts. Increases token usage.
Enable AI analysis of videos in X posts. Increases token usage.
Enable web search beyond X to find additional context and information.
When web search is enabled, limit results to these domains (e.g., [“arxiv.org”, “openai.com”]).
Minimum number of likes/favorites. Only returns posts with at least this many likes.
Minimum number of retweets. Only returns posts with at least this many retweets.
Minimum number of replies. Only returns posts with at least this many replies.
Response
Returns a JSON object with the following properties:A unique task identifier that can be used with
x_get_search_async to check the status and retrieve the result.x_get_search_async
x_get_search_async
Retrieves the status and result of an asynchronous X search task using the task ID. Tasks expire after 12 hours.
Arguments
Accepts a JSON object with the following properties:The task ID returned from
x_live_search_async.Response
Returns a JSON object with the following properties:The current status of the task. Can be “pending”, “in_progress”, “completed”, or “error”.
The search result object. Only present when status is “completed”. Contains the same fields as the
x_live_search response (status, query, message, citations, toolCalls).Error details if the search failed. Only present when status is “error”.
Unix timestamp (in milliseconds) when the task was created.
Unix timestamp (in milliseconds) when the task completed. Only present when status is “completed” or “error”.
Usage
1
Define the X Live Search service
Create a reusable service configuration that points to the MCP server and standardizes how you pass arguments and read results. This lets your agent easily interact with the X Live Search tool in a consistent manner.
2
Create an ATXP client
- Using an ATXP account
- Using a Base account
- Using a Solana account
- Using a Worldchain account
- Using a Polygon account
Create a client using an ATXP account by importing the ATXP client SDK and other dependencies.
3
Use the X Live Search service in your agent
- Synchronous Search
- Asynchronous Search
Call the X Live Search tool by passing your search query and optional filters as arguments.Read the response using the
getResult method.You should see the search summary and citations printed in your console.