Skip to main content
Glama

evaluate_compliance_policy

Read-onlyIdempotent

Evaluate already-retrieved device data against a compliance policy. Returns pass/fail/skipped counts and per-rule results without any additional data fetching.

Instructions

Evaluate already-retrieved observations against a declarative compliance policy.

Pure, bounded, read-only evaluation only -- this never calls invoke_tool/invoke_read_tool or any backend itself, and never fetches anything. Fetch device/config/inventory state first (e.g. one or more invoke_read_tool results), then pass the already-retrieved data here as observations alongside a declarative policy. The architecture is inspired by NAPALM's compliance_report (a fixed comparison- operator dispatch table evaluated over structured state) and by Nornir-style aggregate run counts, but is implemented independently in pipeline/compliance.py with this repository's own bounds and conventions -- no eval/exec, no arbitrary expressions, no dynamic imports, and no write/destructive tool is ever reachable from here.

Args: observations: bounded (max 100) list of objects, one per device/ entity already retrieved by the caller (e.g. a single invoke_read_tool result, or one element of a list response). Never fetched by this tool. policy: bounded (max 50) list of rule objects, each with "field" (a dotted/indexed path, e.g. "interfaces[0].status" or "firmware.version" -- Mapping key lookup and Sequence integer indexing only, never eval/attribute access), "operator" (one of "eq", "ne", "lt", "le", "gt", "ge", "contains", "in", "regex_fullmatch", "version_gte", "version_range", "exists", "not_exists"), and "expected" (required for every operator except exists/not_exists). Optional per-rule "id" (defaults to "rule_"), "severity" ("critical"/"error"/"warning"/ "info", default "error", informational only -- it does not change pass/fail logic), and "optional" (bool, default False -- a missing field on an optional rule is reported "skipped" instead of "error"). A structurally invalid policy (unknown operator, malformed field path, an "expected" shape that does not match its operator, an unparsable regex/ version value, or exceeding a bound) is rejected before any observation is evaluated. policy_id: free-text label carried through into the report and artifact only. max_result_entries: bounded per-rule result detail cap (default 200, max 500). Aggregate counts always reflect the true total even when the detail list is capped -- see "results_truncated"/"results_total".

Returns "ok", "compliant" (True only when every rule for every observation passed or was explicitly skipped -- never True while any "fail"/"error" result exists), "counts" (pass/fail/error/skipped totals), "observations" (per-observation compliant flag + counts), "results" (bounded per-rule detail), "results_total"/ "results_truncated", and "artifact" (a compliance_report-shaped payload suitable for pipeline.artifact_contracts.write_artifact -- never written to disk by this tool). A structurally invalid policy/ observations input fails closed with "ok": False and a bounded "error" message before any rule evaluation begins.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
policyYes
policy_idNoad-hoc
observationsYes
max_result_entriesNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

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

Annotations already indicate readonly, idempotent, non-destructive. The description reinforces this with 'pure, bounded, read-only evaluation only' and details bounds, error handling, and lack of write operations. No contradiction.

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?

The description is lengthy but well-structured with clear sections. It front-loads purpose and provides detailed arg descriptions. Slightly verbose but every sentence adds value.

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?

Given the tool's complexity (4 params, output schema exists), the description covers all necessary context: return shape, bounds, error behavior, artifact handling. Complete without gaps.

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%, but the description compensates fully by explaining each parameter: observations (bounded list), policy (detailed structure with field/operator/expected), policy_id (free-text label), max_result_entries (default+max).

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?

The description clearly states the tool evaluates already-retrieved observations against a compliance policy. It distinguishes itself from data-fetching tools by explicitly noting it never fetches data itself.

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 explicitly says to fetch data first using invoke_read_tool, then pass it here. It gives guidance on what not to do (no backend calls). However, it does not compare with sibling tools like plan_reconciliation_schedule.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/secure-ssid/centralmcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server