Skip to main content
Glama

Parse decision

parse_dec

Parse a decision markdown file from disk into a structured document, returning a non-raising validation result for parse failures in existing files while preserving file-access errors.

Instructions

Parse a decision markdown file (YAML frontmatter + body) from disk into a structured :class:~biz.dfch.specmgr.dec.models.v1.DecDocument. 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 decision base directory: a file in the flat docs/dec/ directory parses canonical (no heading-mapping table); a file in a direct two-letter docs/dec/{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. Changed1 schema field changedv0.37.0
    • addedOutput schema / $defs / DecFrontmatter / properties / status / enum
      Added value: +[
      +  "accepted",
      +  "deprecated",
      +  "draft",
      +  "proposed",
      +  "rejected",
      +  "superseded"
      +]
  2. First observedv0.36.0

TDQS

A3.8/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 load and does so exceptionally: a parse failure returns a non-raising ValidateResult with valid=False and a 300-char-capped error message instead of raising AssertionError/ValidationError/YAMLError, while an absent or unreadable path still raises FileNotFoundError/PermissionError/OSError from Path.read_text(). It also discloses that language is derived from the file's path position, including the actionable ValueError when no mapping table exists.

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 purpose is front-loaded in the first clause, which is good, but the remainder is one dense run-on paragraph loaded with ADR UUIDs, feat-110, GitHub issue #204, and 'case 5 of the ADR ... workaround chain' — provenance noise an agent gains nothing from. The behavioral rules are valuable; the references around them are not.

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, so return-shape explanation is unnecessary, and the description still covers the two things the schema cannot: failure semantics (non-raising ValidateResult vs OSError family) and language-derivation rules from path position. For a one-parameter parse tool, nothing an agent needs to invoke 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?

The schema has 0% description coverage — 'path' is just a bare string — but the description compensates by explaining that the path's position relative to the decision base directory determines parsing behavior (flat docs/dec/ = canonical, docs/dec/{language}/ = mapped, anything else = canonical). That adds genuine semantics beyond the schema, though the base-directory value itself is never stated.

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 uses a precise verb+resource ('Parse a decision markdown file (YAML frontmatter + body) from disk') and names the concrete return type, DecDocument, so the agent knows exactly what the tool produces. It stops short of explicitly distinguishing itself from parse-siblings or from get_dec/list_dec, which keeps it at 4 rather than 5.

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

Usage Guidelines2/5

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

There is no statement of when to use this versus get_dec, list_dec, or validate, all of which appear in the sibling list. The single mention of the 'validate tool' is about error-message capping, not about choosing between the two tools. Usage must be inferred from the purpose sentence alone.

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