Skip to main content
Glama
calibre-mcp

calibre-mcp

by caelum29

Semantic search

calibre_semantic_search
Read-only

Search a Calibre library or one book by meaning with semantic, hybrid, or keyword matching, and target figure captions for diagrams. Requires an index built via calibre_build_index.

Instructions

Meaning-based search for query over the local index. scope=library ranks books; scope=book (needs bookId) ranks passages within one book. target=figures searches figure captions instead of text — use when the user asks for a diagram/chart/schema; hits point at calibre_get_figures for the pixels. mode=hybrid (default) fuses semantic + keyword matches; mode=vector is semantic-only; mode=keyword is exact keyword/FTS (no model at query time). All modes need an index built by calibre_build_index. filter accepts a bundle name to scope library searches (list bundles via calibre_manage_bundles). Model inference is serialized: prefer one call at a time — parallel calls queue, and past a few the extras skip the rerank.

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

Input Schema

NameRequiredDescriptionDefault
modeNohybrid
topKNo
queryYes
scopeNolibrary
bookIdNo
filterNo
targetNotext
libraryNo
include_excludedNo

Output Schema

NameRequiredDescriptionDefault
modeNo
noteNo
countNo
scopeNo
bookIdNo
filterNo
targetNo
bookIdsNo
droppedNoOnly at CALIBRE_MCP_LOG_LEVEL=debug, when a text keyword half ran: query terms the keyword MATCH left out: stems in query order — repeated ones (duplicate) and those in more than half of the library's chunks (too-common) — then any identifier (e.g. `is-a`) whose every stem was too common. Absent when the library has no term statistics.
figuresNo
resultsNo
timingsNo
maxScoreNo
passagesNo
rerankedNo
maxRerankNo
paramNotesNoA line per limit param that fell back to its default or max instead of the value sent
indexVersionNo
lowConfidenceNo
semanticReasonNo
exclusionsAppliedNo
exclusionsRemovedNo
semanticAvailableNoCan vector & hybrid ranking run on this library's index? false when the index is keyword-only (no embeddings); semanticReason and the note say whether a rebuild or a model install is the fix.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed10 schema fields changedv0.14.0
    • removedInput schema / properties / query / minLength
      Removed value: -1
    • addedOutput schema / properties / dropped
      Added value: +{
      +  "description": "Only at CALIBRE_MCP_LOG_LEVEL=debug, when a text keyword half ran: query terms the keyword MATCH left out: stems in query order — repeated ones (duplicate) and those in more than half of the library's chunks (too-common) — then any identifier (e.g. `is-a`) whose every stem was too common. Absent when the library has no term statistics.",
      +  "items": {
      +    "additionalProperties": false,
      +    "properties": {
      +      "reason": {
      +        "enum": [
      +          "duplicate",
      +          "too-common"
      +        ],
      +        "type": "string"
      +      },
      +      "term": {
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "term",
      +      "reason"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
    • addedOutput schema / properties / figures / items / properties / provenance
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "Only at CALIBRE_MCP_LOG_LEVEL=debug: 1-based vector/keyword half ranks, fused rank (hybrid), whether the cross-encoder scored the hit, and for library books which half's chunk is shown.",
      +  "properties": {
      +    "chunkFrom": {
      +      "enum": [
      +        "vector",
      +        "keyword",
      +        "both"
      +      ],
      +      "type": "string"
      +    },
      +    "fusedRank": {
      +      "type": "number"
      +    },
      +    "keywordRank": {
      +      "type": "number"
      +    },
      +    "otherRerankScore": {
      +      "type": "number"
      +    },
      +    "rerankPool": {
      +      "type": "boolean"
      +    },
      +    "vectorRank": {
      +      "type": "number"
      +    }
      +  },
      +  "required": [
      +    "rerankPool"
      +  ],
      +  "type": "object"
      +}
    • addedOutput schema / properties / paramNotes
      Added value: +{
      +  "description": "A line per limit param that fell back to its default or max instead of the value sent",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • removedOutput schema / properties / passages / items / properties / frontMatter
      Removed value: -{
      -  "type": "boolean"
      -}
    • addedOutput schema / properties / passages / items / properties / matterKind
      Added value: +{
      +  "enum": [
      +    "front",
      +    "back_index",
      +    "back_biblio",
      +    "back_other"
      +  ],
      +  "type": "string"
      +}
    • addedOutput schema / properties / passages / items / properties / provenance
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "Only at CALIBRE_MCP_LOG_LEVEL=debug: 1-based vector/keyword half ranks, fused rank (hybrid), whether the cross-encoder scored the hit, and for library books which half's chunk is shown.",
      +  "properties": {
      +    "chunkFrom": {
      +      "enum": [
      +        "vector",
      +        "keyword",
      +        "both"
      +      ],
      +      "type": "string"
      +    },
      +    "fusedRank": {
      +      "type": "number"
      +    },
      +    "keywordRank": {
      +      "type": "number"
      +    },
      +    "otherRerankScore": {
      +      "type": "number"
      +    },
      +    "rerankPool": {
      +      "type": "boolean"
      +    },
      +    "vectorRank": {
      +      "type": "number"
      +    }
      +  },
      +  "required": [
      +    "rerankPool"
      +  ],
      +  "type": "object"
      +}
    • addedOutput schema / properties / results / items / properties / matterKind
      Added value: +{
      +  "enum": [
      +    "front",
      +    "back_index",
      +    "back_biblio",
      +    "back_other"
      +  ],
      +  "type": "string"
      +}
    • addedOutput schema / properties / results / items / properties / provenance
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "Only at CALIBRE_MCP_LOG_LEVEL=debug: 1-based vector/keyword half ranks, fused rank (hybrid), whether the cross-encoder scored the hit, and for library books which half's chunk is shown.",
      +  "properties": {
      +    "chunkFrom": {
      +      "enum": [
      +        "vector",
      +        "keyword",
      +        "both"
      +      ],
      +      "type": "string"
      +    },
      +    "fusedRank": {
      +      "type": "number"
      +    },
      +    "keywordRank": {
      +      "type": "number"
      +    },
      +    "otherRerankScore": {
      +      "type": "number"
      +    },
      +    "rerankPool": {
      +      "type": "boolean"
      +    },
      +    "vectorRank": {
      +      "type": "number"
      +    }
      +  },
      +  "required": [
      +    "rerankPool"
      +  ],
      +  "type": "object"
      +}
    • addedOutput schema / properties / timings
      Added value: +{
      +  "additionalProperties": {
      +    "type": "number"
      +  },
      +  "propertyNames": {
      +    "type": "string"
      +  },
      +  "type": "object"
      +}
  2. Changed6 schema fields changedv0.13.0
    • addedOutput schema / $schema
      Added value: +"https://json-schema.org/draft/2020-12/schema"
    • addedOutput schema / properties / exclusionsRemoved
      Added value: +{
      +  "type": "number"
      +}
    • addedOutput schema / properties / figures / items / properties / page / description
      Added value: +"PDF hits only: the page number."
    • addedOutput schema / properties / figures / items / properties / section
      Added value: +{
      +  "description": "EPUB hits only: the spine-section index (shown as §N).",
      +  "type": "number"
      +}
    • changedOutput schema / properties / figures / items / required
      Previous value: -[
      -  "bookId",
      -  "title",
      -  "authors",
      -  "figIndex",
      -  "page",
      -  "caption",
      -  "format",
      -  "charOffset"
      -]New value: +[
      +  "bookId",
      +  "title",
      +  "authors",
      +  "figIndex",
      +  "caption",
      +  "format",
      +  "charOffset"
      +]
    • addedOutput schema / properties / semanticAvailable / description
      Added value: +"Can vector & hybrid ranking run on this library's index? false when the index is keyword-only (no embeddings); semanticReason and the note say whether a rebuild or a model install is the fix."
  3. Changed1 schema field changedv0.12.0
    • addedOutput schema / properties / results / items / properties / snippetStart
      Added value: +{
      +  "type": "number"
      +}
  4. Changed1 schema field changedv0.7.6
    • addedOutput schema / properties / indexVersion
      Added value: +{
      +  "type": "number"
      +}
  5. Changed4 schema fields changedv0.7.3
    • addedInput schema / properties / filter
      Added value: +{
      +  "maxLength": 256,
      +  "minLength": 1,
      +  "type": "string"
      +}
    • addedInput schema / properties / include_excluded
      Added value: +{
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / exclusionsApplied
      Added value: +{
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • addedOutput schema / properties / filter
      Added value: +{
      +  "type": "string"
      +}
  6. First observedv0.7.2

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already cover read-only and closed-world, yet the description adds substantive behavior: a hard prerequisite (index must exist), a model-inference serialization constraint where parallel calls queue and excess calls skip the rerank, and the fact that figure hits point at another tool for pixels. Those are exactly the operational traits an agent cannot learn from 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?

Front-loaded with the core operation, then enumerates scope, target, mode, prerequisites, filtering, and concurrency in a logical order with no filler sentences. It is dense — several em-dash clauses packed together — but each sentence carries distinct, call-relevant information rather than restating the schema.

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 a 9-parameter tool with 0% schema coverage and an output schema (so return values need not be described), the description covers the index prerequisite, the concurrency constraint, and the modes/scopes that drive incorrect calls. Residual gaps are the unexplained topK, library, and include_excluded parameters, which leave some tuning and scoping behavior to guesswork.

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 carries the full burden, and it delivers: query, scope, bookId (including that it is required for scope=book), target, mode (with default and per-value behavior), and filter (bundle name, with discovery path). Only topK, library, and include_excluded are left unexplained, which is a minor residual against otherwise strong coverage of the semantically tricky parameters.

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 mechanism and resource ('Meaning-based search for query over the local index') and immediately disambiguates the two search scopes (library ranks books, book ranks passages). An agent can distinguish it from the sibling calibre_search, which is keyword-oriented, without opening either 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 says when to pick target=figures ('use when the user asks for a diagram/chart/schema'), what each mode does and when each applies, and that all modes require an index built by calibre_build_index. It also routes to calibre_get_figures for pixels and calibre_manage_bundles for discovering bundle names, giving concrete alternatives rather than leaving inference to the agent.

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