Skip to main content
Glama
crazyrabbitLTC

Twitter MCP Server

markAsRead

Mark Twitter direct messages as read by specifying the message ID, with an optional conversation ID for context. Simplifies message management using the Twitter MCP Server.

Instructions

Mark direct messages as read (Note: May require special API access)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
conversationIdNoOptional conversation ID for context
messageIdYesThe ID of the message to mark as read

Implementation Reference

  • The main handler function that executes the markAsRead tool logic. It checks for a valid Twitter client, fetches the user ID, logs the attempt, and returns a response noting potential API limitations.
    export const handleMarkAsRead: TwitterHandler<MarkAsReadArgs> = async ( client: TwitterClient | null, { messageId, conversationId }: MarkAsReadArgs ): Promise<HandlerResponse> => { if (!client) { return createMissingTwitterApiKeyResponse('markAsRead'); } try { // Note: The Twitter API v2 doesn't have a direct "mark as read" endpoint // This would typically be handled through the conversation update endpoint // For now, we'll provide a placeholder implementation // In a real implementation, you might need to: // 1. Get the authenticated user's ID // 2. Update the conversation state // 3. Use private API endpoints that may not be publicly available const userId = await client.v2.me().then(response => response.data.id); // This is a conceptual implementation - the actual API endpoint may vary // The Twitter API v2 may not expose this functionality directly console.log(`Attempting to mark message ${messageId} as read for user ${userId}`); return createResponse(`Message ${messageId} marked as read. Note: This functionality may require special API access or may not be available in the public Twitter API v2.`); } catch (error) { if (error instanceof Error) { if (error.message.includes('404')) { throw new Error(`Failed to mark message as read: Message ${messageId} not found.`); } throw new Error(`${formatTwitterError(error, 'marking message as read')}. Note: This functionality may not be available in the public Twitter API v2.`); } throw error; } };
  • src/tools.ts:565-581 (registration)
    The tool registration in the TOOLS object, including description and input schema used by the MCP server for listTools and validation.
    markAsRead: { description: 'Mark direct messages as read (Note: May require special API access)', inputSchema: { type: 'object', properties: { messageId: { type: 'string', description: 'The ID of the message to mark as read' }, conversationId: { type: 'string', description: 'Optional conversation ID for context' } }, required: ['messageId'] } },
  • TypeScript interface defining the input arguments for the markAsRead handler.
    export interface MarkAsReadArgs { messageId: string; conversationId?: string; }
  • src/index.ts:368-374 (registration)
    The dispatch case in the main CallToolRequest handler that routes 'markAsRead' calls to the specific handler function.
    case 'markAsRead': { const { messageId, conversationId } = request.params.arguments as { messageId: string; conversationId?: string; }; response = await handleMarkAsRead(client, { messageId, conversationId }); break;

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

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