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
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | 検証したいTwitter/Xの投稿テキスト |
Implementation Reference
- src/server.ts:152-185 (handler)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'], },