Skip to main content
Glama

akb_grep

Search document contents for exact text or regex patterns. Returns matching documents and lines, supports count-only and files-with-matches modes, and can perform bounded find-and-replace.

Instructions

Search for exact text or regex patterns across document content. On a native Document backend, optionally include admitted searchable text Files with measurement_include_text_files=true; binary Files remain excluded. Unlike akb_search (semantic/meaning-based), this finds exact string matches — use it for specific terms, URLs, code snippets, version numbers, etc. Returns matching documents (each with its uri) and matched lines. Optionally pass replace to find-and-replace across all matching documents; the call writes nothing if the scope exceeds max_replacements. Three response shapes (mutually exclusive): default lines, count_only=true (grep -c — per-doc counts + total, no snippets), files_with_matches=true (grep -l — just the URIs that contain the pattern). The default shape always reports BOTH returned_* (what fit under limit) and total_* (full corpus matches) plus a truncated flag. When response safety bounds truncate snippets, the truncation object names the applied resource, match, and byte limits; use count_only for exact counts without snippets.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMax documents to return; does not limit replacement writes
regexNoTreat pattern as PostgreSQL regex. REQUIRED to use alternation (|), wildcards (.*), character classes, anchors, etc. When false (default), the entire pattern including any metacharacters is matched literally.
vaultNoLimit to a specific vault
patternYesNon-empty search pattern. By default matched as literal text (ILIKE) — metacharacters like |, ., *, (), [], +, ? are treated as literal characters. Set regex=true to enable PostgreSQL regex (required for alternation and wildcards).
replaceNoReplacement string. If provided and the full scope fits max_replacements, replaces all matches in EVERY matching document (git commit + re-index per doc); otherwise writes nothing. Treated literally when regex=false; supports regex backreferences (\1, \2) only when regex=true. For precise edits to a single known document, prefer akb_edit instead.
collectionNoLimit to a specific collection
count_onlyNoReturn counts only (grep -c semantics). Response: {pattern, total_matches, total_docs, by_doc:{uri:count,...}}. Use for 'how many X are there?' questions — much cheaper than fetching every line.
case_sensitiveNoCase-sensitive matching (default: case-insensitive)
_vault_skill_ackNoOpaque acknowledgement returned as vault_skill.ack_token. After applying that guide, retry the unchanged operation with this value. The bundled proxy supplies it automatically.
max_replacementsNoMaximum documents a replace call may rewrite, independent of the response limit. If the full scope matches more documents, the call fails before writing anything. Preview with count_only or files_with_matches, then set this budget to cover the intended scope.
files_with_matchesNoReturn only the URIs that contain matches (grep -l semantics). Response: {pattern, n_files, files:[uri,...]}. Use for 'which documents mention X?' questions.
measurement_include_text_filesNoNative mode: include admitted searchable text Files as well as Documents. File results include resource_type=file, their canonical akb:// URI, revision, and content_hash; native results also report payload_placement, the body placement their bytes were read from. Binary Files are never searchable. Rejected unless postgres_native or the exact guarded native measurement backend is active.

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Changed7 schema fields changedv2.0.14
    • addedInput schema / properties / _vault_skill_ack
      Added value: +{
      +  "description": "Opaque acknowledgement returned as vault_skill.ack_token. After applying that guide, retry the unchanged operation with this value. The bundled proxy supplies it automatically.",
      +  "maxLength": 128,
      +  "type": "string"
      +}
    • changedInput schema / properties / limit / description
      Previous value: -"Max documents to return"New value: +"Max documents to return; does not limit replacement writes"
    • addedInput schema / properties / max_replacements
      Added value: +{
      +  "default": 50,
      +  "description": "Maximum documents a replace call may rewrite, independent of the response limit. If the full scope matches more documents, the call fails before writing anything. Preview with count_only or files_with_matches, then set this budget to cover the intended scope.",
      +  "maximum": 1000,
      +  "minimum": 1,
      +  "type": "integer"
      +}
    • addedInput schema / properties / measurement_include_text_files
      Added value: +{
      +  "default": false,
      +  "description": "Native mode: include admitted searchable text Files as well as Documents. File results include resource_type=file, their canonical akb:// URI, revision, and content_hash; native results also report payload_placement, the body placement their bytes were read from. Binary Files are never searchable. Rejected unless postgres_native or the exact guarded native measurement backend is active.",
      +  "type": "boolean"
      +}
    • changedInput schema / properties / pattern / description
      Previous value: -"Search pattern. By default matched as literal text (ILIKE) — metacharacters like |, ., *, (), [], +, ? are treated as literal characters. Set regex=true to enable PostgreSQL regex (required for alternation and wildcards)."New value: +"Non-empty search pattern. By default matched as literal text (ILIKE) — metacharacters like |, ., *, (), [], +, ? are treated as literal characters. Set regex=true to enable PostgreSQL regex (required for alternation and wildcards)."
    • addedInput schema / properties / pattern / minLength
      Added value: +1
    • changedInput schema / properties / replace / description
      Previous value: -"Replacement string. If provided, replaces all matches in EVERY matching document across the search scope (git commit + re-index per doc). Supports regex backreferences (\\1, \\2) when regex=true. For precise edits to a single known document, prefer akb_edit instead."New value: +"Replacement string. If provided and the full scope fits max_replacements, replaces all matches in EVERY matching document (git commit + re-index per doc); otherwise writes nothing. Treated literally when regex=false; supports regex backreferences (\\1, \\2) only when regex=true. For precise edits to a single known document, prefer akb_edit instead."
  2. Addedv2.0.4
  3. Removedv2.0.1
  4. First observedv0.1.0

TDQS

A4.9/5.0
Behavior5/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It covers replacement safety ('writes nothing if the scope exceeds max_replacements'), the three mutually exclusive response shapes, the returned_*/total_*/truncated fields, and the truncation object. This is unusually complete for a tool with no annotation metadata.

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 dense but well organized: purpose first, backend nuance second, sibling comparison third, then output modes and truncation behavior. Every sentence earns its place, and the most decision-relevant information is front-loaded.

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

Completeness5/5

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

For a 12-parameter tool with no output schema, the description covers the key behaviors an agent needs: exact vs semantic search, file inclusion rules, replacement semantics, response shape selection, and truncation. The schema handles parameter-level details, so nothing critical is missing.

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 100%, so the baseline is 3. The description goes beyond the schema by explaining how count_only and files_with_matches alter the response shape, and by advising count_only when truncation may hide exact counts. This adds meaningful cross-parameter context even though individual parameter details live in the schema.

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 first sentence states a specific verb and resource: 'Search for exact text or regex patterns across document content.' It explicitly contrasts with akb_search ('Unlike akb_search... this finds exact string matches'), so an agent can distinguish it from the closest sibling without inspecting schemas.

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?

The description explicitly names the alternative (akb_search) and gives the selection condition: semantic/meaning-based vs exact string matches. It also provides concrete use cases ('specific terms, URLs, code snippets, version numbers'), making it clear when this tool is appropriate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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/dnotitia/akb'

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