get_thread
Retrieve all emails in a conversation thread by providing the thread ID. Solves the need to view complete email threads for context.
Instructions
Get all emails in a conversation thread
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| threadId | Yes | ID of the thread/conversation |
Implementation Reference
- src/index.ts:809-822 (registration)Tool registration: 'get_thread' is registered in the ListToolsRequestSchema handler with name, description, and input schema requiring 'threadId'.
{ name: 'get_thread', description: 'Get all emails in a conversation thread', inputSchema: { type: 'object', properties: { threadId: { type: 'string', description: 'ID of the thread/conversation', }, }, required: ['threadId'], }, }, - src/index.ts:1587-1607 (handler)Handler/switch-case: The 'get_thread' case in CallToolRequestSchema extracts threadId, validates it, calls client.getThread(threadId), and returns the result with error handling.
case 'get_thread': { const { threadId } = args as any; if (!threadId) { throw new McpError(ErrorCode.InvalidParams, 'threadId is required'); } const client = initializeClient(); try { const thread = await client.getThread(threadId); return { content: [ { type: 'text', text: JSON.stringify(thread, null, 2), }, ], }; } catch (error) { // Provide helpful error information throw new McpError(ErrorCode.InternalError, `Thread access failed: ${redactBearerTokens(error instanceof Error ? error.message : String(error))}`); } }