Skip to main content
Glama

local_extract

Read-only

Extracts requested structured fields from large text or files as validated JSON using a local model, reading files server-side to avoid consuming Claude context.

Instructions

PREFER this tool over reading the file with Read when the file is large (>200 lines / >10 KB) and you only need structured fields, not the literal content.

Extracts structured fields from a text/file as JSON, with a local model.

Pass 'path' to read the file server-side (spends no Claude context) or 'text'. Returns an
object with exactly the requested keys, already validated: the caller does not have to parse
a string. What is not data travels under the reserved key `_local_delegate` (`truncated` and
`warning`, `read_server_side`, `fallback`, or `error` and `raw`); with chunked input, `chunked`
says how many pieces there were and which fields stayed null in all of them. Routes
automatically to the mechanical model (short inputs) or to the long-context model (large
documents): the size probe uses file bytes for 'path' and characters for 'text' (~5-10%
difference in UTF-8, acceptable).
By default it asks the backend for schema-constrained JSON (`LOCAL_DELEGATE_JSON_SCHEMA=auto`);
if the backend does not support it, it retries in free mode.

Args:
    fields: Names of the fields to extract (JSON keys).
    text: Source text (use this or 'path').
    path: Path to a source file (read server-side).

Input Schema

NameRequiredDescriptionDefault
pathNo
textNo
fieldsYes

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv0.16.0
    • addedOutput schema / additionalProperties
      Added value: +true
    • removedOutput schema / properties
      Removed value: -{
      -  "result": {
      -    "title": "Result",
      -    "type": "string"
      -  }
      -}
    • removedOutput schema / required
      Removed value: -[
      -  "result"
      -]
    • changedOutput schema / title
      Previous value: -"local_extractOutput"New value: +"local_extractDictOutput"
  2. First observedv0.2.0

TDQS

A4.6/5.0
Behavior4/5

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

Goes well beyond the readOnlyHint/openWorldHint annotations: discloses that server-side reads spend no Claude context, that output is validated to exactly the requested keys, that non-data travels under the reserved `_local_delegate` key (truncated, warning, read_server_side, fallback, error/raw), chunking behavior with per-field nulls, and the JSON-schema-then-free-mode retry. The only gap is that the LOCAL_DELEGATE_JSON_SCHEMA env-var detail and the ~5-10% UTF-8 size-probe caveat are more implementation trivia than agent-actionable behavior.

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?

Front-loaded with the routing directive, then behavior, then an Args block — good structure and no wasted framing. A few clauses (the size-probe byte-vs-character note, the env-var name) are internal detail an agent cannot act on and could be trimmed.

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?

Even though an output schema exists and return values needn't be explained, the description covers input modes, output shape, error/fallback signaling, chunking, and model routing. Nothing an agent needs in order to call it correctly 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?

With 0% schema description coverage the description must carry the load, and it does: 'fields' is defined as the JSON keys to extract, 'text' as source text, 'path' as a server-side-read file path, with an explicit 'use this or path' exclusivity hint. It stops short of stating what happens if both are supplied or neither is, which is the one ambiguity left.

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?

States a specific verb and resource ("Extracts structured fields from a text/file as JSON") plus the mechanism ("with a local model"), and explicitly distinguishes itself from the general file-reading path. An agent can tell this apart from local_summarize or local_classify without opening any 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?

Front-loads an explicit routing rule: prefer this over Read when the file is large (>200 lines / >10 KB) and only structured fields are needed rather than literal content. Both the when and the when-not are named, along with the alternative tool.

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