Skip to main content
Glama
gcorroto

Asterisk S2S MCP Server

by gcorroto

phone_get_logs

Retrieve system logs from the Asterisk S2S MCP Server for debugging. Filter logs by level (info, warn, error, debug) and component (mcp, phone, callback, client) to diagnose telephony system issues efficiently.

Instructions

Obtener logs del sistema telefónico para debugging

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
componentNoFiltrar por componente del sistema
levelNoFiltrar por nivel de log
limitNoNúmero máximo de logs a obtener

Implementation Reference

  • index.ts:191-230 (registration)
    Registers the 'phone_get_logs' MCP tool with Zod input schema and a handler that calls phoneTools.getSystemLogs, formats the logs with icons and returns as text content.
    server.tool(
      "phone_get_logs",
      "Obtener logs del sistema telefónico para debugging",
      {
        limit: z.number().optional().default(20).describe("Número máximo de logs a obtener"),
        level: z.enum(["info", "warn", "error", "debug"]).optional().describe("Filtrar por nivel de log"),
        component: z.enum(["mcp", "phone", "callback", "client"]).optional().describe("Filtrar por componente del sistema")
      },
      async (args) => {
        const result = await phoneTools.getSystemLogs({
          limit: args.limit,
          level: args.level,
          component: args.component
        });
    
        if (result.length === 0) {
          return {
            content: [{ type: "text", text: "📝 No hay logs disponibles con los filtros especificados" }],
          };
        }
    
        const logsText = result.map(log => {
          const levelIcon = {
            info: 'ℹ️',
            warn: '⚠️', 
            error: '❌',
            debug: '🔍'
          }[log.level] || '📝';
          
          return `${levelIcon} **${log.timestamp}** [${log.component.toUpperCase()}] ${log.action}\n${JSON.stringify(log.details, null, 2)}`;
        }).join('\n\n');
    
        return {
          content: [{ 
            type: "text", 
            text: `📝 **Logs del Sistema (${result.length} entradas)**\n\n${logsText}`
          }],
        };
      }
    );
  • Core handler function that retrieves the most recent system logs from the in-memory 'systemLogs' array, sorts them by timestamp descending, and limits to the specified number.
    export function getSystemLogs(limit: number = 100): SystemLog[] {
      return systemLogs
        .sort((a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime())
        .slice(0, limit);
    }
  • Intermediate helper function that applies client-specified filtering (level, component) on top of core getSystemLogs, fetches extra logs to account for filtering.
    export async function getSystemLogs(args?: {
      limit?: number;
      level?: 'info' | 'warn' | 'error' | 'debug';
      component?: 'mcp' | 'phone' | 'callback' | 'client';
    }): Promise<Array<{
      id: string;
      timestamp: string;
      level: string;
      component: string;
      action: string;
      details: any;
      callId?: string;
    }>> {
      const limit = args?.limit || 50;
      const logs = phoneOps.getSystemLogs(limit * 2); // Obtener más para filtrar
    
      // Filtrar por nivel y componente si se especifica
      let filteredLogs = logs;
      
      if (args?.level) {
        filteredLogs = filteredLogs.filter(log => log.level === args.level);
      }
      
      if (args?.component) {
        filteredLogs = filteredLogs.filter(log => log.component === args.component);
      }
    
      return filteredLogs.slice(0, limit);
    }
  • Zod schema for input parameters of phone_get_logs tool.
      {
        limit: z.number().optional().default(20).describe("Número máximo de logs a obtener"),
        level: z.enum(["info", "warn", "error", "debug"]).optional().describe("Filtrar por nivel de log"),
        component: z.enum(["mcp", "phone", "callback", "client"]).optional().describe("Filtrar por componente del sistema")
      },
      async (args) => {
        const result = await phoneTools.getSystemLogs({
          limit: args.limit,
          level: args.level,
          component: args.component
        });
    
        if (result.length === 0) {
          return {
            content: [{ type: "text", text: "📝 No hay logs disponibles con los filtros especificados" }],
          };
        }
    
        const logsText = result.map(log => {
          const levelIcon = {
            info: 'ℹ️',
            warn: '⚠️', 
            error: '❌',
            debug: '🔍'
          }[log.level] || '📝';
          
          return `${levelIcon} **${log.timestamp}** [${log.component.toUpperCase()}] ${log.action}\n${JSON.stringify(log.details, null, 2)}`;
        }).join('\n\n');
    
        return {
          content: [{ 
            type: "text", 
            text: `📝 **Logs del Sistema (${result.length} entradas)**\n\n${logsText}`
          }],
        };
      }
    );
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. While it mentions the purpose ('para debugging'), it doesn't describe important behavioral traits: whether this is a read-only operation, what format the logs are returned in, whether there are rate limits, authentication requirements, or potential performance impacts. The description is minimal and lacks crucial 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.

Conciseness4/5

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

The description is a single, efficient Spanish sentence that communicates the core purpose. It's appropriately sized for a tool with clear parameters documented in the schema. While it could be more detailed given the lack of annotations, it doesn't waste words or include unnecessary information. The structure is straightforward and front-loaded with the main purpose.

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 (3 parameters, no annotations, no output schema), the description is insufficiently complete. It doesn't explain what the tool returns (log format, structure, or content), doesn't mention behavioral constraints, and provides minimal context beyond the basic purpose. For a debugging tool that likely returns structured data, more information about the output would be valuable to the 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?

The schema has 100% description coverage, so all parameters are documented in the schema itself. The description doesn't add any parameter-specific information beyond what's already in the schema descriptions. It mentions 'logs del sistema telefónico' which aligns with the tool's purpose but doesn't provide additional semantic context about the parameters. Baseline score of 3 is appropriate when schema does the heavy lifting.

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 verb ('obtener' - get/retrieve) and resource ('logs del sistema telefónico'), and specifies the purpose ('para debugging'). It distinguishes from siblings like phone_get_active_calls or phone_get_metrics by focusing specifically on system logs rather than call data or performance metrics. However, it doesn't explicitly differentiate from all siblings (e.g., phone_get_last_result might also return debugging information).

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 when this tool is appropriate (e.g., for troubleshooting specific issues) or when other tools might be better (e.g., phone_get_status for system status, phone_get_metrics for performance data). The 'para debugging' phrase hints at context but doesn't provide explicit usage guidelines.

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