get_recent_messages
Retrieve recent messages with conversation, creator, and label details from Carbon Voice. Filter by conversation ID or language to access up to 10 messages.
Instructions
Get most recent messages, including their associated Conversation, Creator, and Labels information. Returns a maximum of 10 messages.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| conversation_id | No | Conversation ID (optional) | |
| language | No | Language (optional) - Original language will be used if not provided or not found. |
Implementation Reference
- src/server.ts:153-181 (registration)Registration of the 'get_recent_messages' MCP tool, including its description, input schema reference, annotations, and inline handler function that authenticates and calls the underlying API, formatting the response.server.registerTool( 'get_recent_messages', { description: 'Get most recent messages, including their associated Conversation, Creator, and Labels information. ' + 'Returns a maximum of 10 messages.', inputSchema: getTenRecentMessagesResponseQueryParams.shape, annotations: { readOnlyHint: true, destructiveHint: false, }, }, async ( args: GetTenRecentMessagesResponseParams, { authInfo }, ): Promise<McpToolResponse> => { try { return formatToMCPToolResponse( await simplifiedApi.getTenRecentMessagesResponse( args, setCarbonVoiceAuthHeader(authInfo?.token), ), ); } catch (error) { logger.error('Error getting recent messages:', { args, error }); return formatToMCPToolResponse(error); } }, );
- src/server.ts:165-180 (handler)The handler function for the tool, which executes the logic: calls simplifiedApi.getTenRecentMessagesResponse with parameters and auth token, formats the result using formatToMCPToolResponse, and handles errors.async ( args: GetTenRecentMessagesResponseParams, { authInfo }, ): Promise<McpToolResponse> => { try { return formatToMCPToolResponse( await simplifiedApi.getTenRecentMessagesResponse( args, setCarbonVoiceAuthHeader(authInfo?.token), ), ); } catch (error) { logger.error('Error getting recent messages:', { args, error }); return formatToMCPToolResponse(error); } },
- Zod schema definition for the input parameters to the get_recent_messages tool (getTenRecentMessagesResponseQueryParams), used as inputSchema in registration.export const getTenRecentMessagesResponseQueryParams = zod.object({ "conversation_id": zod.string().optional().describe('Conversation ID (optional)'), "language": zod.string().optional().describe('Language (optional) - Original language will be used if not provided or not found.') })