Skip to main content
Glama
This connector has been deprecated

Boolean search (and / or / not)

shamela_search_boolean
Read-onlyIdempotent

بحث منطقي (و/أو/دون)

Boolean search the AND-only regular search lacks — combines OR (any_of) and NOT (none_of) with AND (all_of). all_of: terms that must ALL appear (intersection). any_of: at least ONE must appear (union), intersected with all_of. none_of: pages containing ANY of these are excluded. At least one of all_of/any_of is required. The whole expression is ONE Lucene BooleanQuery evaluated over the entire index — all_of as MUST, any_of as SHOULD-min-1, none_of as MUST_NOT — so total_hits is an exact count and the exclusion is exhaustive, not a sample. scope is still worth passing for speed on a large library, not for correctness. If a term has no entry in the index at all it is named in zero_hit_terms: a zero then means that word is not in the library as spelled, which is different from the expression having no match. Examples: shamela_search_boolean({all_of:['الوقف'], any_of:['المسجد','المقبرة'], none_of:['البيع'], scope:{category_ids:[17]}}).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of results to return (1-100, default 20).
scopeNoRestrict to books/authors/categories/period. Recommended: an unscoped boolean search over a large library is exhaustive but slow. Use shamela_list_categories / shamela_resolve to find IDs.
all_ofNoAND — terms that must ALL appear on the page (each term is itself AND-searched, so a multi-word term must co-occur). Intersection of every term's hit set. Leave empty to rely on any_of.
any_ofNoOR — at least ONE of these terms must appear on the page. Union of every term's hit set, then intersected with the all_of result. Leave empty to rely on all_of.
offsetNoNumber of results to skip for pagination. Use with `limit` to page through large result sets. The response includes `has_more` and `next_offset` to drive paging.
none_ofNoNOT — pages containing ANY of these terms are excluded, across the whole index (a MUST_NOT clause, not a subtraction inside a sampled window). Optional.
search_inNoWhich page sections each sub-search looks in: body (matn), foot (footnotes), comment. Default ['body','foot'].
response_formatNoOutput format for the human-readable text. 'markdown' (default) is best for direct display; 'json' returns the same data as a single JSON code block; 'none' skips the rendered text entirely and returns a one-line pointer, leaving `structuredContent` as the whole answer. The structured data is returned in `structuredContent` regardless of this setting, so a caller that parses it should pass 'none' — the character budget is measured over BOTH channels, and the unread copy is otherwise spending most of it. Requires the 'response_format.none' capability (see shamela_brief).markdown

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.5/5.0
Behavior5/5

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

Annotations already declare read-only/idempotent/non-destructive, and the description adds material behavior: the whole expression is one Lucene BooleanQuery over the entire index (exact total_hits, exhaustive MUST_NOT, not a sample), the zero_hit_terms distinction, and the scope-for-speed caveat. This is exactly the extra context annotations cannot carry.

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?

Dense and front-loaded, with the Boolean semantics explained before the example and the scope rationale. The leading Arabic restatement of the title is redundant, but the body sentences all carry information.

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

Completeness4/5

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

For an 8-parameter search tool with a nested scope object and no output schema, the description covers query semantics, return-count meaning, empty-term handling, and scoping tradeoffs. It stops short of explaining pagination/output shape, but the schema covers has_more/next_offset and response_format.

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 description adds a real constraint not in the schema ('At least one of all_of/any_of is required') and clarifies the scope/filter semantics and intersection behavior. The remaining parameter detail is already well covered by the schema.

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 (Boolean search combining AND/OR/NOT) and explicitly positions it against the 'AND-only regular search' it extends. The named parameters (all_of/any_of/none_of) let an agent distinguish it from shamela_search_exact or shamela_search_pages 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 Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives a clear condition for use (when you need OR/NOT beyond AND-only search) and a worked example call, plus a note that scope is for speed not correctness. It refers to the alternative only as 'the AND-only regular search' without naming the specific sibling, so routing is slightly less than explicit.

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