Skip to main content
Glama

regex_search

Apply a JavaScript regex to file bodies across projects or knowledge base, returning per-file hits with line numbers. Use when standard search misses substrings, URLs, or code identifiers.

Instructions

Match a JS regex against the body of every file in scope (project, KB, or all) and return per-file hits with line numbers. Slower than FTS search because it reads each file's content; use only when FTS misses substrings, URLs, or code identifiers. Read-only; no side effects, auth, or rate limits. Capped at 500 files / 10 hits per file by default; the response reports files_truncated and per-file truncation so the agent can re-scope. project_id: null = KB only; omit = everywhere. Invalid regex throws.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
patternYesJavaScript RegExp source
project_idNoScope to one project, null for KB-only, omit for everything
case_insensitiveNo
max_filesNoCap on files scanned (default 500)
max_matches_per_fileNoPer-file hit cap (default 10)
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description covers all behavioral aspects: read-only with no side effects, authentication, or rate limits. It specifies default caps (500 files, 10 hits per file), truncation reporting, and error behavior ('invalid regex throws').

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?

All sentences are essential and contribute information. The core purpose is front-loaded, and the description efficiently covers usage, behavior, caps, and errors without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 5 parameters, no output schema, and no annotations, the description covers scope, caps, error handling, and side effects. However, it lacks explicit detail about the response format (e.g., an array of objects with file, line numbers, matches). This minor gap prevents a perfect score.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 80% (4 of 5 parameters have descriptions). The description adds value by explaining default caps (500/10), truncation behavior, and project_id semantics (null=KB, omit=everywhere). However, case_insensitive is not mentioned in description, missing an opportunity.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Match a JS regex against... files in scope... return per-file hits with line numbers,' specifying the verb, resource, and output. It distinguishes from sibling 'search' by noting it reads file contents.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly advises when to use: 'use only when FTS misses substrings, URLs, or code identifiers' and contrasts with FTS. Also explains scope options via project_id parameter.

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/safiyu/kontexta'

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