Skip to main content
Glama

Parse free-form text

parse_txt

Parse markdown files with YAML frontmatter and body from disk into a structured document; invalid content returns a validation result instead of raising.

Instructions

Parse a free-form text markdown file (YAML frontmatter + body) from disk into a structured :class:~biz.dfch.specmgr.txt.models.v1.TxtDocument. An existing file that fails to parse returns a non-raising ValidateResult (valid=False, a single errors[].message capped at 300 chars as the generic validate tool caps it, feat-110) instead of raising AssertionError/pydantic.ValidationError/yaml.YAMLError (ADR f14f125e-eaad-4f4f-a6fd-3c931bed726e, GitHub issue #204 -- case 5 of the ADR 519d1206 non-raising-structured-result workaround chain); a truly-absent or unreadable path still raises the OSError-family file-access error (FileNotFoundError/PermissionError/OSError) from Path.read_text(). The file's language is derived from its path position relative to the free-form text base directory: a file in the flat docs/txt/ directory parses canonical (no heading-mapping table); a file in a direct two-letter docs/txt/{language}/ subdirectory parses through that language's table (an actionable ValueError when no table exists for the language); any other location parses canonical.

Input Schema

NameRequiredDescriptionDefault
pathYes

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.38.0

TDQS

A4.2/5.0
Behavior5/5

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

With no annotations supplied, the description carries the full burden and does so thoroughly: a parse failure on an existing file returns a non-raising ValidateResult (valid=False, single errors[].message capped at 300 chars) instead of raising AssertionError/ValidationError/YAMLError, while an absent or unreadable path still raises FileNotFoundError/PermissionError/OSError from Path.read_text(). It also discloses the language-table resolution rule and the actionable ValueError when a table is missing.

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?

Core purpose is front-loaded, which is good, but the body is a single dense run-on with embedded ADR UUIDs (f14f125e..., 519d1206) and issue/feature tags (feat-110, #204) that add little for an agent selecting the tool. The substantive behavioral content earns its place; the internal tracker references do not.

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-shape explanation is optional, yet the definition still covers the important success/failure split and language resolution for a tool with non-trivial error paths. Minor omissions (encoding assumptions, whether it writes anything back to disk) keep it short of a 5.

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 0%, so the description must supply the meaning of 'path' — and it does, explaining that the file's language is derived from its position relative to the free-form text base directory (flat docs/txt/ = canonical, docs/txt/{language}/ = table-mapped, anything else = canonical). It never states explicitly whether an absolute path is accepted, which is the remaining gap.

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?

Opens with a specific verb and resource: 'Parse a free-form text markdown file (YAML frontmatter + body) from disk into a structured ... TxtDocument'. This clearly separates it from the read-only get_txt/list_txt siblings and from the other parse_* tools that target different document types.

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

Usage Guidelines3/5

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

The purpose implies when to use it (you need a structured object from a .txt file on disk rather than raw content), but there is no explicit statement of when to prefer get_txt, get_txt_schema, or validate instead. Guidance is inferred rather than stated.

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

Deploy Server

Other Tools