Skip to main content
Glama

find_text

Locate a known text fragment on a PDF sheet and return its image-pixel coordinates, optionally within a region and capped by a hit limit.

Instructions

LOCATE a known string on a sheet — the complement to read_sheet_text (which returns what a region SAYS; this finds WHERE a string you already know sits). Case-insensitive substring match against each pdf.js text run, so a room label split across runs ("OFFICE" then "134" as separate items) needs a find_text call per fragment, or read_sheet_text over a region to see the whole thing joined. Every hit tells you which room a polygon belongs to — the locate-then-trace workflow: find_text the room number, then measure_polygon (One-Click is temporarily gated on this server) on that room's wall faces. Optionally restrict to a region {x0, y0, x1, y1}; results cap at limit (default 200), with count/truncated telling you exactly how much a tighter region or higher limit would recover. Coordinates are image px at render scale 2.0: PDF pt × 2, origin top-left, y down (the browser canvas's native space). Sheet payloads carry dims in both px and pt.

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": {
      "sheet": "<sheet>",
      "q": "<q>"
    },
    "name": "find_text"
  }
}

Input Schema

NameRequiredDescriptionDefault
qYesText to find — a room number ('134'), a label fragment ('RECEPTION'), a schedule tag ('CPT-1')
limitNoMax hits returned
sheetYes
regionNoRect in image px (origin top-left, y down); omit for the full sheet

Output Schema

NameRequiredDescriptionDefault
qYes
hitsYes
countYesTotal matches before the limit cap
sheetYes
truncatedYestrue = count exceeds hits.length; narrow the region or raise limit

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv0.1.31
    • removedInput schema / additionalProperties
      Removed value: -false
    • removedInput schema / properties / region / additionalProperties
      Removed value: -false
    • addedOutput schema / properties / count / maximum
      Added value: +9007199254740991
    • addedOutput schema / properties / count / minimum
      Added value: +-9007199254740991
    • addedOutput schema / properties / hits / items / properties / bbox / additionalItems
      Added value: +false
    • addedOutput schema / properties / hits / items / properties / center / additionalItems
      Added value: +false
  2. Addedv0.1.6

TDQS

A4.5/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well: it discloses case-insensitive substring matching against individual pdf.js text runs, the resulting per-fragment limitation, the 200-hit default cap, and that count/truncated reveal recoverable volume. It stops short of stating that the call is read-only/no-side-effect and says nothing about failure behavior for a bad sheet reference.

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

Conciseness3/5

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

The core distinction and the fragmentation caveat are front-loaded, which is good, but the text sprawls into a long locate-then-trace sentence and an aside that "One-Click is temporarily gated on this server" — server-state trivia that does not help the agent decide or invoke. The coordinate-space sentence duplicates ground likely covered by sheet payloads.

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?

An output schema exists, yet the description still flags the two things an agent would otherwise misread from results: fragment-per-run duplication and truncated/count semantics. Combined with the coordinate space and the follow-on workflow, nothing needed for a first-correct call 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 75%, and the description adds real meaning on top: the region rect is defined as image px at render scale 2.0 with top-left origin and y down (PDF pt × 2), and limit's effect is tied to the count/truncated fields so the agent knows how to widen or narrow. The q semantics of fragment-level matching also go beyond the schema's three examples.

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?

"LOCATE a known string on a sheet" is a specific verb plus resource, and the description immediately contrasts it with read_sheet_text ("which returns what a region SAYS; this finds WHERE a string you already know sits"). An agent can distinguish the two without opening either schema.

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?

Explicit routing rules are given: use read_sheet_text to see joined text of a region, use find_text when the string is already known and only the location is needed. It also names the downstream step ("find_text the room number, then measure_polygon ... on that room's wall faces") and when to add a region.

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