Skip to main content
Glama

query_database

Retrieve and filter data from Notion databases to extract specific information for analysis or integration.

Instructions

Query a Notion database with optional filter

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
database_idYes
filterNo

Implementation Reference

  • The main handler function for the 'query_database' tool. It validates the Notion token and database_id, then delegates to the NotionClient's queryDatabase method.
    async query_database(args: Record<string, unknown>) { if (!cfg.notionToken) throw new Error("NOTION_TOKEN is not configured"); const databaseId = String(args.database_id || ""); if (!databaseId) throw new Error("database_id is required"); return client.queryDatabase(databaseId, args.filter); },
  • Input schema for the 'query_database' tool, defining required 'database_id' string and optional 'filter' object.
    inputSchema: { type: "object", properties: { database_id: { type: "string" }, filter: { type: "object" }, }, required: ["database_id"], },
  • Registration of the 'query_database' tool within the tools array in registerNotion() function.
    { name: "query_database", description: "Query a Notion database with optional filter", inputSchema: { type: "object", properties: { database_id: { type: "string" }, filter: { type: "object" }, }, required: ["database_id"], }, },
  • Helper method in NotionClient class that makes the actual Notion API request to query the specified database.
    queryDatabase(databaseId: string, filter?: unknown) { return this.request(`/v1/databases/${databaseId}/query`, { method: "POST", body: filter ? { filter } : {}, }); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/TaylorChen/muti-mcps'

If you have feedback or need assistance with the MCP directory API, please join our Discord server