query_database
Retrieve rows from a Notion database with optional filters and sorts, and auto-paginate to fetch all matching results.
Instructions
Query a Notion database with optional filter and sorts.
Args: database_id: The ID of the Notion database filter: Optional Notion filter object (see Notion API docs) sorts: Optional list of sort objects page_size: Number of results per page (max 100) start_cursor: Cursor for pagination (from previous query's next_cursor) fetch_all: If True, auto-paginate to fetch ALL results. If False, return single page with pagination info. Default True.
Returns: Dict with: - results: List of database rows with parsed properties - total_count: Number of results returned - has_more: Whether more results exist (only when fetch_all=False) - next_cursor: Cursor for next page (only when fetch_all=False and has_more=True)
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": {
"database_id": "<database_id>"
},
"name": "query_database"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sorts | No | ||
| filter | No | ||
| fetch_all | No | ||
| page_size | No | ||
| database_id | Yes | ||
| start_cursor | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||