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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

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
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It only states the basic action ('fetches') without mentioning permissions, rate limits, error conditions, or what the output contains. This leaves significant gaps in understanding how the tool behaves beyond its core function.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words. It is appropriately sized for a simple lookup tool and front-loads the essential information.

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

Completeness4/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 (one parameter) and the presence of an output schema, the description is reasonably complete for its purpose. However, it lacks behavioral context and usage guidelines, which are notable gaps despite the structured support.

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

Parameters3/5

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

The description mentions 'by screen name', which clarifies the parameter's purpose beyond the schema's generic 'Screen Name' title. However, with 0% schema description coverage and only one parameter, the baseline is 4, but the description adds minimal semantic value, so a 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('fetches') and resource ('a user'), making the purpose understandable. However, it doesn't distinguish this tool from its sibling 'get_user_by_id', which performs a similar function but uses a different identifier.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like 'get_user_by_id' or 'get_user_profile'. The description offers no context about prerequisites, limitations, or appropriate scenarios for selecting this specific tool.

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

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

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