publish_sop
Publish new or updated Standard Operating Procedure (SOP) documents. Enforces lint rules so errors block publication, and auto-increments versions.
Instructions
Publish a new or updated Standard Operating Procedure document.
The content parameter MUST contain the complete SOP markdown string with YAML frontmatter declaring:
name (required, snake_case, ≥3 underscore segments — the SOP's identity)
owner (required, non-empty string — team, alias, or email. This is the point of contact surfaced when feedback is submitted or a mismatch is detected during review. Pick a name you want pinged.)
stage (required, 'preprod' or 'prod' — informational lifecycle label; see the
stageargument below for mismatch behaviour)version (required, positive integer — advisory revision counter. The tool auto-bumps on each publish (+1), but we ask authors to declare it explicitly so a mismatch between the file on disk and what the author thinks they are updating is visible in the response)
description (optional — when omitted, the SOP's
## Overviewsection is used for short summaries)
Version & stage mismatch: the tool never trusts the frontmatter values blindly. The stage argument wins over the frontmatter stage, and the version is computed server-side (max existing + 1). Both values are overwritten in the stored content so the file on disk always reflects what actually happened. If you pass a version or stage that disagrees with the final stored values, the response surfaces the difference under warning so you can decide whether you were editing the right version.
Example call: {"content": "---\nname: my_sop_name\nversion: 1\nowner: my-team\nstage: preprod\n---\n\n# My SOP\n\n## Overview\nOverview text.\n\n### Step 1: First step\nDo the thing."}
Versioning: plain positive integers — 1, 2, 3, 4, … New SOPs start at 1; each subsequent publish increments by one. No semver.
Lint enforcement: every publish runs the same rule engine as the standalone sop-lint CLI. Errors (SOP rules at severity=error) BLOCK the publish — the tool raises and nothing is written. Warnings are returned under the warning field but do not block. Iterate locally with sop-lint <file> before calling publish_sop to avoid MCP round-trip latency.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| stage | Yes | Deployment stage: 'preprod' or 'prod' | |
| content | Yes | Complete SOP markdown with YAML frontmatter (name, owner, stage, version) |