Skip to main content
Glama

Get Standard Operating Procedure

get_sop

Read and parse a full SOP document by ID, or return its raw body text verbatim with optional offset/limit windows, language variants, and line numbering.

Instructions

Read, parse, and return a full SOP document (frontmatter and body) by its id. Pass raw=True to return the frontmatter-stripped body text verbatim instead. With raw=True, optional read-style offset/limit window the raw read: offset (1-based, default 1) is the first body line to return, limit (line count, default through end of body) how many; out-of-range values clamp (offset > N returns the empty string), and coordinates with raw=False raise ValueError. A document that exists but fails to parse returns a ParseFailureResult (error/path/id) instead of raising; its error text is byte-identical to the domain's own list tool's failed-row error for the same file (identical field path and cause, including the trailing pydantic documentation line; ADR 9080b37c-82b3-4f63-81f1-79641d0bf14c). An invalid id (path-injection attempt or wrong format) is also a ValueError, raised before any file access. With raw=True, an optional numbered=True prefixes every returned body line with its 1-based absolute body-line number in the "<n>: " form (plain decimal, no padding) -- under offset/limit windowing the numbers start at the clamped offset and never restart at 1, so a number seen in the output can be fed straight back into the generic update tool's offset. numbered is meaningful only with raw=True: combining it with raw=False raises ValueError (like offset/limit), and a numbered read of a document that fails to parse returns the ParseFailureResult described above, never numbered text. Numbered output must never be fed back verbatim into content for update or create_sop -- strip the "<n>: " prefix from each line first (it is likewise never a valid edit old_str). The optional language parameter (default 'en') selects the language variant to read: omitted/'en' = the flat docs/sop/ document, exactly the default behavior; any other ISO 639-1-shaped lowercase two-letter code (e.g. 'de') = that language's variant at docs/sop/{language}/ (the EN source's exact basename). The language is shape-validated before any file access (a path-injection-shaped payload is a ValueError, like an invalid id), and a shape-valid language without a packaged heading-mapping table is rejected up front with an actionable ValueError, also before any file access. A raw=True read of a variant returns the variant's on-disk body verbatim (translation preserved); a raw=False read parses it through the variant's heading table, so the structured model holds canonical heading text. The ParseFailureResult error of a broken variant is byte-identical to list_sop(language=...)'s failed row for the same file.

Input Schema

NameRequiredDescriptionDefault
idYes
rawNo
limitNo
offsetNo
languageNoen
numberedNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.38.0
    • addedInput schema / properties / language
      Added value: +{
      +  "default": "en",
      +  "title": "Language",
      +  "type": "string"
      +}
  2. Changed1 schema field changedv0.37.0
    • addedOutput schema / $defs / SopFrontmatter / properties / status / enum
      Added value: +[
      +  "active",
      +  "approved",
      +  "draft",
      +  "retired",
      +  "review"
      +]
  3. First observedv0.36.0

TDQS

A4.6/5.0
Behavior5/5

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

No annotations are supplied, so the description carries the full load and does so: it states that a malformed document returns a ParseFailureResult rather than raising, that an invalid id raises ValueError before any file access, that out-of-range offset/limit clamp, and that invalid flag combinations raise ValueError. It even warns that numbered text must never be fed back into content/old_str, which is exactly the kind of destructive-misuse context an agent needs.

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, but the remainder is one long run-on block with nested parentheticals, ADR citations, and a byte-identical-error guarantee that could be compressed. Almost every sentence carries real information, yet scannability suffers for a getter with six parameters.

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?

For a read tool with a large parameter surface, no annotations, and an output schema that handles return values, the description covers the risky edges: parse failures, injection validation ordering, clamping, and flag-combination errors. Nothing an agent needs in order to call it correctly is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/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 for five of six parameters: raw, offset (1-based, default 1, clamping), limit (line count, default through end), numbered ("<n>: " prefix, absolute numbering that continues across windows), and language (ISO 639-1 shape validation, variant path, heading-table requirement). Only `id`'s format is left as an unelaborated "wrong format".

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?

"Read, parse, and return a full SOP document (frontmatter and body) by its id" gives a specific verb, resource, and scope, and the raw=True branch defines the alternate output precisely. An agent can tell what it gets (parsed model vs verbatim body) without opening the schema.

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 description spells out selection conditions well: default parses, raw=True returns the body, offset/limit only apply under raw=True, numbered only with raw=True, language='en' vs a two-letter variant. It never contrasts get_sop with sibling parse_sop or list_sop directly, which is the remaining gap.

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