Skip to main content
Glama

Parse Standard Operating Procedure

parse_sop

Parses Standard Operating Procedure markdown files with YAML frontmatter into structured SopDocument objects; invalid files return validation errors, while unreadable paths raise file-access errors.

Instructions

Parse a Standard Operating Procedure markdown file (YAML frontmatter + body) from disk into a structured :class:~biz.dfch.specmgr.sop.models.v1.SopDocument. 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 Standard Operating Procedure base directory: a file in the flat docs/sop/ directory parses canonical (no heading-mapping table); a file in a direct two-letter docs/sop/{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 / SopFrontmatter / properties / status / enum
      Added value: +[
      +  "active",
      +  "approved",
      +  "draft",
      +  "retired",
      +  "review"
      +]
  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 does disclose real behavior: parse failures return a non-raising ValidateResult with valid=False and a 300-char-capped error instead of raising AssertionError/ValidationError/YAMLError, while an absent or unreadable path still raises an OSError-family exception. That failure-mode split is genuinely decision-relevant. It loses a point for burying this under internal citations (feat-110, ADR UUIDs, issue #204) that add noise rather than agent-usable context.

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 sentence, which is good. The remainder is one very long run-on sentence dense with parenthetical ADR hashes, feature IDs, and issue numbers that consume attention without helping the agent select or invoke the tool.

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 the return shape needn't be spelled out, and the description adds the failure-path semantics and path-based language resolution that the schema cannot convey. For a single-parameter parse tool this is close to complete; only the relative-vs-absolute path question and the missing sibling comparison remain.

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% and the single `path` property has only a title, so the description must compensate — and largely does, explaining that the file's language is derived from its position (flat docs/sop/ = canonical, direct two-letter docs/sop/{language}/ = language table, anything else = canonical) plus the ValueError when no table exists. It stops short of saying whether the path is absolute or repository-relative, which matters for constructing a valid call.

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 first sentence gives a specific verb, resource, and target type: 'Parse a Standard Operating Procedure markdown file (YAML frontmatter + body) from disk into a structured SopDocument'. 'From disk' implicitly separates it from retrieval-style siblings like get_sop, but no sibling is named, so the differentiation is left for the agent to infer.

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 implied rather than stated: the description makes clear this reads a file from a path, contrasting with the `validate` tool's 300-char error cap. There is no explicit 'use this when / don't use this when' guidance and get_sop, list_sop, and validate are never positioned against it.

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