Skip to main content
Glama
crazyrabbitLTC

Twitter MCP Server

postTweet

Publish tweets to Twitter using the Model Context Protocol. This tool enables automated posting of text content to the social media platform.

Instructions

Post a tweet to Twitter

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesThe text of the tweet

Implementation Reference

  • Core handler function that executes the postTweet tool by calling the Twitter v2 API to post the tweet.
    export async function handlePostTweet(
        client: TwitterClient | null,
        { text }: { text: string }
    ): Promise<HandlerResponse> {
        if (!client) {
            return createMissingTwitterApiKeyResponse('Post Tweet');
        }
    
        try {
            const tweet = await client.v2.tweet(text);
            return createResponse(`Successfully posted tweet: ${tweet.data.id}`);
        } catch (error) {
            if (error instanceof Error) {
                throw new Error(formatTwitterError(error, 'posting tweet'));
            }
            throw new Error('Failed to post tweet: Unknown error occurred');
        }
    }
  • MCP tool schema definition for postTweet, including input schema and description.
    postTweet: {
        description: 'Post a tweet to Twitter',
        inputSchema: {
            type: 'object',
            properties: {
                text: { type: 'string', description: 'The text of the tweet' },
            },
            required: ['text'],
        },
  • src/index.ts:152-155 (registration)
    Registration and dispatch logic in the main MCP server handler that calls the postTweet handler.
    case 'postTweet': {
        const { text } = request.params.arguments as { text: string };
        response = await handlePostTweet(client, { text });
        break;
  • TypeScript interface defining the input arguments for postTweet.
    export interface PostTweetArgs {
        text: string;
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 states the action ('Post a tweet') but doesn't mention that this is a write operation requiring authentication, potential rate limits, or that it might have side effects like publishing publicly. This leaves significant gaps in understanding the tool's behavior beyond the basic action.

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 extremely concise with a single sentence that directly states the tool's purpose. It's front-loaded with no wasted words, making it easy to parse quickly. Every word earns its place by conveying essential information without redundancy.

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

Completeness2/5

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

Given the complexity of a social media posting tool with no annotations and no output schema, the description is incomplete. It doesn't cover authentication needs, rate limits, error conditions, or what the return value might be (e.g., tweet ID or success status). For a write operation in this context, more behavioral and contextual information is needed.

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 schema description coverage is 100% with one parameter ('text') fully documented in the schema. The description adds no additional meaning about the parameter beyond what's in the schema (e.g., character limits, formatting rules, or emoji handling). This meets the baseline for high schema coverage but doesn't enhance parameter understanding.

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 action ('Post') and resource ('a tweet to Twitter'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'postTweetWithMedia' or 'replyToTweet', which would require mentioning it's for basic text-only tweets without media or specific threading context.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention that 'postTweetWithMedia' should be used for tweets with images/videos, 'replyToTweet' for replying to existing tweets, or any other context like character limits or prerequisites, leaving the agent to infer usage from tool names alone.

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