Skip to main content
Glama
rafaljanicki

X (Twitter) MCP server

by rafaljanicki

get_user_by_screen_name

Retrieve user details from the X (Twitter) MCP server by providing the user's screen name. Simplifies user data lookup for integration or analysis purposes.

Instructions

Fetches a user by screen name

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
screen_nameYes

Implementation Reference

  • Registers the 'get_user_by_screen_name' tool with the FastMCP server using the @server.tool decorator, specifying the name and description.
    @server.tool(name="get_user_by_screen_name", description="Fetches a user by screen name")
  • The handler function that initializes the Twitter API client and calls client.get_user(username=screen_name) to fetch and return the user data as a dictionary.
    async def get_user_by_screen_name(screen_name: str) -> Dict: """Fetches user by screen name. Args: screen_name (str): The screen name/username of the user. """ client, _ = initialize_twitter_clients() user = client.get_user(username=screen_name, user_fields=["id", "name", "username", "profile_image_url", "description"]) return user.data

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