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 a fine-tuned multilingual embedding model. What is embedded is the segment's Pāli text alone — the model was fine-tuned on Pāli↔English aligned pairs (bilara-data), so an English query is compared directly against the Pāli text (cross-lingual), with no English/Thai translation mixed into the vector. A segment with no translation is represented by its Pāli exactly like any other segment.

🤔 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 model was fine-tuned for English→Pāli cross-lingual retrieval, so English queries work best; Pāli→Pāli queries are less tested. For exact Pāli terms, prefer search_by_keyword.

  • 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.

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": "search_semantic"
  }
}

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.4/5.0
Behavior4/5

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

Goes well beyond the readOnly/idempotent annotations: explains the embedding model, cross-lingual behavior, that untranslated segments are still represented, that similarity scores cluster for stock phrases, and that an empty result means nothing cleared the threshold. Minor gap: no guidance on result structure or paging, though an output schema exists.

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 the one-line definition and the 'use search_hybrid instead' recommendation, then groups limitations and distance-reading guidance under clear headings. It is longer than strictly necessary and repeats the English-query-primacy point already in the schema, but every section carries actionable content.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Broadly complete for a read-only search tool with a populated output schema. However, for a tool whose known weakness is score clustering and rank-1 unreliability, the description stops short of advising how to combine or verify top results beyond 'read the top 10'.

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 baseline is 3, but the description adds real meaning: it explains what `distance` actually measures (cosine distance, smaller = closer, filtering happens at `threshold`) and warns that rank ordering reflects embedding proximity rather than doctrinal relevance. That is value beyond the schema's terse parameter text.

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 operation (semantic vector similarity search over Pāli segment text) and explicitly distinguishes itself from search_hybrid and search_by_keyword. The description of what gets embedded (Pāli text alone, cross-lingual model) makes the tool's behavior unmistakable.

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?

Explicitly says 'In most cases you should use `search_hybrid` instead' and then enumerates the three narrow cases where this tool is the right choice, plus routes exact-term lookups to `search_by_keyword`. This is a textbook when/when-not/alternative structure.

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