Skip to main content
Glama

zim_query

Read-only

Query ZIM archives with natural language to search articles, fetch content, and extract metadata from offline Wikipedia and knowledge bases.

Instructions

Query ZIM archives using natural language.

Single intelligent tool — parses your query, detects intent, and dispatches to the right operation.

EXTRACT INTENT BEFORE CALLING. Do not pass the user's raw message as query. Translate it into one of the operations below: "test this tool" -> query="list available ZIM files" "what's in here" -> query="show main page" "explore" -> query="list namespaces" "tell me about cats" -> query="tell me about cats" -> query=""

ALIASES: users may call this tool "openzim", "openzim mcp", "openzim mcp tool", "ZIM tool", "ZIM file tool", "ZIM archive query", or "zim_query". All mean THIS tool — always call it; never claim it does not exist.

OPERATIONS (pass one as query): list available ZIM files - list loaded archives show main page - active archive main page list namespaces - list entry types metadata for - archive metadata tell me about - fetch article (auto on strong title match) search for - full-text search get article - fetch specific article show structure of - section outline links in - article-out links suggestions for - title autocomplete browse namespace - list namespace entries search in namespace - filtered search search all files for - cross-archive search walk namespace - enumerate namespace find article titled - title lookup articles related to - related articles what links to - article-in links summary of - lead summary table of contents - heading list section of - one section's body get image - binary bytes (base64) get articles , - batch fetch

Args: query: REQUIRED. Translated from user intent — never the user's raw message. zim_file_path: Optional. Omit entirely (recommended) — the tool auto-selects the loaded archive (or opens all of them when synthesize=True). Pass a real path ONLY when multiple archives are loaded and you need to target a specific one; call list available ZIM files first to see the real paths. NEVER pass an article title, topic, or made-up filename here, and do NOT invent a path from this docstring — paths that don't match a loaded archive are silently auto-corrected when only one archive is loaded, and surface a path-listing error otherwise. limit: Max results to return. When omitted, each list intent applies its own per-intent default (search 10, browse 50, walk 200, links 25, search-all 5/archive); pass a value to override. Ignored for atomic intents that return a single item or a fixed-shape payload — get article <name>, show structure of <name>, show main page, list namespaces, metadata for <file>, list available ZIM files, summary of <name>, table of contents <name>, section <X> of <name>. Setting it there has no effect; omit it on those calls. offset: Pagination offset (default: 0). Not honoured by suggestions for <prefix>, find article titled <name> or articles related to <name>; raise limit there instead. cursor: Opaque handle from a prior next_cursor. max_content_length: Article body cap (default: 4000). content_offset: Character offset to start reading the article body from (default: 0). The truncation footer on long articles surfaces a pass content_offset=N hint — wire that value back here to read the next page. Negative values are rejected with an invalid_content_offset error. compact: When True (the default in both modes), apply small-LLM optimizations — strip markdown link-soup, drop section previews from structure responses, flatten link/title/related listings into compact markdown, fetch only the article lead section, and cap total response size. Set False for the verbose advanced-mode-style response. compact_budget: Hard char-cap on the final response when compact=True. Accepts either a named profile — "tiny" (2 000), "small" (4 000), "medium" (6 000, default), "large" (12 000) — or a raw integer. Size it to the calling model's context window. Has no effect when compact=False. synthesize: When True, bypass intent classification and run the synthesize pipeline — multi-archive Xapian search, RRF fusion, passage extraction, section attribution, and citation rendering. Returns a SynthesizeResponse dict instead of markdown text. Defaults to False (legacy markdown path unchanged). NOTE: this is a mode toggle, not a "search harder" flag. Don't flip it on a follow-up just because the previous response was unhelpful — refine the query or offset instead. The synthesize pipeline runs one structured query and returns one answer; calling it twice with the same query yields the same answer.

