Skip to main content
Glama

Semantic Search

search_semantic
Read-onlyIdempotent

Semantic search — match by meaning, not exact words.

Uses vector similarity (cosine distance) over text_pali embedded with a multilingual MiniLM model.

🤔 In most cases you should use search_hybrid instead — it combines this semantic search with keyword search and ranks better. Use this tool only when you need:

  • Pure semantic results (no keyword influence)

  • Fine-grained threshold tuning (hybrid uses RRF which is harder to tune)

  • To debug what semantic alone picks up vs keyword

⚠️ Known limitations:

  • The index is Pāli only (English/Thai queries pass through the multilingual embedding but the model isn't tuned on Pāli)

  • English queries usually embed better than Thai (model is EN-primary)

  • For specific Pāli terms (appamāda, dukkha), exact match is better — use search_by_keyword instead

  • Pāli stock phrases recur in many suttas → similarity scores cluster; read the top 10, don't trust rank 1 alone

📐 Reading distance. It is cosine distance between your query's embedding and the segment's, so smaller is closer, and a row is returned only at or under threshold (default 0.7) — an empty result means nothing cleared that cut. Ordering is proximity of meaning in one model's space, not doctrinal importance.

Input Schema

NameRequiredDescriptionDefault
limitNoMaximum results (default: 5, max: 20).
queryYesQuery text (English works best, then Pāli, Thai is weakest).
languageNoOutput language — "pali", "thai", "english", or "all" (Thai disabled → null).pali
thresholdNoMaximum cosine distance (smaller = stricter match). Default 0.7; lower to 0.5 for tighter matches, raise to 0.9 for broader.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • changedInput schema / properties / language / description
      Previous value: -"ภาษา output — \"pali\", \"thai\", \"english\", หรือ \"all\"\n      (Thai disabled → null)"New value: +"Output language — \"pali\", \"thai\", \"english\", or \"all\"\n      (Thai disabled → null)."
    • changedInput schema / properties / limit / description
      Previous value: -"จำนวนผลลัพธ์สูงสุด (default: 5, max: 20)"New value: +"Maximum results (default: 5, max: 20)."
    • changedInput schema / properties / query / description
      Previous value: -"ข้อความ (อังกฤษให้ผลดีสุด, รองมาเป็นบาลี, ไทยอ่อน)"New value: +"Query text (English works best, then Pāli, Thai is weakest)."
    • changedInput schema / properties / threshold / description
      Previous value: -"cosine distance สูงสุด (น้อย=ตรงเผง). default 0.7;\n       ลดเป็น 0.5 ถ้าอยากเข้มงวด, เพิ่มเป็น 0.9 ถ้าอยากกว้าง"New value: +"Maximum cosine distance (smaller = stricter match).\n       Default 0.7; lower to 0.5 for tighter matches, raise\n       to 0.9 for broader."
  2. First observed

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already cover the safety profile (readOnly, idempotent, non-destructive, closed-world), so the description is free to add behavioral context — and it does: Pāli-only index with an untuned multilingual model, English/Thai embedding degradation, score clustering on stock phrases, and the empty-result-means-nothing-cleared contract. The only gap is that it doesn't mention how the Pāli output language flag interacts with a null/disabled Thai result beyond the schema note.

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?

Well-structured with bolded section headers, emoji anchors, and the most decision-relevant content (use search_hybrid, then limitations) front-loaded. It is on the long side and the limitation bullets overlap somewhat, but nearly every sentence changes how an agent would call or interpret the tool.

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?

An output schema exists, so return value explanation is not needed, and the description covers the remaining agent-facing concerns: model scope, query-language ranking, result-ordering caveats, distance interpretation, and result-set behavior. Nothing needed to invoke or interpret the tool 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 'Reading `distance`' section adds genuine interpretive meaning — smaller-is-closer semantics, the default cut of 0.7, and how raising/lowering threshold trades strictness for breadth — that goes beyond the schema's terse parameter descriptions. It stops short of giving concrete threshold guidance for specific query types, keeping it a 4.

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?

Opens with a specific verb+resource and immediately defines the mechanism ('match by meaning, not exact words') plus the underlying implementation (cosine similarity over text_pali MiniLM embeddings). It explicitly distinguishes itself from search_hybrid and search_by_keyword, so an agent can differentiate it from siblings without opening schemas.

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?

Contains an explicit routing directive ('in most cases use search_hybrid instead') plus the three narrow conditions where this tool is the right choice (pure semantic, threshold tuning, debugging). It also names search_by_keyword for exact Pāli terms. This is the full when/when-not/alternatives triad.

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.

Resources