Skip to main content
Glama

cf_judge

Idempotent

Determines whether the current request can hit existing cached context using layered keyword matching, time decay, and negative filtering, then returns explainable evidence before cache injection.

Instructions

判定当前请求能否命中既有缓存上下文:关键词分层(实体锚词/意图修饰词)、三层匹配、时效衰减、负向过滤,输出可解释证据。【何时调】要判断「这段历史/记忆值不值得复用、能不能命中」时,在 cf_inject 之前调一次;不要每轮都调。

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": {
      "query": "<query>",
      "entries": "<entries>"
    },
    "name": "cf_judge"
  }
}

Input Schema

NameRequiredDescriptionDefault
nowNo用于测试的当前时间戳(毫秒),必须 ≥ 0
topKNo返回候选数,默认 5;必须为 ≥ 1 的整数
queryYes当前请求文本(不能为空:空文本无实体锚词,判定结果恒为未命中)
entriesYes缓存条目列表(记忆/历史对话)
blacklistNo黑名单词,支持 /regex/ 形式
hitTokensNo本次请求厂商 usage 命中 tokens(prompt_cache_hit_tokens),供 cf_meter 计费相对值曲线累计;必须 ≥ 0
thresholdNo命中阈值,默认 5;必须 ≥ 0
missTokensNo本次请求厂商 usage 未命中 tokens(prompt_cache_miss_tokens),供 cf_meter 计费相对值曲线累计;必须 ≥ 0

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.5.2

TDQS

A4.4/5.0
Behavior4/5

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

Annotations declare readOnlyHint=false and idempotentHint=true, so the description is not the sole source of safety information; it adds mechanism-level context (layered keywords, three-tier matching, decay, blacklisting, explainable evidence) that annotations cannot convey. The gap: it never discloses the side effect implied by readOnlyHint=false — that hitTokens/missTokens feed the cf_meter accounting curve — so an agent could mistake this for a pure read.

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

Conciseness5/5

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

Two sentences, front-loaded with purpose and separated by an explicit 【何时调】 label. The compressed mechanism list is dense but each clause maps to a real behavior, and there is no filler.

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 an 8-parameter tool with no output schema, the description covers what the tool computes and when to invoke it, and mentions that the output is explainable evidence. It stops short of indicating the shape of that evidence (hit decision, scores, matched evidence) or how threshold/topK shape the result, which is the main residual gap.

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 description coverage is 100%, so every one of the 8 parameters is already documented, which sets the baseline at 3. The description adds conceptual linkage only (負向过滤 ↔ blacklist, 时效衰减 ↔ now/timestamp), and says nothing about threshold, topK, or hitTokens/missTokens semantics beyond the schema.

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+resource (判定当前请求能否命中既有缓存上下文) and enumerates the matching machinery (keyword layering, three-tier matching, time decay, negative filtering, explainable evidence). The distinction from cf_inject (call once before it) makes the boundary between the two tools unambiguous.

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?

The 【何时调】 block gives an explicit trigger (when deciding whether a memory/history segment is worth reusing or can hit), the required ordering relative to cf_inject ('在 cf_inject 之前调一次'), and an explicit anti-pattern ('不要每轮都调'), which prevents the most likely misuse.

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