Skip to main content
Glama

search_document

Read-onlyIdempotent

Search within a specified document to find matching text, returning relevant lines with context and approximate page numbers—so you can locate specific content without reading the entire file.

Instructions

Search for text within a document and return matching lines with context and approximate page numbers. Use this when you need to find specific content without reading the entire document. Read-only.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "filename": "<filename>",
      "query": "<query>"
    },
    "name": "search_document"
  }
}

Input Schema

NameRequiredDescriptionDefault
queryYesThe search query (case-insensitive)
filenameYesThe document filename to search
max_resultsNoMaximum matches to show (default 50, at most 500). The header always counts every match.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.4.1
    • addedInput schema / properties / max_results
      Added value: +{
      +  "default": 50,
      +  "description": "Maximum matches to show (default 50, at most 500). The header always counts every match.",
      +  "maximum": 500,
      +  "minimum": 1,
      +  "type": "integer"
      +}
  2. First observedv0.1.0

TDQS

A3.9/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, and destructiveHint=false, so the trailing "Read-only" is redundant. However, with no output schema, the description earns credit for disclosing what comes back: matching lines with surrounding context and approximate (not exact) page numbers, which is genuinely useful behavioral information.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three short sentences, front-loaded with purpose before usage guidance and result shape. The only waste is the closing "Read-only", which merely restates an annotation.

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 simple read-only search tool with full schema coverage and clear annotations, the description covers purpose, when to use it, and what results look like. Minor gaps remain, such as behavior when the file is missing or unsupported, but nothing essential for correct invocation is absent.

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 coverage is 100% and all three parameters are documented in the schema, including the case-insensitivity of query and the max_results cap with its header-counting quirk. The description adds no meaning beyond that, so baseline 3 applies.

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?

States a specific verb and resource (search text within a document) plus the shape of the result: matching lines with context and approximate page numbers. It implicitly distinguishes itself from read_document by contrasting full reading, though it never names that sibling explicitly.

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

Usage Guidelines4/5

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

"Use this when you need to find specific content without reading the entire document" gives a clear selection condition and implicitly points to read_document as the alternative for full reads. No explicit when-not or exclusion is stated, so it stops short of a 5.

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