Skip to main content
Glama

phone_get_last_result

Retrieve the last processed result of a specific call using the call ID. Ideal for automated conversational phone systems powered by Asterisk S2S MCP Server.

Instructions

Obtener el último resultado procesado de una llamada específica

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
callIdYesID de la llamada

Implementation Reference

  • index.ts:232-255 (registration)
    Registration of the 'phone_get_last_result' MCP tool, including input schema (callId: string) and handler function that delegates to phoneTools.getLastConversationResult and formats the MCP response.
    // 9. Obtener último resultado de conversación server.tool( "phone_get_last_result", "Obtener el último resultado procesado de una llamada específica", { callId: z.string().describe("ID de la llamada") }, async (args) => { const result = await phoneTools.getLastConversationResult({ callId: args.callId }); if (!result || !result.found) { return { content: [{ type: "text", text: `❌ No se encontró resultado para la llamada: ${args.callId}` }], }; } return { content: [{ type: "text", text: `📋 **Resultado de llamada ${args.callId}**\n\n${result.response_for_user || 'Sin respuesta'}\n\n**Acciones realizadas:** ${result.actions_taken?.join(', ') || 'Ninguna'}\n**Procesado:** ${result.processed_at || 'No disponible'}` }], }; } );
  • Inline handler function for the phone_get_last_result tool that calls the helper getLastConversationResult and returns formatted text content for MCP.
    async (args) => { const result = await phoneTools.getLastConversationResult({ callId: args.callId }); if (!result || !result.found) { return { content: [{ type: "text", text: `❌ No se encontró resultado para la llamada: ${args.callId}` }], }; } return { content: [{ type: "text", text: `📋 **Resultado de llamada ${args.callId}**\n\n${result.response_for_user || 'Sin respuesta'}\n\n**Acciones realizadas:** ${result.actions_taken?.join(', ') || 'Ninguna'}\n**Procesado:** ${result.processed_at || 'No disponible'}` }], }; }
  • Input schema for phone_get_last_result tool: requires callId as string.
    { callId: z.string().describe("ID de la llamada") },
  • Helper function getLastConversationResult that searches conversation history for the specific callId and returns the processed result.
    export async function getLastConversationResult(args: { callId: string; }): Promise<{ found: boolean; response_for_user?: string; actions_taken?: string[]; processed_at?: string; } | null> { const { callId } = args; const history = phoneOps.getConversationHistory(100); // Buscar en historial reciente const result = history.find(h => h.callId === callId); if (!result) { return { found: false }; } return { found: true, response_for_user: result.response_for_user, actions_taken: result.actions_taken, processed_at: new Date().toISOString() // Simplificado }; }
  • Core helper getConversationHistory that provides recent conversation processing results from in-memory storage, used by the tool's helper chain.
    export function getConversationHistory(limit: number = 50): ConversationProcessingResult[] { return conversationHistory .slice(-limit) .reverse(); }

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/gcorroto/mcp-s2s-asterisk'

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