Skip to main content
Glama
serima

Twitter MCP Server

by serima

extract_entities

Extracts URLs, mentions, and hashtags from Twitter/X posts to analyze content structure and ensure compliance with platform character limits.

Instructions

Twitter/Xの投稿からエンティティ(URL、メンション、ハッシュタグ)を抽出します

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesエンティティを抽出したいTwitter/Xの投稿テキスト

Implementation Reference

  • The extractEntities method implementation, which processes the input text using the twitterText library to extract URLs, mentions, and hashtags.
    private extractEntities(text: string) {
      const urls = twitterText.extractUrls(text);
      const mentions = twitterText.extractMentions(text);
      const hashtags = twitterText.extractHashtags(text);
      const entities = twitterText.extractEntitiesWithIndices(text);
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              urls,
              mentions,
              hashtags,
              entitiesWithIndices: entities,
              summary: {
                totalUrls: urls.length,
                totalMentions: mentions.length,
                totalHashtags: hashtags.length,
              }
            }, null, 2),
          },
        ],
  • The MCP tool schema definition for 'extract_entities'.
    {
      name: 'extract_entities',
      description: 'Twitter/Xの投稿からエンティティ(URL、メンション、ハッシュタグ)を抽出します',
      inputSchema: {
        type: 'object',
        properties: {
          text: {
            type: 'string',
            description: 'エンティティを抽出したいTwitter/Xの投稿テキスト',
          },
        },
        required: ['text'],
      },
    },
  • src/server.ts:120-121 (registration)
    The tool call registration inside the request handler.
    case 'extract_entities':
      return this.extractEntities(request.params.arguments?.text as string);
Behavior3/5

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

With no annotations provided, the description carries the burden of behavioral disclosure. It successfully specifies which entity types are extracted (URLs, mentions, hashtags), but lacks information about output format, idempotency, or whether the operation is read-only, which would be especially helpful given the absence of an output schema.

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, efficiently structured sentence that front-loads the essential information without redundancy. Every element (platform, action, entity types) earns its place.

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 the tool's low complexity (1 simple parameter) and clear purpose, the description is minimally adequate. However, it lacks return value documentation, which is a notable gap since no output schema exists to explain what the extraction returns (e.g., arrays, positions, formatted strings).

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 its single 'text' parameter. The description does not add additional semantic details (e.g., length limits, encoding requirements) beyond what the schema already provides, warranting the baseline score of 3.

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 (抽出します/extract), resource (Twitter/Xの投稿/posts), and specific scope (entities: URLs, mentions, hashtags). However, it does not explicitly differentiate from siblings like count_tweet_characters or validate_tweet, which would be needed for a 5.

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. While the extraction purpose is distinct from counting or validating, there is no explicit 'use this when...' or 'instead of X, use this for entity extraction' guidance.

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