Skip to main content
Glama
gcorroto

Asterisk S2S MCP Server

by gcorroto

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();
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool retrieves the last processed result, implying a read-only operation, but doesn't specify what 'procesado' entails, potential errors (e.g., if no result exists), or the return format. This leaves gaps in understanding the tool's behavior and output.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, concise sentence that directly states the tool's purpose without unnecessary words. It is front-loaded and efficient, though it could be slightly more structured by including usage hints. Overall, it earns its place by being clear and to the point.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of retrieving processed results and the lack of annotations and output schema, the description is insufficient. It doesn't explain what 'último resultado procesado' means in practice, the data format returned, or error conditions. For a tool with no structured output information, more descriptive context is needed to guide the agent effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the parameter 'callId' clearly documented as 'ID de la llamada'. The description adds no additional semantic context beyond this, such as format examples or constraints. Given the high schema coverage, a baseline score of 3 is appropriate as the schema handles the parameter documentation adequately.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Obtener el último resultado procesado') and resource ('de una llamada específica'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'phone_get_conversation_history' or 'phone_get_logs' which might also retrieve call-related data, leaving some ambiguity about uniqueness.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, such as needing a processed call, or compare it to siblings like 'phone_get_conversation_history' for broader history or 'phone_get_status' for current state, leaving the agent without context for selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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