Skip to main content
Glama

query_documents

Read-onlyIdempotent

Search and filter Paperless documents using full-text queries, structured metadata filters, and custom field conditions for complex document lookups.

Instructions

Query documents using the full-text query engine plus structured Paperless filters. Use this for complex filtering, custom field conditions, or any documented /api/documents/ query parameters that are not exposed as first-class arguments. Prefer the dedicated top-level arguments where available. custom_field_query supports [field_name_or_id, operator, value] leaves or ['AND'|'OR', [clause1, clause2]] groups. Note: Document content is excluded from results by default. Use 'get_document_content' when you need the document text.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "query_documents"
  }
}

Input Schema

NameRequiredDescriptionDefault
tagNo
pageNo
queryNo
searchNo
orderingNo
page_sizeNo
more_like_idNo
storage_pathNo
correspondentNo
document_typeNo
paperless_filtersNoAdditional documented /api/documents/ Paperless filters. Keys must match Paperless query parameter names exactly. Prefer first-class arguments when available.
created__date__gteNo
created__date__lteNo
custom_field_queryNoPaperless custom field query. Use [field_name_or_id, operator, value] for a single clause or ['AND'|'OR', [clause1, clause2]] for grouped clauses.
archive_serial_numberNo
custom_fields__icontainsNo
archive_serial_number__isnullNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv2.2.1

TDQS

A3.6/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false and closed-world, so safety is covered. The description adds genuinely non-redundant behavior: document content is excluded from results by default and must be fetched with 'get_document_content'. It omits pagination behavior and default page size, which matter for a 17-parameter query tool.

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 use case, then the preference rule, then the custom_field_query syntax and the content caveat; each sentence carries information. Slight redundancy in restating the 'prefer first-class arguments' rule that the paperless_filters schema description also states.

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?

It covers the two highest-risk misunderstandings for this tool (content exclusion and custom_field_query nesting), and since there is no output schema the content note is a real plus. But for a 17-parameter, zero-required, nested-object tool with 12% schema coverage, whole swaths of the surface remain undocumented, so an agent will still guess on most arguments.

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

Parameters2/5

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

With 17 parameters and only 12% schema description coverage, the description carries most of the burden, but it only explains 'custom_field_query' clause/group syntax, which the schema already describes. It never disambiguates the ambiguous pairs ('query' vs 'search', 'created__date__gte' vs 'archive_serial_number__isnull', 'ordering' format, 'more_like_id'), and the blanket 'any documented /api/documents/ query parameters' defers to external docs rather than adding meaning.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource plus the mechanism ('full-text query engine plus structured Paperless filters') and the scenario ('complex filtering, custom field conditions, undocumented /api/documents/ parameters'). It does not differentiate itself from the sibling 'search_documents' or 'list_documents', nor from 'get_document'/'list_documents' despite them being the obvious alternatives, though it does name 'get_document_content' for the content case.

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?

Explicitly says when to reach for this tool (complex filtering, custom field conditions, non-first-class parameters), gives a preference rule ('Prefer the dedicated top-level arguments where available'), and routes content needs to 'get_document_content'. It stops short of naming when NOT to use it in favor of 'search_documents' or 'list_documents', which would have made routing unambiguous.

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