Skip to main content
Glama
rafaljanicki

X (Twitter) MCP server

by rafaljanicki

get_user_by_id

Retrieve user details from the X (Twitter) MCP server using a unique user ID, enabling quick access to specific user information.

Instructions

Fetches a user by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
user_idYes

Implementation Reference

  • The main handler function for the 'get_user_by_id' tool. It initializes the Twitter client and calls client.get_user to fetch user details by ID, returning the user data.
    async def get_user_by_id(user_id: str) -> Dict: """Fetches user by ID. Args: user_id (str): The ID of the user to look up. """ client, _ = initialize_twitter_clients() user = client.get_user(id=user_id, user_fields=["id", "name", "username", "profile_image_url", "description"]) return user.data
  • The FastMCP decorator that registers the 'get_user_by_id' tool with its name and description.
    @server.tool(name="get_user_by_id", description="Fetches a user by ID")

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/rafaljanicki/x-twitter-mcp-server'

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