Skip to main content
Glama

Parse QA document

parse_qa

Parse a QA document Markdown file from disk into a structured QaDocument, returning validation errors for invalid content instead of raising exceptions.

Instructions

Parse a QA document markdown file (YAML frontmatter + body) from disk into a structured :class:~biz.dfch.specmgr.qa.models.v2.QaDocument. 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 QA document base directory: a file in the flat docs/qa/ directory parses canonical (no heading-mapping table); a file in a direct two-letter docs/qa/{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. Changed2 schema fields changedv0.37.0
    • addedOutput schema / $defs / QaFrontmatter / properties / status / enum
      Added value: +[
      +  "active",
      +  "cancelled",
      +  "done",
      +  "draft"
      +]
    • addedOutput schema / $defs / QaQuestionAnswer / properties / question / pattern
      Added value: +"^\\*\\*\\d\\.\\d{4}\\*\\*:\\s"
  2. First observedv0.36.0

TDQS

A3.7/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 largely meets it: it discloses that parse failures return a non-raising ValidateResult (valid=False, errors[].message capped at 300 chars) while missing or unreadable paths still raise FileNotFoundError/PermissionError/OSError. That is exactly the kind of failure-mode detail an agent needs before calling. It stops short of stating whether the parse has any side effects (read-only assumption is left implicit).

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 single paragraph is front-loaded with the core action and error contract, which is good, but it is freighted with internal traceability noise — feat-110, an ADR UUID, GitHub issue #204, 'case 5 of the ADR 519d1206 ... chain' — that costs an agent tokens without changing how it calls the tool. The language-derivation clause is valuable but buried at the end.

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?

For a one-parameter read tool with an output schema, the definition covers what an agent needs: what it parses, where the file must live, how language selection works, and which failure modes raise versus return a result. Only minor gaps remain, such as whether repeated parses are idempotent and any implicit read-only guarantee.

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 description coverage is 0%, so the description must compensate, and it does: it explains that the path's position determines behavior — flat docs/qa/ parses canonical, a two-letter docs/qa/{language}/ subdirectory applies that language's heading-mapping table, and an unsupported language raises an actionable ValueError. That meaning is entirely absent from the bare {path: string} schema.

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 and resource ('Parse a QA document markdown file (YAML frontmatter + body) from disk') and names the resulting type, QaDocument. The 'from disk' framing implicitly separates it from repo-reading siblings like get_qa/list_qa, but it never names an alternative explicitly, so the sibling distinction is inferred rather than stated.

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?

Usage is only implied: an agent can infer this tool is for turning an on-disk QA markdown file into a model object. There is no explicit 'use this instead of get_qa' or 'use validate for X' guidance, and no stated prerequisites or when-not-to-use conditions.

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