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
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | エンティティを抽出したいTwitter/Xの投稿テキスト |
Implementation Reference
- src/server.ts:235-257 (handler)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), }, ], - src/server.ts:89-102 (schema)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);