Skip to main content
Glama

Query Database

notion_query
Read-onlyIdempotent

Query Notion database rows with structured filters, operators, relative dates, and sorting; returns matching rows and page IDs. Use for finding or listing database entries, not for counts or totals.

Instructions

Query database rows. where takes equality ({"Status": "Done"}), operators ({"Due": {"before": "today"}}, {"Estimate": {">": 500}}, {"Task": {"contains": "x"}}, {"Owner": null}), lists ({"Status": {"in": ["Done", "Blocked"]}}), {"or": [...]}, relative dates ("today", "+7d", "-2w"), and "$created"/"$last_edited"; names and options are matched forgivingly and validated. filter takes raw Notion filter JSON; both are combined with AND. Returns rows with simple values and page ids. For counts or totals use notion_aggregate instead of reading every row.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
sortsNo
whereNo
cursorNonext_cursor from a previous call.
filterNo
databaseYesDatabase URL/id or data source id.
propertiesNoOnly return these properties (saves context).
data_source_nameNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.10.0

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare this a read-only, idempotent, open-world, non-destructive operation, so the bar is lower. The description still adds real behavior: `where` and `filter` are combined with AND, and names/options are 'matched forgivingly and validated', which tells the agent it can be loose with casing/labels. Return shape ('rows with simple values and page ids') is also disclosed.

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 action, then the `where` reference. The operator enumeration is dense but every clause carries usable syntax information, and the alternate-tool pointer is placed at the end where it matters. Slightly long, but nothing is truly redundant.

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 query tool with no output schema and 8 params, the description covers the query semantics and the return shape adequately. Gaps remain around pagination/sorthing behavior (cursor is only explained in the schema), but nothing essential to correct invocation is missing.

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 description coverage is only 38% with 8 parameters, so the description must compensate. It does so thoroughly for the two hardest params (`where` and `filter`), enumerating equality, operators, lists, or-groups, relative dates, and $created/$last_edited, plus the AND combination. It leaves limit, sorts, and data_source_name unaddressed, keeping it below 5.

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?

Opens with a specific verb+resource ('Query database rows') and immediately clarifies scope: rows, not aggregates. The closing sentence names the sibling it is not and why ('For counts or totals use notion_aggregate'), so an agent can distinguish it from notion_aggregate and notion_search 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?

Explicitly routes count/total needs to notion_aggregate instead of reading every row, which is a genuine when-not rule. It does not cover other plausible alternatives (e.g. notion_search for cross-database lookups) or prerequisites, so it falls short of a full 5.

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