search_logs
Search terminal process logs using keywords or regex patterns to find specific information within captured output.
Instructions
Search logs for a keyword or regex
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Process identifier | |
| keyword | Yes | Keyword or regex to search for | |
| regex | No | Use regex search (optional) |
Implementation Reference
- src/processManager.ts:106-124 (handler)The actual implementation of the log search logic within the ProcessManager class.
async searchLogs(input: { id: string; keyword: string; regex?: boolean }): Promise<{ id: string; matches: 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 matches = await this.logService.searchLog( logFile, input.keyword, input.regex ); return { id: input.id, matches }; } - src/index.ts:65-76 (registration)Tool registration for 'search_logs' in the MCP server setup.
name: 'search_logs', description: 'Search logs for a keyword or regex', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Process identifier' }, keyword: { type: 'string', description: 'Keyword or regex to search for' }, regex: { type: 'boolean', description: 'Use regex search (optional)' }, }, required: ['id', 'keyword'], }, }, - src/index.ts:106-109 (handler)The request handler branch that executes the 'search_logs' tool.
case 'search_logs': { const result = await processManager.searchLogs(args as any); return { content: [{ type: 'text', text: JSON.stringify(result) }] }; } - src/types.ts:31-40 (schema)Input and output type definitions for the 'search_logs' tool.
export interface SearchLogsInput { id: string; keyword: string; regex?: boolean; } export interface SearchLogsOutput { id: string; matches: string[]; }