Skip to main content
Glama

extract_from_file

Extract structured JSON from files using your schema and instructions, with grep to narrow large inputs and checks that flag values not found in the source.

Instructions

Structured data from a file, in the JSON schema you give (as a string).

Example: a pin table from a datasheet, the failing tests from a log, the parts of a BOM. Values the file does not give come back as null. grep narrows a large file first. Every extracted string and number is looked up in the file: those that are not there are listed after the data, so an invented value is visible.

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": {
      "path": "<path>",
      "json_schema": "<json_schema>",
      "instructions": "<instructions>"
    },
    "name": "extract_from_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
grepNo
pathYes
json_schemaYes
instructionsYes

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv3.0.1

TDQS

A3.9/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 that absent values return null, that grep can prefilter large files, and that every extracted string and number is verified against the file with unverifiable values listed after the data. That verification/hallucination-surfacing behavior is exactly the kind of context structured fields cannot convey. It omits cost, size limits, and failure modes.

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?

The core capability is front-loaded in the first line and each following sentence adds a distinct fact: examples, null behavior, grep prefiltering, verification. Some sentences are telegraphic ('grep narrows a large file first'), but nothing is wasted.

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?

An output schema exists, so return values need not be spelled out, yet the description still explains null handling and the unverified-value listing. For a moderately complex four-parameter extraction tool, the main remaining hole is the unexplained 'instructions' parameter and any input-size limits.

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 description coverage is 0% across four parameters, so the description must compensate. It explains json_schema ('the JSON schema you give, as a string'), grep ('narrows a large file first'), and implies path, but the required 'instructions' parameter is never explained, leaving a meaningful gap.

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?

The description opens with a specific verb+resource+output shape: structured data extracted from a file, conforming to a caller-supplied JSON schema. Concrete examples (pin table from a datasheet, failing tests from a log, BOM parts) pin down the intent precisely. It does not differentiate itself from siblings such as digest_file, so it falls short of a 5.

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?

The examples implicitly define the use case (schema-shaped extraction from a single file), and 'grep narrows a large file first' is a genuine operational guideline for large inputs. There is no explicit when-not guidance or named alternative for cases where a plain digest would be better.

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