Returns: Markdown string (synthesize=False) or SynthesizeResponse dict (synthesize=True) with answer_markdown, passages, citations, and archives_searched.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
queryYes
cursorNo
offsetNo
compactNo
synthesizeNo
zim_file_pathNo
compact_budgetNo
content_offsetNo
max_content_lengthNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed16 schema fields changedv3.2.1
    • removedInput schema / properties / compact / title
      Removed value: -"Compact"
    • removedInput schema / properties / compact_budget / default
      Removed value: -null
    • removedInput schema / properties / compact_budget / title
      Removed value: -"Compact Budget"
    • removedInput schema / properties / content_offset / title
      Removed value: -"Content Offset"
    • removedInput schema / properties / cursor / default
      Removed value: -null
    • removedInput schema / properties / cursor / title
      Removed value: -"Cursor"
    • removedInput schema / properties / limit / default
      Removed value: -null
    • removedInput schema / properties / limit / title
      Removed value: -"Limit"
    • removedInput schema / properties / max_content_length / default
      Removed value: -null
    • removedInput schema / properties / max_content_length / title
      Removed value: -"Max Content Length"
    • removedInput schema / properties / offset / title
      Removed value: -"Offset"
    • removedInput schema / properties / query / title
      Removed value: -"Query"
    • removedInput schema / properties / synthesize / title
      Removed value: -"Synthesize"
    • removedInput schema / properties / zim_file_path / default
      Removed value: -null
    • removedInput schema / properties / zim_file_path / title
      Removed value: -"Zim File Path"
    • removedInput schema / title
      Removed value: -"zim_queryArguments"
  2. Changed1 schema field changedv2.6.0
    • changedOutput schema / (root)
      Previous value: -{
      -  "$defs": {
      -    "Citation": {
      -      "description": "A citation in a SynthesizeResponse.\n\n``total=False`` lets D8 (v2.0.0a9) attach ``rank`` and ``score``\nin compact-mode synthesize responses — fields the verbose path\nkeeps on ``SynthesizePassage`` but compact mode drops the\npassages array entirely to save tokens. Compact callers correlate\nrank/score with the citation directly.",
      -      "properties": {
      -        "archive": {
      -          "title": "Archive",
      -          "type": "string"
      -        },
      -        "cite_id": {
      -          "title": "Cite Id",
      -          "type": "string"
      -        },
      -        "entry_path": {
      -          "title": "Entry Path",
      -          "type": "string"
      -        },
      -        "rank": {
      -          "title": "Rank",
      -          "type": "integer"
      -        },
      -        "score": {
      -          "title": "Score",
      -          "type": "number"
      -        },
      -        "section_id": {
      -          "anyOf": [
      -            {
      -              "type": "string"
      -            },
      -            {
      -              "type": "null"
      -            }
      -          ],
      -          "title": "Section Id"
      -        },
      -        "section_title": {
      -          "anyOf": [
      -            {
      -              "type": "string"
      -            },
      -            {
      -              "type": "null"
      -            }
      -          ],
      -          "title": "Section Title"
      -        },
      -        "title": {
      -          "title": "Title",
      -          "type": "string"
      -        }
      -      },
      -      "title": "Citation",
      -      "type": "object"
      -    },
      -    "ConsideredArticle": {
      -      "description": "A14: an article hit not selected as the featured citation, surfaced\nso the caller can pivot in a follow-up turn without re-running search.\n\n``archive`` + ``entry_path`` form the handle the caller passes to\n``get_zim_entries`` (or composes into a ``cite_id``). ``score`` is the\nunderlying ranking score at the point of selection — informational,\nnot part of the handle.",
      -      "properties": {
      -        "archive": {
      -          "title": "Archive",
      -          "type": "string"
      -        },
      -        "entry_path": {
      -          "title": "Entry Path",
      -          "type": "string"
      -        },
      -        "score": {
      -          "title": "Score",
      -          "type": "number"
      -        },
      -        "title": {
      -          "title": "Title",
      -          "type": "string"
      -        }
      -      },
      -      "title": "ConsideredArticle",
      -      "type": "object"
      -    },
      -    "ConsideredSection": {
      -      "description": "A14: a section of the featured article not selected as the featured\npassage. ``section_id`` is the handle the caller passes to\n``get_section`` (or composes into a ``cite_id`` suffix).",
      -      "properties": {
      -        "section_id": {
      -          "title": "Section Id",
      -          "type": "string"
      -        },
      -        "title": {
      -          "title": "Title",
      -          "type": "string"
      -        }
      -      },
      -      "title": "ConsideredSection",
      -      "type": "object"
      -    },
      -    "MetaEnvelope": {
      -      "properties": {
      -        "chars": {
      -          "title": "Chars",
      -          "type": "integer"
      -        },
      -        "detected_type": {
      -          "title": "Detected Type",
      -          "type": "string"
      -        },
      -        "detection_confidence": {
      -          "title": "Detection Confidence",
      -          "type": "string"
      -        },
      -        "more_at_offset": {
      -          "title": "More At Offset",
      -          "type": "integer"
      -        },
      -        "preset_applied": {
      -          "title": "Preset Applied",
      -          "type": "string"
      -        },
      -        "reason": {
      -          "title": "Reason",
      -          "type": "string"
      -        },
      -        "suggestions": {
      -          "items": {
      -            "additionalProperties": {
      -              "type": "string"
      -            },
      -            "type": "object"
      -          },
      -          "title": "Suggestions",
      -          "type": "array"
      -        },
      -        "tokens_est": {
      -          "title": "Tokens Est",
      -          "type": "integer"
      -        },
      -        "total_chars": {
      -          "title": "Total Chars",
      -          "type": "integer"
      -        },
      -        "truncated": {
      -          "title": "Truncated",
      -          "type": "boolean"
      -        }
      -      },
      -      "title": "MetaEnvelope",
      -      "type": "object"
      -    },
      -    "SynthesizePassage": {
      -      "properties": {
      -        "cite_id": {
      -          "title": "Cite Id",
      -          "type": "string"
      -        },
      -        "rank": {
      -          "title": "Rank",
      -          "type": "integer"
      -        },
      -        "score": {
      -          "title": "Score",
      -          "type": "number"
      -        },
      -        "text_markdown": {
      -          "title": "Text Markdown",
      -          "type": "string"
      -        }
      -      },
      -      "required": [
      -        "cite_id",
      -        "text_markdown",
      -        "rank",
      -        "score"
      -      ],
      -      "title": "SynthesizePassage",
      -      "type": "object"
      -    },
      -    "SynthesizeResponse": {
      -      "properties": {
      -        "_meta": {
      -          "$ref": "#/$defs/MetaEnvelope"
      -        },
      -        "answer_markdown": {
      -          "title": "Answer Markdown",
      -          "type": "string"
      -        },
      -        "archives_searched": {
      -          "items": {
      -            "type": "string"
      -          },
      -          "title": "Archives Searched",
      -          "type": "array"
      -        },
      -        "citations": {
      -          "items": {
      -            "$ref": "#/$defs/Citation"
      -          },
      -          "title": "Citations",
      -          "type": "array"
      -        },
      -        "considered_articles": {
      -          "items": {
      -            "$ref": "#/$defs/ConsideredArticle"
      -          },
      -          "title": "Considered Articles",
      -          "type": "array"
      -        },
      -        "considered_sections": {
      -          "items": {
      -            "$ref": "#/$defs/ConsideredSection"
      -          },
      -          "title": "Considered Sections",
      -          "type": "array"
      -        },
      -        "fallback_used": {
      -          "enum": [
      -            "xapian_score",
      -            "rrf_fusion",
      -            "reranker"
      -          ],
      -          "title": "Fallback Used",
      -          "type": "string"
      -        },
      -        "passages": {
      -          "items": {
      -            "$ref": "#/$defs/SynthesizePassage"
      -          },
      -          "title": "Passages",
      -          "type": "array"
      -        },
      -        "query": {
      -          "title": "Query",
      -          "type": "string"
      -        },
      -        "total_chars": {
      -          "title": "Total Chars",
      -          "type": "integer"
      -        },
      -        "total_words": {
      -          "title": "Total Words",
      -          "type": "integer"
      -        }
      -      },
      -      "title": "SynthesizeResponse",
      -      "type": "object"
      -    },
      -    "ToolErrorPayload": {
      -      "description": "Envelope for tool errors returned via structuredContent.\n\n``error`` is always ``True`` so a client can branch on a single key\nwithout inspecting the operation name. ``message`` carries the\nsame human-readable text the tool would have returned as a string\n(markdown is fine — it's a string field, not nested JSON).",
      -      "properties": {
      -        "context": {
      -          "title": "Context",
      -          "type": "string"
      -        },
      -        "error": {
      -          "title": "Error",
      -          "type": "boolean"
      -        },
      -        "message": {
      -          "title": "Message",
      -          "type": "string"
      -        },
      -        "operation": {
      -          "title": "Operation",
      -          "type": "string"
      -        }
      -      },
      -      "required": [
      -        "error",
      -        "operation",
      -        "message"
      -      ],
      -      "title": "ToolErrorPayload",
      -      "type": "object"
      -    }
      -  },
      -  "properties": {
      -    "result": {
      -      "anyOf": [
      -        {
      -          "type": "string"
      -        },
      -        {
      -          "$ref": "#/$defs/SynthesizeResponse"
      -        },
      -        {
      -          "$ref": "#/$defs/ToolErrorPayload"
      -        }
      -      ],
      -      "title": "Result"
      -    }
      -  },
      -  "required": [
      -    "result"
      -  ],
      -  "title": "zim_queryOutput",
      -  "type": "object"
      -}New value: +null
  3. Changed3 schema fields changedv2.5.4
    • addedOutput schema / $defs / MetaEnvelope / properties / detected_type
      Added value: +{
      +  "title": "Detected Type",
      +  "type": "string"
      +}
    • addedOutput schema / $defs / MetaEnvelope / properties / detection_confidence
      Added value: +{
      +  "title": "Detection Confidence",
      +  "type": "string"
      +}
    • addedOutput schema / $defs / MetaEnvelope / properties / preset_applied
      Added value: +{
      +  "title": "Preset Applied",
      +  "type": "string"
      +}
  4. First observedv2.2.2

