Skip to main content
Glama
crazyrabbitLTC

Twitter MCP Server

getAuthenticatedUser

Retrieve your own Twitter profile information, including username, bio, and metrics, without specifying user credentials.

Instructions

Get the authenticated user's own profile information without needing to specify username or ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
userFieldsNoAdditional user fields to include (e.g., ["id", "username", "name", "description", "public_metrics", "verified", "profile_image_url", "created_at"])

Implementation Reference

  • The handler function that implements the core logic for the 'getAuthenticatedUser' tool. It fetches the authenticated user's profile information using the Twitter API v2.me() endpoint, handles missing client, authentication errors, rate limits, and formats the response.
    /**
     * Get the authenticated user's own profile information
     */
    export const handleGetAuthenticatedUser: TwitterHandler<GetAuthenticatedUserArgs> = async (
        client: TwitterClient | null,
        { userFields }: GetAuthenticatedUserArgs
    ): Promise<HandlerResponse> => {
        if (!client) {
            return createMissingTwitterApiKeyResponse('getAuthenticatedUser');
        }
    
        try {
            const me = await client.v2.me({
                'user.fields': (userFields as TTweetv2UserField[]) || ['id', 'username', 'name', 'description', 'public_metrics', 'verified', 'profile_image_url', 'created_at'] as TTweetv2UserField[]
            });
    
            if (!me.data) {
                throw new Error('Unable to retrieve authenticated user information');
            }
    
            return createResponse(`Authenticated user info: ${JSON.stringify(me.data, null, 2)}`);
        } catch (error) {
            if (error instanceof Error) {
                if (error.message.includes('401')) {
                    throw new Error(`Authentication failed. Please check your API credentials and tokens. This endpoint requires valid OAuth 1.0a User Context or OAuth 2.0 Authorization Code with PKCE authentication.`);
                }
                if (error.message.includes('429')) {
                    throw new Error(`Rate limit exceeded. Please wait before making another request.`);
                }
                throw new Error(formatTwitterError(error, 'getting authenticated user'));
            }
            throw error;
        }
    }; 
  • src/tools.ts:172-185 (registration)
    Registers the 'getAuthenticatedUser' tool in the MCP tools manifest, defining its description and JSON input schema for validation.
    getAuthenticatedUser: {
        description: 'Get the authenticated user\'s own profile information without needing to specify username or ID',
        inputSchema: {
            type: 'object',
            properties: {
                userFields: {
                    type: 'array',
                    items: { type: 'string' },
                    description: 'Additional user fields to include (e.g., ["id", "username", "name", "description", "public_metrics", "verified", "profile_image_url", "created_at"])'
                }
            },
            required: []
        }
    },
  • TypeScript interface defining the input arguments for the getAuthenticatedUser handler, providing type safety for the userFields parameter.
    export interface GetAuthenticatedUserArgs {
        userFields?: TTweetv2UserField[];
    }
  • src/index.ts:217-220 (registration)
    Dispatches the 'getAuthenticatedUser' tool call to the appropriate handler function in the main server switch statement.
    case 'getAuthenticatedUser': {
        const { userFields } = request.params.arguments as { userFields?: TTweetv2UserField[] };
        response = await handleGetAuthenticatedUser(client, { userFields });
        break;
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions the tool retrieves profile information but doesn't disclose behavioral aspects like authentication requirements, rate limits, error conditions, or what happens if userFields is omitted. For a tool with no annotation coverage, this is insufficient.

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 that front-loads the core purpose. Every word contributes to understanding the tool's function without redundancy.

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

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description adequately covers the basic purpose but lacks details on behavior, return values, or error handling. For a simple read operation with one optional parameter, it's minimally viable but could be more complete.

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?

Schema description coverage is 100%, so the schema fully documents the optional userFields parameter. The description doesn't add any parameter-specific information beyond what's in the schema, maintaining the baseline score of 3.

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

Purpose5/5

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

The description clearly states the verb ('Get') and resource ('authenticated user's own profile information'), specifying it's for the current user without needing identifiers. It distinguishes from sibling tools like getUserInfo which likely requires a username/ID parameter.

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

Usage Guidelines4/5

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

The description implies usage context ('without needing to specify username or ID'), suggesting this tool is for accessing the current user's profile. However, it doesn't explicitly state when to use alternatives like getUserInfo or other user-related tools.

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

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

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