Skip to main content
Glama

find_invariants

Read-only

Detect assistant response patterns that remain consistent across diverse user prompts. Uses embedding clustering to find responses that repeat while prompts vary, highlighting invariant behaviors.

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
top_nNo
window_daysNo
max_messagesNo
min_cluster_sizeNo
response_cohesionNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

Annotations declare readOnlyHint=true, and the description confirms this is a read operation. It transparently details the clustering algorithm, scoring mechanism, and error condition without embeddings. No contradictions.

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 moderately long but structured as a clear algorithm with numbered steps and a note about prerequisites. It is front-loaded with purpose and algorithm summary, making it efficient for an agent to parse.

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 (5 params, output schema, algorithm), the description covers purpose, algorithm, prerequisites, and return values thoroughly. It is complete for an agent to understand when and how to use it.

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

Parameters2/5

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

Schema description coverage is 0%, so the description should add meaning to parameters. It mentions min_cluster_size and response_cohesion in context, but top_n, window_days, and max_messages are only listed with defaults. This leaves gaps for a tool with 5 parameters.

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's purpose: to find recurring assistant-side patterns that survive prompt variance. It uses specific verbs and resources (find patterns, cluster responses) and distinguishes itself from siblings by focusing on invariant detection across conversations.

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 provides a step-by-step algorithm and states a prerequisite (semantic embeddings required, else ERR). It implies usage for identifying stable response patterns but does not explicitly mention when not to use or compare to alternatives like distilling or searching. Still, it offers clear context.

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