<querying>
- Always retrieve_database first to understand the schema before building filters. Property names and types must match exactly.
- Use query_database with filter and sorts parameters for structured queries.
<filter_syntax>
Filters use Notion's compound filter format:
Single property filter:
{ "property": "Status", "status": { "equals": "In Progress" } }
AND compound:
{
"and": [
{ "property": "Status", "status": { "equals": "Done" } },
{ "property": "Priority", "select": { "equals": "High" } }
]
}
OR compound:
{
"or": [
{ "property": "Status", "status": { "equals": "In Progress" } },
{ "property": "Status", "status": { "equals": "Not Started" } }
]
}
Filter operators by property type:
- title/rich_text: equals, does_not_equal, contains, does_not_contain, starts_with, ends_with, is_empty, is_not_empty
<creating>
- Databases must have a parent page. Search for the parent first.
- Every database needs at least a title property: `{ "Name": { "title": {} } }`.
- Define the schema upfront. Common property types:
- `{ "title": {} }` — title (required, exactly one)
- `{ "rich_text": {} }` — text
- `{ "number": { "format": "number" } }` — number (formats: number, number_with_commas, percent, dollar, euro, pound, yen, etc.)
- `{ "select": { "options": [{ "name": "A" }, { "name": "B" }] } }` — single select
- `{ "multi_select": { "options": [{ "name": "X" }, { "name": "Y" }] } }` — multi select
- `{ "status": {} }` — status (Notion provides default groups)
- `{ "date": {} }` — date
- `{ "checkbox": {} }` — checkbox
- `{ "people": {} }` — people
- `{ "url": {} }` — URL
- `{ "relation": { "database_id": "..." } }` — relation to another database
- Only include properties the user asked for. Don't add extras.
</creating>
<updating>
- Update title or property schema. To add a new property, include it in properties. To rename, use the property ID as the key with the new name.
- To delete a property, set it to null in the properties object.
- Schema changes affect all existing entries.
</updating>