Skip to main content
Glama

audit_query

Query read-only audit data by time, rule, exit code, or causal chain. Trace decision-log causality via causedBy timestamps without modifying the audit trail.

Instructions

审计数据只读查询——按时间/规则/exitCode 过滤读 history.jsonl,按 ts 查 decision-log 因果链(消费 causedBy 字段)。严格只读,不写任何审计链。边界:audit_trail 按 agentId 查跨设备轨迹 / worklog_query 查工作效能指标 / run_audit 跑规则写 think.md(写侧)/ ruleset_export 导出规则面——本 tool 只查「时间·规则·exitCode·因果链」维度,勿混用。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ruleNo规则 id(如 A1 / E1)——匹配 history 条目 ruleResults(id / name)
limitNo返回条数上限(默认 100,时间倒序取最新)
sinceNo起始时间(ISO 8601,闭区间含)——history 与 decision 两面通用
untilNo结束时间(ISO 8601,闭区间含)——history 与 decision 两面通用
sourceNo查询源(缺省按是否有 causedBy 推断:有→decision,无→history)
dataDirNo数据目录覆盖(测试注入用;缺省走 SOFAGENT_DATA 解析链)
causedByNodecision 面:查以该 ts 为因果上游的后继决策条目(消费 causedBy 字段)
exitCodeNo审计退出码:0=PASS / 1=WARN / 2=FAIL

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.5.2

TDQS

A4.5/5.0
Behavior4/5

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

With no annotations provided, the description carries the full burden. It clearly discloses 'strictly read-only, does not write any audit chain' and describes the two query modes (history vs decision, with source inference based on causedBy). It doesn't mention permissions, rate limits, or error behavior, but for a read-only query tool the core behavioral traits are well covered.

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 dense but every sentence earns its place. Purpose and read-only disclosure are front-loaded, followed by a boundary list that is essential for disambiguation. It is longer than minimal but not verbose—each clause conveys a distinct fact.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 8 optional parameters, no required fields, and no output schema, the description explains the two query surfaces and how they are selected, plus the read-only constraint. It does not explicitly describe the return format (e.g., fields of returned history entries or decision entries), which would be useful but is not strictly necessary for correct invocation given the schema and sibling boundaries.

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

Parameters4/5

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

Schema coverage is 100%, so baseline is 3. The description adds meaningful context beyond the schema: it explains the source default inference based on causedBy presence, the rule matching against ruleResults (id/name), and the causal-chain semantics of causedBy. This adds genuine value beyond the raw parameter descriptions.

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 states a specific verb ('read-only query') and resource ('audit data' via history.jsonl and decision-log), and explicitly names what it is not (audit_trail, worklog_query, run_audit, ruleset_export), clearly distinguishing it from siblings. The purpose is unambiguous and actionable.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It explicitly names four alternative tools and the exact conditions that select each (cross-device by agentId, work efficiency metrics, write-side rule execution, rule-surface export), then states 'this tool only queries time·rule·exitCode·causal chain dimensions, don't mix.' This gives an agent complete routing guidance with no inference needed.

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