Skip to main content
Glama

format_rules

Rewrite Sigma YAML into a canonical layout while preserving comments, anchors, aliases, tags, and directives; a semantic guard verifies values before returning or saving the result.

Instructions

Rewrite Sigma YAML into the canonical layout: four-space indentation, block collections, canonical key order, and normalized scalar quoting. Comments keep their text and their attachment, and anchors, aliases, tags, and directives are preserved. A semantic guard reparses the result and refuses the rewrite unless YAML values, parsed rules, correlations, filters, parser diagnostics, comment attachment, anchors, aliases, tags, directives, and action values all match. Returns the formatted YAML and whether it changed. Non-Sigma documents are reported as skipped. With write: true (only valid with a file path, and only when the server runs with --rules-dir) the change is persisted to disk.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "format_rules"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathNoPath to a single Sigma YAML file. Mutually exclusive with `yaml`.
yamlNoInline Sigma YAML. Mutually exclusive with `path`.
writeNoPersist the formatted YAML back to disk. Only valid with a `path` input, and only when the server has a rules root (`--rules-dir`).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.27.0

TDQS

A4.2/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 well: it discloses the reparse-and-refuse guard, the exact list of properties that must match, the fact that comments and anchors/aliases/tags/directives are preserved, that unmatched documents are reported as skipped, and that write causes on-disk persistence. The only gap is the absence of any note on error or failure reporting beyond the refusal behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core action, then guard behavior, then return value, then the write caveat — a sensible order with no filler. The property-match list in the guard sentence is long but each item is substantive; a slight trim would improve density.

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 three-parameter, annotation-free transformation tool with no output schema, the description covers inputs, side effects, failure mode, return value ('formatted YAML and whether it changed'), and skip behavior. Nothing an agent needs in order to call it safely is missing.

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

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% and the schema already documents path/yaml mutual exclusivity and the write preconditions, so the description mostly restates them ('only valid with a file `path`, and only when the server runs with --rules-dir'). It adds no syntax, path-format, or default-input guidance beyond what the schema provides, so baseline 3 applies.

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?

States a specific verb and resource ('Rewrite Sigma YAML into the canonical layout') and enumerates exactly what canonical means: four-space indentation, block collections, key order, normalized quoting. An agent can distinguish this from sibling tools like fix_rules or convert_rules because the description is about layout normalization with a semantic equivalence guard, not rule repair or format conversion.

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?

Gives clear conditional guidance for the risky path: write is only valid with a file path and only when the server runs with --rules-dir, and non-Sigma documents are skipped rather than errored. It does not explicitly name which sibling to use instead for repairing rule logic or converting formats, so the when-not guidance is implied rather than stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.