Notion
Search pages, read content, create new pages, and query databases in Notion.
Quick Start
import { Agent, openai, NotionToolkit } from "@radaros/core";
const notion = new NotionToolkit();
// Uses NOTION_API_KEY env var
const agent = new Agent({
name: "notion-assistant",
model: openai("gpt-4o"),
instructions: "Help manage Notion pages and databases.",
tools: [...notion.getTools()],
});
const result = await agent.run("Search for meeting notes from last week");
Config
Notion internal integration token. Falls back to NOTION_API_KEY env var.
| Tool | Description |
|---|
notion_search | Search Notion for pages and databases by title/content. |
notion_get_page | Get content of a page by ID (returns text blocks). |
notion_create_page | Create a page in a database or as a child of a page. |
notion_query_database | Query a database with optional Notion filters. |
Setup
- Create an internal integration
- Copy the integration token
- Share your pages/databases with the integration (click ”…” > “Connections” > add your integration)
Environment Variables
export NOTION_API_KEY="ntn_..."
Search Pages
const result = await agent.run("Find meeting notes from last week about the product roadmap");
// The agent calls notion_search with:
// { query: "product roadmap meeting notes" }
//
// Returns matching pages with titles, IDs, and snippets
Create a Page
const result = await agent.run(
"Create a new page in the Meeting Notes database titled 'Sprint Planning - Feb 26' " +
"with sections for Attendees, Agenda, and Action Items"
);
// The agent calls notion_create_page with:
// {
// parentDatabaseId: "abc123...",
// title: "Sprint Planning - Feb 26",
// content: "## Attendees\n\n## Agenda\n\n## Action Items\n"
// }
Query Database
const result = await agent.run(
"Show me all tasks in the Project Tracker database that are marked 'In Progress'"
);
// The agent calls notion_query_database with:
// {
// databaseId: "def456...",
// filter: { property: "Status", status: { equals: "In Progress" } }
// }
Read Page Content
const result = await agent.run("Read the content of our API documentation page");
// The agent calls notion_search to find the page,
// then notion_get_page with the page ID
// Returns the full text content of the page