Skip to main content
Glama

Hybrid Search

search_hybrid
Read-onlyIdempotent

Hybrid search — combines keyword + semantic search via RRF.

Uses Reciprocal Rank Fusion (RRF) to merge exact-word results with meaning-based results. This is the recommended tool for "discourses about X" / concept queries, because the semantic side catches suttas that discuss a concept using different vocabulary (e.g. some mindfulness-of-breathing suttas use assasati/passasati/dīghaṁ instead of ānāpānassati).

⚠️ Send the question and nothing else. Do not pad the query. The whole string becomes one vector, so every word you add moves it. Appending your own candidate terms — synonyms, Pāli equivalents, a keyword list — searches for the blend, not for the question.

Measured on Buddha flies in the sky: asking it plainly put the right passage at rank 1 (3 relevant suttas). Appending three guessed Pāli terms (buddha, agga, sagga) pushed it down to rank 5 and left only 1 — because agga (supreme) and sagga (heaven) drag the vector toward their own meanings.

Have candidate terms worth searching? Give them their own search_by_keyword call and merge the two result lists. One tool asks what a passage means, the other asks where a word occurs; combined into a single string they cancel out.

Rewriting the question to sound more canonical does not help either — the same query phrased as rose into the air and flew like a bird scored zero relevant hits.

💡 Hints for the AI client:

  • English queries usually work best (e.g. mindfulness of breathing) because the embedding model is multilingual but EN-primary.

  • Thai stop-word handling is weak. If a Thai query underperforms, the AI client should translate to Pāli/English first (see server instructions).

  • The default limit=5 is often too small for a topic survey — use limit=15-20 (max 20) for good coverage.

  • language only chooses what comes back; it does not change what matches or how results are ranked.

  • Looking for a concrete thing rather than a concept (an animal, an object, a place)? search_by_keyword over language="english" is often better. The translations are segment-aligned to the Pāli, so one search for turtle finds every turtle passage whatever the Pāli underneath says (kacchapa, kumma, maṇḍūkakacchapa), and each hit still carries its segment id.

  • Ranking is by similarity, NOT canonical importance — locus classicus suttas (e.g. MN118, DN22) may rank below smaller suttas that happen to use the exact vocabulary. Treat results as a starting point, then call get_sutta for the canonical references.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum results (default: 5, max: 20).
queryYesQuery text (Thai, Pāli, or English — English works best).
languageNoOutput language — "pali", "thai", "english", or "all".pali

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • changedInput schema / properties / language / description
      Previous value: -"ภาษาที่ต้องการให้แสดงในผลลัพธ์ (\"pali\", \"thai\", \"english\", \"all\")"New value: +"Output language — \"pali\", \"thai\", \"english\", or \"all\"."
    • 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 (Thai, Pāli, or English — English works best)."
  2. First observed

TDQS

A4.9/5.0
Behavior5/5

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

Annotations already declare readOnly/idempotent/non-destructive, but the description adds substantial behavior beyond them: the single-vector padding failure mode with measured rank evidence, ranking by similarity rather than canonical importance, and the fact that `language` does not affect matching or ranking. No contradiction with readOnlyHint/idempotentHint.

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 purpose, then the critical query-padding warning, then alternatives and hints. It is long and somewhat repetitive in emphasizing the no-padding rule, but the measured rank example and the keyword-vs-semantic distinction earn their space for a nuanced retrieval 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 values need no explanation; the description covers everything else an agent needs — query form, limit tuning, language behavior, ranking caveats, and sibling routing. Nothing material is missing for correct invocation.

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

Parameters5/5

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

Schema coverage is 100% (baseline 3), but the description goes well beyond it: it warns that default `limit=5` is too small for topic surveys and recommends 15–20 (max 20), explains that `language` only controls output and not matching, and gives concrete query construction rules. This is real added meaning over the schema's terse one-liners.

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+resource ('hybrid search — combines keyword + semantic search via RRF') and immediately distinguishes itself from siblings by naming search_by_keyword and search_semantic in the usage guidance. An agent can tell it apart from the other two search tools without opening a 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?

Explicitly states when to use it ('discourses about X / concept queries'), when not to use it (concrete things like animals/objects/places → search_by_keyword over language="english"), and what to do with candidate terms (separate search_by_keyword call, merge lists). Includes an explicit exclusion: don't fold keyword terms into the query string.

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