Skip to main content
Glama

find_invariants

Identify recurring assistant response patterns that remain consistent across varied user prompts by clustering response embeddings and scoring invariance.

Instructions

Find recurring assistant-side patterns that survive prompt variance.

Algorithm:

  1. Pull recent assistant messages from dialog_messages (with embeddings).

  2. Greedy cluster by response embedding cosine ≥ response_cohesion.

  3. For each cluster (size ≥ min_cluster_size), find each response's immediately-preceding user prompt in the same conversation.

  4. Score = avg_response_similarity × (1 - avg_prompt_similarity). High = my response stays the same shape while prompts vary widely.

Returns top_n clusters with sample response, scores, and counts. Requires semantic embeddings (sentence-transformers) — without them returns ERR.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
window_daysNo
min_cluster_sizeNo
response_cohesionNo
top_nNo
max_messagesNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior3/5

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

No annotations are provided, so the description must fully disclose behavior. It outlines the algorithm and an error condition, but does not mention side effects, permissions, or whether it modifies data. It states it returns top_n clusters, which is helpful.

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 structured with a clear purpose and algorithm steps. It is front-loaded and concise, though slightly longer due to the step-by-step breakdown.

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?

Given the tool's complexity (5 parameters, algorithm), the description covers the key aspects: input parameters, process, and return format (top_n clusters with samples). An output schema is present but not shown; description suffices.

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 0%, so the description must compensate. It explains response_cohesion, min_cluster_size, and top_n, but does not define window_days or max_messages. This is partial coverage.

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 finds recurring assistant-side patterns that survive prompt variance, using a specific algorithm. It distinguishes itself from sibling tools by focusing on invariant detection.

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 explains the algorithm and a prerequisite (requires embeddings), but does not explicitly state when to use this tool versus alternatives. However, the context implies its specific use case.

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/po4erk91/thread-keeper'

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