Skip to main content
Glama
gcorroto

Asterisk S2S MCP Server

by gcorroto

phone_cancel_call

Terminate an ongoing phone call by specifying the call ID, enabling users to stop conversations efficiently within the Asterisk S2S MCP Server environment.

Instructions

Cancelar una llamada telefónica en curso

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
callIdYesID de la llamada a cancelar

Implementation Reference

  • Core handler for cancelling phone calls: invokes the PhoneClient to cancel the call, updates local active calls state, and logs the operation with success or error handling.
    /**
     * Cancelar una llamada
     */
    export async function cancelCall(callId: string): Promise<boolean> {
      const client = getPhoneClient();
      
      try {
        const success = await client.cancelCall(callId);
        
        if (success) {
          // Actualizar estado local
          const callStatus = activeCalls.get(callId);
          if (callStatus) {
            callStatus.status = 'cancelled';
            callStatus.lastUpdate = new Date().toISOString();
            activeCalls.set(callId, callStatus);
          }
          
          // Log de cancelación
          const log: SystemLog = {
            id: generateId(),
            timestamp: new Date().toISOString(),
            level: 'info',
            component: 'phone',
            action: 'call_cancelled',
            details: { callId },
            callId
          };
          systemLogs.push(log);
        }
        
        return success;
      } catch (error) {
        const errorLog: SystemLog = {
          id: generateId(),
          timestamp: new Date().toISOString(),
          level: 'error',
          component: 'phone',
          action: 'cancel_call_failed',
          details: {
            error: error instanceof Error ? error.message : 'Unknown error',
            callId
          },
          callId
        };
        systemLogs.push(errorLog);
        
        throw error;
      }
    }
  • index.ts:78-95 (registration)
    Registers the MCP tool 'phone_cancel_call' with input schema (callId: string) and handler that delegates to phoneTools.cancelCall, returning formatted success/error message.
      "phone_cancel_call",
      "Cancelar una llamada telefónica en curso",
      {
        callId: z.string().describe("ID de la llamada a cancelar")
      },
      async (args) => {
        const result = await phoneTools.cancelCall({ callId: args.callId });
    
        return {
          content: [{ 
            type: "text", 
            text: result.success 
              ? `✅ ${result.message}` 
              : `❌ ${result.message}`
          }],
        };
      }
    );
  • Helper function that wraps phoneOps.cancelCall, providing standardized {success, message} response and error handling.
    export async function cancelCall(args: {
      callId: string;
    }): Promise<{
      success: boolean;
      message: string;
    }> {
      const { callId } = args;
      
      try {
        const success = await phoneOps.cancelCall(callId);
        
        return {
          success,
          message: success ? 'Llamada cancelada exitosamente' : 'No se pudo cancelar la llamada'
        };
      } catch (error) {
        return {
          success: false,
          message: error instanceof Error ? error.message : 'Error desconocido al cancelar llamada'
        };
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the tool cancels an ongoing call, implying a destructive mutation, but doesn't disclose behavioral traits such as required permissions, whether cancellation is reversible, side effects (e.g., call termination notifications), or error handling. The description is minimal and lacks critical operational context.

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

Conciseness5/5

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

The description is a single, efficient sentence in Spanish that directly states the tool's function. It's front-loaded with the core action and resource, with zero wasted words. This is appropriately concise for a simple tool.

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 tool's complexity (a destructive mutation with no annotations and no output schema), the description is incomplete. It doesn't explain what happens upon cancellation, return values, error conditions, or dependencies on sibling tools. For a mutation tool, this leaves significant gaps in understanding for an AI agent.

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?

Schema description coverage is 100%, with the single parameter 'callId' documented as 'ID de la llamada a cancelar'. The description adds no additional meaning beyond this, such as format examples or sourcing guidance (e.g., from phone_get_active_calls). Baseline 3 is appropriate since the schema fully covers the parameter.

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 ('Cancelar' = Cancel) and target resource ('una llamada telefónica en curso' = an ongoing phone call). It's specific about what the tool does, though it doesn't explicitly differentiate from sibling tools like phone_get_active_calls or phone_make_call. The purpose is unambiguous but lacks sibling comparison.

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 (e.g., needing an active call), exclusions, or relationships with sibling tools like phone_get_active_calls (which might list calls to cancel) or phone_make_call. Usage context is implied but not stated.

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