Skip to main content
Glama
serima

Twitter MCP Server

by serima

count_tweet_characters

Count Twitter/X post characters accurately, including URLs and emojis, to ensure content fits within platform constraints.

Instructions

Twitter/Xの投稿文字数を正確にカウントします。URLや絵文字も考慮します。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesカウントしたいTwitter/Xの投稿テキスト

Implementation Reference

  • Implementation of the count_tweet_characters tool handler, which uses the twitter-text library to parse the text and calculate character counts.
    private countTweetCharacters(text: string) {
      const parsed = twitterText.parseTweet(text);
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              characterCount: parsed.weightedLength,
              maxLength: 280,
              remaining: 280 - parsed.weightedLength,
              valid: parsed.valid,
              details: {
                displayRangeStart: parsed.displayRangeStart,
                displayRangeEnd: parsed.displayRangeEnd,
                permillage: parsed.permillage,
              }
            }, null, 2),
          },
        ],
      };
    }
  • src/server.ts:42-55 (registration)
    Registration of the count_tweet_characters tool definition within the setupToolHandlers method.
    {
      name: 'count_tweet_characters',
      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?

With no annotations provided, the description carries the full burden of behavioral disclosure. It successfully mentions important Twitter-specific handling (URLs and emojis), but lacks disclosure of what the function returns (integer count vs object), whether it has side effects, or rate limiting details.

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 consists of two efficiently structured sentences with zero waste. The first states the core function, while the second provides essential behavioral context (URL/emoji handling) that modifies how the counting works.

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?

For a single-parameter tool with no nested objects, the description adequately covers the input requirements. However, without an output schema, the description should ideally mention what value is returned (e.g., character count number), which is absent.

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 input schema has 100% description coverage for the single 'text' parameter. The description does not add semantic details beyond what the schema already provides ('カウントしたいTwitter/Xの投稿テキスト'), warranting the baseline score of 3 for high schema coverage.

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 ('カウントします'/counts) with a clear resource ('Twitter/Xの投稿文字数'/Twitter/X post characters). It effectively distinguishes from siblings (extract_entities, optimize_tweet, validate_tweet) by focusing specifically on character counting rather than extraction, optimization, or validation.

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?

While the function is clear from the name and context, there is no explicit guidance on when to use this versus validate_tweet (which likely also checks length constraints). The description relies on implication rather than stating 'use this when you need to check length before posting' or contrasting with alternatives.

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