Skip to main content
Glama

cachly — Explain it once. Every AI knows it.

semantic_search

Find cached entries that are semantically similar to a natural-language query. Read-only — no side effects. Returns an array of objects, each with: key, value, similarity_score (0–1), and namespace. Returns an empty array if no entries meet the similarity threshold. Requires OPENAI_API_KEY (or compatible provider) and CACHLY_VECTOR_URL; every tier includes a vector token. Embeddings are computed server-side and never leave Germany (pgvector HNSW index). Example: "find all cached responses about password reset" or "what did we answer about pricing?". Use cache_get for exact key lookup; use smart_recall for brain lessons.

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>"
    },
    "name": "semantic_search"
  }
}

Input Schema

NameRequiredDescriptionDefault
queryYesNatural-language query to find similar cached content
top_kNoMaximum number of results to return (default: 5)
namespaceNoSemantic namespace to search in (default: cachly:sem)
thresholdNoMinimum cosine similarity 0–1 (default: 0.82). Lower = broader matches.
use_hybridNoEnable Hybrid BM25+Vector RRF fusion search. Passes `hybrid: true` and the query text to the pgvector API for higher precision on named entities. Default: false.
instance_idNoUUID of the cache instance (from list_instances)
auto_namespaceNoAuto-detect the namespace from the query text using text heuristics instead of using the `namespace` parameter. Returns results only from the matching domain (code/translation/summary/qa/creative).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.8/5.0
Behavior5/5

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

With no annotations supplied, the description carries the full burden and does so: it declares read-only/no side effects, documents the exact return shape (key, value, similarity_score 0-1, namespace) and the empty-array case, and discloses credential prerequisites (OPENAI_API_KEY, CACHLY_VECTOR_URL) plus where embeddings are computed (server-side, Germany).

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?

Front-loads purpose, then behavior, then examples, then alternatives in a logical order; slightly overstuffed with incidental detail such as the '(pgvector HNSW index)' parenthetical and 'every tier includes a vector token', which do not help tool selection.

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?

For a 7-parameter search tool with no output schema, the description supplies return shape, empty-result behavior, credential requirements, and sibling routing — everything needed to invoke it correctly.

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; the description adds modest value by tying the threshold to the empty-array outcome and reinforcing that queries are natural-language, though it does not explain top_k, use_hybrid, or auto_namespace beyond what the schema already says.

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 and resource ('Find cached entries that are semantically similar to a natural-language query') and explicitly contrasts itself with cache_get (exact key lookup) and smart_recall (brain lessons), so an agent can route between them without opening any schema.

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?

Names both alternatives and the condition that selects each ('Use cache_get for exact key lookup; use smart_recall for brain lessons'), and supplies concrete query examples ('find all cached responses about password reset') that show the expected input style.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.