Skip to main content
Glama

ontopoc_query

Computes counts, sums, averages, or shares directly from ontology data using SQL-like SELECT queries, applying visible rows and confirmed definitions without model calls.

Instructions

用本体查询(OntoPoc Query,像 SQL)直接算一个数:代码按令牌主人能看的行和已确认的定义算,不调用模型,快,结果和 ask 一样带 definitions 和 limited_by_rule。写法:SELECT 分组列, 一个数 FROM 路径 [WHERE 条件 AND …] [GROUP BY 分组列] [ORDER BY 那个数 DESC|ASC] [LIMIT n]。路径沿已确认的关系走,不写 JOIN:(o:订单)-[:订单买的产品]->(p:产品),几条路径用逗号隔开,(o) 再次出现是同一个对象。一个数是 count(o)、sum(o.金额)、avg(o.金额) 或 share(o.状态码 = '已取消')(占比);SELECT 里其余的列要写进 GROUP BY。WHERE 只写在被数或被算的对象上,用 =、<>、NOT IN (…)、>、>=、<、<=、BETWEEN 下限 AND 上限(数字或日期),代码列可以直接写含义('已取消');值可以写 $名字,放在 params 里传。日期可以按月、按年分组:SELECT month(o.下单日期), sum(o.金额) … GROUP BY month(o.下单日期)。例:SELECT p.品类, count(o) AS 数量 FROM (o:订单)-[:订单买的产品]->(p:产品) GROUP BY p.品类 ORDER BY 数量 DESC LIMIT 3。类型、属性、关系的名字来自 describe_definitions。写错或写了还不支持的(OR、LIKE、跨对象的条件)会报错并说明能写什么;status 是 refused 时把 reason 原样转告人,不要换写法绕过。分组超过 50 组只给前 50 组,groups_cut 说一共几组、怎么收窄。不记进问答历史、不算提问次数,可以重试:同样的查询在数据和定义没变时结果相同。

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "text": "<text>"
    },
    "name": "ontopoc_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
textYes一条本体查询
paramsNo参数名 → 值(文字或数字),对应查询里的 $名字

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.2.0

TDQS

A4.6/5.0
Behavior5/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 so: it discloses row-level permission scoping to the token owner's visible rows, restriction to confirmed definitions, no LLM call, retryability/idempotence ('same query, same data, same result'), exclusion from Q&A history and question counts, and a 50-group output cap surfaced via groups_cut. Error behavior (unsupported OR/LIKE/cross-object conditions error out with an explanation) is also spelled out.

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?

It is long but front-loaded: what it does, then grammar, then a worked example, then limits and error handling. Nearly every sentence is load-bearing given the DSL has no other in-band documentation, though the closing notes about history/retry could be tightened.

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?

No output schema exists, and the description compensates by describing the return envelope (definitions, limited_by_rule), the truncation signal (groups_cut with total group count), and the refused/reason status. For a complex DSL-driven tool with nested params and no annotations, nothing an agent needs to call it correctly is missing.

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 the baseline is 3, but the description goes well beyond the schema by teaching the actual grammar of `text`: SELECT/GROUP BY/ORDER BY/LIMIT shape, path traversal without JOIN, the four allowed aggregates (count/sum/avg/share), the WHERE operator set, month/year date grouping, and the $name-to-params binding. That materially helps an agent construct valid input rather than just knowing the field exists.

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 opening states a specific verb and resource in plain terms — run an ontology query (SQL-like) to compute a single number — and immediately contrasts it with the sibling `ask` (no model call, faster, same definitions/limited_by_rule envelope). An agent can distinguish it from ask, describe_definitions, and find_instances without opening a schema.

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?

It gives clear context for use (deterministic numeric aggregation instead of model-backed `ask`) and a prerequisite (names come from describe_definitions). It also sets an important don't-do: when status is refused, relay the reason verbatim rather than rewriting the query to bypass it. It stops short of an explicit 'prefer this over ask when X' rule, but the comparison is strong enough to route correctly.

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