> For the complete documentation index, see [llms.txt](https://whitepaper.aitech.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://whitepaper.aitech.io/agentforge/tools/notion.md).

# notion

[Notion](https://www.notion.so/) is an all-in-one workspace that combines notes, documents, wikis, and project management tools into a single platform. It offers a flexible and customizable environment where users can create, organize, and collaborate on content in various formats.

With Notion, you can:

* **Create versatile content**: Build documents, wikis, databases, kanban boards, calendars, and more
* **Organize information**: Structure content hierarchically with nested pages and powerful databases
* **Collaborate seamlessly**: Share workspaces and pages with team members for real-time collaboration
* **Customize your workspace**: Design your ideal workflow with flexible templates and building blocks
* **Connect information**: Link between pages and databases to create a knowledge network
* **Access anywhere**: Use Notion across web, desktop, and mobile platforms with automatic syncing

In Agent Forge, the Notion integration enables your agents to interact directly with your Notion workspace programmatically. This allows for powerful automation scenarios such as knowledge management, content creation, and information retrieval. Your agents can:

* **Read Notion pages**: Extract content and metadata from any Notion page.
* **Read Notion databases**: Retrieve database structure and information.
* **Write to pages**: Append new content to existing Notion pages.
* **Create new pages**: Generate new Notion pages under a parent page, with custom titles and content.
* **Query databases**: Search and filter database entries using advanced filter and sort criteria.
* **Search workspace**: Search across your entire Notion workspace for pages or databases matching specific queries.
* **Create new databases**: Programmatically create new databases with custom properties and structure.

This integration bridges the gap between your AI workflows and your knowledge base, enabling seamless documentation and information management. By connecting Agent Forge with Notion, you can automate documentation processes, maintain up-to-date information repositories, generate reports, and organize information intelligently—all through your intelligent agents.

## Usage Instructions

Integrate with Notion to read content from pages, write new content, and create new pages.

**Example of pageId/databaseId (underlined)**

## Tools

### `notion_read`

Read content from a Notion page

#### Input

| Parameter     | Type   | Required | Description                       |
| ------------- | ------ | -------- | --------------------------------- |
| `accessToken` | string | Yes      | Notion OAuth access token         |
| `pageId`      | string | Yes      | The ID of the Notion page to read |

#### Output

| Parameter  | Type   | Description   |
| ---------- | ------ | ------------- |
| `content`  | string | Page content  |
| `metadata` | any    | Page metadata |

### `notion_read_database`

Read database information and structure from Notion

#### Input

| Parameter     | Type   | Required | Description                           |
| ------------- | ------ | -------- | ------------------------------------- |
| `accessToken` | string | Yes      | Notion OAuth access token             |
| `databaseId`  | string | Yes      | The ID of the Notion database to read |

#### Output

| Parameter  | Type   | Description   |
| ---------- | ------ | ------------- |
| `content`  | string | Page content  |
| `metadata` | any    | Page metadata |

### `notion_write`

Append content to a Notion page

#### Input

| Parameter     | Type   | Required | Description                                    |
| ------------- | ------ | -------- | ---------------------------------------------- |
| `accessToken` | string | Yes      | Notion OAuth access token                      |
| `pageId`      | string | Yes      | The ID of the Notion page to append content to |
| `content`     | string | Yes      | The content to append to the page              |

#### Output

| Parameter  | Type   | Description   |
| ---------- | ------ | ------------- |
| `content`  | string | Page content  |
| `metadata` | any    | Page metadata |

### `notion_create_page`

Create a new page in Notion

#### Input

| Parameter     | Type   | Required | Description                                       |
| ------------- | ------ | -------- | ------------------------------------------------- |
| `accessToken` | string | Yes      | Notion OAuth access token                         |
| `parentId`    | string | Yes      | ID of the parent page                             |
| `title`       | string | No       | Title of the new page                             |
| `content`     | string | No       | Optional content to add to the page upon creation |

#### Output

| Parameter  | Type   | Description   |
| ---------- | ------ | ------------- |
| `content`  | string | Page content  |
| `metadata` | any    | Page metadata |

### `notion_query_database`

Query and filter Notion database entries with advanced filtering

#### Input

| Parameter     | Type   | Required | Description                                          |
| ------------- | ------ | -------- | ---------------------------------------------------- |
| `accessToken` | string | Yes      | Notion OAuth access token                            |
| `databaseId`  | string | Yes      | The ID of the database to query                      |
| `filter`      | string | No       | Filter conditions as JSON (optional)                 |
| `sorts`       | string | No       | Sort criteria as JSON array (optional)               |
| `pageSize`    | number | No       | Number of results to return (default: 100, max: 100) |

#### Output

| Parameter  | Type   | Description   |
| ---------- | ------ | ------------- |
| `content`  | string | Page content  |
| `metadata` | any    | Page metadata |

### `notion_search`

Search across all pages and databases in Notion workspace

#### Input

| Parameter     | Type   | Required | Description                                                   |
| ------------- | ------ | -------- | ------------------------------------------------------------- |
| `accessToken` | string | Yes      | Notion OAuth access token                                     |
| `query`       | string | No       | Search terms (leave empty to get all pages)                   |
| `filterType`  | string | No       | Filter by object type: page, database, or leave empty for all |
| `pageSize`    | number | No       | Number of results to return (default: 100, max: 100)          |

#### Output

| Parameter  | Type   | Description   |
| ---------- | ------ | ------------- |
| `content`  | string | Page content  |
| `metadata` | any    | Page metadata |

### `notion_create_database`

Create a new database in Notion with custom properties

#### Input

| Parameter     | Type   | Required | Description                                                         |
| ------------- | ------ | -------- | ------------------------------------------------------------------- |
| `accessToken` | string | Yes      | Notion OAuth access token                                           |
| `parentId`    | string | Yes      | ID of the parent page where the database will be created            |
| `title`       | string | Yes      | Title for the new database                                          |
| `properties`  | string | No       | Database properties as JSON object (optional, will create a default |

#### Output

| Parameter  | Type   | Description   |
| ---------- | ------ | ------------- |
| `content`  | string | Page content  |
| `metadata` | any    | Page metadata |

## Notes

* Category: `tools`
* Type: `notion`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://whitepaper.aitech.io/agentforge/tools/notion.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
