Create Standard Operating Procedure
create_sopCreate a Standard Operating Procedure by assigning an ID, deriving the filename from the body H1 title, validating content, and writing it to the SOP directory; supports translated variants.
Instructions
Create a new Standard Operating Procedure: assigns a fresh id, derives a filename from the body's H1 title, validates the submitted body-only content, and writes the new document to the SOP base directory. A content-validation failure of the submitted body 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 (ADR f14f125e-eaad-4f4f-a6fd-3c931bed726e, GitHub issue #204 -- case 5 of the ADR 519d1206 non-raising-structured-result workaround chain); nothing is written in that case. The structure reference is the get_sop_schema tool (the generated JSON Schema); the get_sop_template/get_sop_example tools return the authoring template and a complete sample. Returns the newly created document's frontmatter only (no body); use the corresponding get_sop tool to fetch the full document afterward. The optional language parameter (default 'en', feat-197-i18n) selects the language to create the document in: omitted/'en' = a new flat docs/sop/ document with a fresh id, exactly the default behavior (id must then be omitted); a non-default ISO 639-1-shaped lowercase two-letter code (e.g. 'de') creates a TRANSLATION of an existing Standard Operating Procedure instead: id -- the shared id of the existing EN source document -- is then required (no fresh id is assigned; the variant carries the same id), the EN source must exist (else SopNotFoundError), and the variant is written to docs/sop/{language}/ under the EN source's exact file name with status draft; content is validated through that language's heading-mapping table (translated headings are accepted) and persisted verbatim. An existing variant of that id and language is never overwritten (FileExistsError). A malformed language, one with no packaged heading-mapping table, a missing id for a non-default language, or an id given for the default language is a ValueError raised before any file access.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | ||
| content | Yes | ||
| language | No | en |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |