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
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Process identifier | |
| lines | No | Number of lines to return (optional) |
Implementation Reference
- src/processManager.ts:91-104 (handler)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'], }, }, - src/index.ts:102-105 (handler)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) }] }; }