Skip to main content
Glama

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
NameRequiredDescriptionDefault
idYesProcess identifier
keywordYesKeyword or regex to search for
regexNoUse regex search (optional)

Implementation Reference

  • 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'],
      },
    },
  • 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) }] };
    }
  • 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[];
    }
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 for behavioral disclosure. While 'search' implies a read operation, the description doesn't disclose important behavioral traits like whether this requires authentication, has rate limits, returns paginated results, or what happens with invalid inputs. It provides minimal context beyond the basic operation.

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 with zero wasted words. It's appropriately sized for a search tool and front-loads the essential information. Every word earns its place by contributing to understanding the tool's 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 no annotations, no output schema, and a search operation that likely returns complex results, the description is insufficient. It doesn't explain what format results come in, whether they're filtered/ranked, error conditions, or performance characteristics. For a search tool with 3 parameters and no structured output documentation, more context is needed about the operation's behavior and results.

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%, so the schema already documents all three parameters thoroughly. The description mentions 'keyword or regex' which aligns with the 'keyword' parameter description, but adds no additional semantic context beyond what's in the schema. With complete schema coverage, the baseline of 3 is appropriate as the description doesn't significantly enhance parameter understanding.

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 tool's purpose with a specific verb ('search') and resource ('logs'), and specifies the search target ('keyword or regex'). It distinguishes from sibling 'get_logs' by implying filtering/searching rather than retrieval, but doesn't explicitly differentiate. The description is not tautological and provides meaningful information about what the tool does.

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 like 'get_logs' or 'list_processes'. There's no mention of prerequisites, context for usage, or exclusions. The agent must infer usage from the tool name and description alone without any explicit guidance.

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

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