Skip to main content
Glama

get_logs

Retrieve process logs from terminal sessions to monitor application behavior and troubleshoot issues. Specify a process identifier to access recent log entries.

Instructions

Get logs from a process

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesProcess identifier
linesNoNumber of lines to return (optional)

Implementation Reference

  • The getLogs function in ProcessManager class handles retrieving log contents from a file associated with a process.
    async getLogs(input: { id: string; lines?: number }): Promise<{ id: string; logs: string }> {
      const logFile = this.logFiles.get(input.id);
    
      if (!logFile) {
        throw new Error(`Process '${input.id}' not found`);
      }
    
      if (!fs.existsSync(logFile)) {
        throw new Error(`No logs found for process '${input.id}'`);
      }
    
      const logs = await this.logService.readLog(logFile, input.lines);
      return { id: input.id, logs };
    }
  • src/index.ts:53-63 (registration)
    Definition of the get_logs tool in the MCP server registration.
      name: 'get_logs',
      description: 'Get logs from a process',
      inputSchema: {
        type: 'object',
        properties: {
          id: { type: 'string', description: 'Process identifier' },
          lines: { type: 'number', description: 'Number of lines to return (optional)' },
        },
        required: ['id'],
      },
    },
  • The server request handler calls processManager.getLogs when the 'get_logs' tool is invoked.
    case 'get_logs': {
      const result = await processManager.getLogs(args as any);
      return { content: [{ type: 'text', text: JSON.stringify(result) }] };
    }

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/h004888/mcp_terminal_process'

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