summarize_conversation
Generate concise summaries of conversations using the specified conversation ID and prompt ID for better clarity and insight. Simplify lengthy discussions into key points.
Instructions
Summarize a conversation.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| conversation_id | Yes | ||
| end_date | No | ||
| language | No | ||
| limit | No | ||
| message_ids | No | ||
| prompt_id | Yes | ||
| start_date | No |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"conversation_id": {
"minLength": 1,
"type": "string"
},
"end_date": {
"format": "date-time",
"type": "string"
},
"language": {
"type": "string"
},
"limit": {
"default": 50,
"type": "number"
},
"message_ids": {
"items": {
"type": "string"
},
"type": "array"
},
"prompt_id": {
"minLength": 1,
"type": "string"
},
"start_date": {
"format": "date-time",
"type": "string"
}
},
"required": [
"conversation_id",
"prompt_id"
],
"type": "object"
}
Implementation Reference
- src/server.ts:497-528 (handler)The async handler function that implements the 'summarize_conversation' tool. It fetches messages if not provided, then calls the AI response API to generate the summary.async ( args: SummarizeConversationParams, { authInfo }, ): Promise<McpToolResponse> => { try { let message_ids: string[] = args.message_ids || []; // If no message ids are provided, get couple of messages from the conversation if (!args.message_ids) { const messages = await simplifiedApi.listMessages( args, setCarbonVoiceAuthHeader(authInfo?.token), ); message_ids = messages.results?.map((message) => message.id) || []; } const aiResponse = await simplifiedApi.aIResponseControllerCreateResponse( { prompt_id: args.prompt_id, message_ids: message_ids, channel_id: args.conversation_id, language: args.language, }, setCarbonVoiceAuthHeader(authInfo?.token), ); return formatToMCPToolResponse(aiResponse); } catch (error) { logger.error('Error summarizing conversation:', { error }); return formatToMCPToolResponse(error); } },
- src/server.ts:487-529 (registration)Registers the 'summarize_conversation' tool on the MCP server with description, input schema reference, annotations, and inline handler.server.registerTool( 'summarize_conversation', { description: 'Summarize a conversation.', inputSchema: summarizeConversationParams.shape, annotations: { readOnlyHint: false, destructiveHint: false, }, }, async ( args: SummarizeConversationParams, { authInfo }, ): Promise<McpToolResponse> => { try { let message_ids: string[] = args.message_ids || []; // If no message ids are provided, get couple of messages from the conversation if (!args.message_ids) { const messages = await simplifiedApi.listMessages( args, setCarbonVoiceAuthHeader(authInfo?.token), ); message_ids = messages.results?.map((message) => message.id) || []; } const aiResponse = await simplifiedApi.aIResponseControllerCreateResponse( { prompt_id: args.prompt_id, message_ids: message_ids, channel_id: args.conversation_id, language: args.language, }, setCarbonVoiceAuthHeader(authInfo?.token), ); return formatToMCPToolResponse(aiResponse); } catch (error) { logger.error('Error summarizing conversation:', { error }); return formatToMCPToolResponse(error); } }, );
- src/schemas/conversation.ts:3-11 (schema)Zod schema defining the input parameters for the 'summarize_conversation' tool, including conversation_id, prompt_id, optional message_ids, language, date filters, and limit.export const summarizeConversationParams = z.object({ conversation_id: z.string().nonempty(), prompt_id: z.string().nonempty(), message_ids: z.array(z.string()).optional(), language: z.string().optional(), start_date: z.string().datetime().optional(), end_date: z.string().datetime().optional(), limit: z.number().optional().default(50), });
- TypeScript type for SummarizeConversationParams inferred from the Zod schema.export type SummarizeConversationParams = z.infer< typeof summarizeConversationParams >;