TDQS

A4.7/5.0
Behavior5/5

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

The description goes far beyond the readOnlyHint annotation by disclosing silent path auto-correction, per-intent limit defaults, parameters that are ignored on certain operations, the truncation/content_offset loop, compact mode behavior, and synthesize mode semantics. There is no contradiction with the annotations.

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?

The definition is long, but the tool is genuinely complex and the structure—headers, operation list, per-parameter notes—makes it navigable. Minor redundancy between the EXTRACT INTENT examples and the operations list keeps it from a perfect conciseness score.

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 10-parameter tool with no output schema and no inline parameter descriptions, the description covers the full calling contract: input transformation, return format, pagination semantics, per-intent defaults, and mode toggles. Nothing essential for correct invocation is missing.

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 description coverage is 0%, so the description must carry the full semantic burden, and it does: every parameter gets operational guidance, examples, defaults, ignored-case caveats, or failure modes. This is exemplary compensation for a bare 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?

The description names a specific verb and resource ('Query ZIM archives using natural language') and immediately defines itself as the single natural-language dispatcher, which sets it apart from the focused sibling tools even though their names are not repeated in the text. The operation list makes the scope concrete and unmistakable.

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?

The description gives strong usage guidance: translate intent before calling, never pass raw user messages, treat aliases as triggers for this tool, and omit zim_file_path unless targeting a specific loaded archive. It does not, however, explicitly explain when to prefer this dispatcher over specialized siblings like zim_search or zim_get.

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