Overview
Thegrok_twitter tool provides specialized search capabilities for Twitter/X posts using Grok’s X search integration. It supports filtering by specific handles and, in comprehensive mode, analyzes social media trends and sentiment.
Parameters
The search query to find tweets/posts about. Must be a non-empty string with a maximum length of 1000 characters.
Optional list of Twitter handles to search from. Handles should be provided without the @ symbol.Format:
["username1", "username2"]Examples:- Correct:
["elonmusk", "OpenAI", "AnthropicAI"] - Incorrect:
["@elonmusk", "@OpenAI"](do not include @)
Analysis depth and format. Must be one of:
basic- Returns simple tweet results with content, author, and URLscomprehensive- Provides detailed analysis of social media trends, sentiment analysis, key themes, and influential voices
basicNote: Comprehensive mode particularly useful for understanding social media conversations and sentiment.Maximum number of tweet results to return.Constraints:
- Minimum: 1
- Maximum: 20
- Default: 10
Optional start date for search in ISO8601 format (YYYY-MM-DD). Limits search to content from this date onwards.Validation:
- Must match pattern:
^\d{4}-\d{2}-\d{2}$ - Must be a valid calendar date
- Must be before or equal to
to_dateif both are provided
2025-01-01Optional end date for search in ISO8601 format (YYYY-MM-DD). Limits search to content up to this date.Validation:
- Must match pattern:
^\d{4}-\d{2}-\d{2}$ - Must be a valid calendar date
- Must be after or equal to
from_dateif both are provided
2025-12-31Request Examples
Response Format
Basic Mode Response
Comprehensive Mode Response
Error Response
Common Error Messages
Search query must be a non-empty string- Query parameter is missing or emptySearch query too long (max 1000 characters)- Query exceeds maximum lengthfrom_date must be in ISO8601 format (YYYY-MM-DD)- Invalid date formatfrom_date must be before or equal to to_date- Invalid date rangeAPI service is not healthy - missing XAI_API_KEY- API key not configured
Usage Notes
- Handle Format: Provide handles without @ symbol (e.g.,
"elonmusk"not"@elonmusk") - Handle Filtering: When handles are specified, search is limited to those accounts
- Content Format: Results include full tweet text in snippet field (max 280 characters)
- Comprehensive Analysis: Includes sentiment analysis, trend identification, and influential voices
- Performance: Basic mode provides faster responses than comprehensive mode
- Caching: Comprehensive analyses are cached for 30 minutes
- Token Usage: Basic mode uses ~2000 tokens, comprehensive mode uses ~4000 tokens
- Engagement Metrics: Comprehensive mode may include engagement data when available
- Best For: Social media monitoring, sentiment analysis, influencer tracking, trending topic research
Handle Filtering Examples
Single Handle
Multiple Handles
No Handles
When to Use Comprehensive Mode
Comprehensive mode is particularly valuable for Twitter when you need:- Sentiment analysis of social media conversations
- Identification of key themes and trends
- Understanding different perspectives in a discussion
- Tracking influential voices and viral content
- Timeline of how a conversation developed
- Engagement metrics and reach analysis