Skip to main content
Glama
serima

Twitter MCP Server

by serima

validate_tweet

Check if a Twitter/X post meets platform requirements by validating character count, URLs, and mentions to prevent posting errors.

Instructions

Twitter/Xの投稿が有効かどうかを検証します(文字数制限、URL、メンションなど)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYes検証したいTwitter/Xの投稿テキスト

Implementation Reference

  • The handler implementation for 'validate_tweet', which parses the text using twitter-text and returns a validation object.
    private validateTweet(text: string) {
      const parsed = twitterText.parseTweet(text);
      const entities = twitterText.extractEntitiesWithIndices(text);
    
      const validation = {
        valid: parsed.valid,
        characterCount: parsed.weightedLength,
        maxLength: 280,
        remaining: 280 - parsed.weightedLength,
        issues: [] as string[],
        entities: {
          urls: entities.filter((e: any) => e.url).length,
          mentions: entities.filter((e: any) => e.screenName).length,
          hashtags: entities.filter((e: any) => e.hashtag).length,
        }
      };
    
      if (!parsed.valid) {
        validation.issues.push('文字数制限を超えています');
      }
    
      if (parsed.weightedLength === 0) {
        validation.issues.push('投稿内容が空です');
      }
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(validation, null, 2),
          },
        ],
      };
    }
  • src/server.ts:56-68 (registration)
    The registration of 'validate_tweet' within the MCP tool list.
    {
      name: 'validate_tweet',
      description: 'Twitter/Xの投稿が有効かどうかを検証します(文字数制限、URL、メンションなど)',
      inputSchema: {
        type: 'object',
        properties: {
          text: {
            type: 'string',
            description: '検証したいTwitter/Xの投稿テキスト',
          },
        },
        required: ['text'],
      },
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It adds valuable behavioral context by specifying validation criteria (character limits, URLs, mentions), but lacks critical disclosure about whether this requires Twitter API authentication, consumes rate limits, or what the return format is (boolean vs. detailed error object).

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?

Single, efficient sentence with purpose front-loaded and specific validation domains parenthesized. No redundant words; the 'など' (etc.) appropriately suggests additional validation rules without over-specifying. Every element earns its place.

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 low complexity (single string parameter, 100% schema coverage), the description adequately covers the tool's purpose and validation scope. However, without an output schema, it should ideally mention the return format (e.g., validation result structure) to be fully 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?

With 100% schema description coverage, the baseline is 3. The description implies the text parameter should be tweet content potentially containing URLs/mentions, but does not add syntax requirements, examples, or constraints beyond what the schema already states ('検証したいTwitter/Xの投稿テキスト').

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 uses a specific verb (検証/validate) with a clear resource (Twitter/X posts) and explicitly scopes the validation to character limits, URLs, and mentions. This effectively distinguishes it from siblings: count_tweet_characters (counting), extract_entities (extraction), and optimize_tweet (optimization/fixing).

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

Usage Guidelines3/5

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

The description implies usage by listing validation aspects (character limits, URLs, mentions), suggesting it's for pre-posting validation. However, it lacks explicit when-to-use guidance versus alternatives (e.g., 'use this to check validity before posting; use optimize_tweet to automatically fix issues').

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

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