API Reference¶
This reference is generated automatically from the package docstrings using
mkdocstrings. Use it to explore the public
APIs exposed by the toolkit, tools, configuration helpers, and block utilities.
Toolkit¶
Tools¶
Search tool implementation for Notion.
NotionSearchTool(*, api_token=None, default_parent_page_id=None, settings=None, client=None, async_client=None, env=None, **kwargs)
¶
Bases: BaseTool
LangChain tool that exposes Notion search capabilities.
Write tool implementation for Notion.
NotionWriteTool(*, api_token=None, default_parent_page_id=None, settings=None, client=None, async_client=None, env=None, **kwargs)
¶
Bases: BaseTool
LangChain tool that creates or updates Notion content.
Clients¶
Factory helpers to construct Notion clients.
NotionClientBundle
¶
Bases: NamedTuple
Container for paired sync and async Notion clients.
create_client_bundle(*, api_token=None, default_parent_page_id=None, settings=None, client=None, async_client=None, env=None, client_kwargs=None, async_client_kwargs=None)
¶
Create both sync and async Notion clients with shared configuration.
create_sync_client(*, api_token=None, default_parent_page_id=None, settings=None, client=None, env=None, **client_kwargs)
¶
Create or return a configured synchronous Notion client.
create_async_client(*, api_token=None, default_parent_page_id=None, settings=None, async_client=None, env=None, **client_kwargs)
¶
Create or return a configured asynchronous Notion client.
Configuration¶
Configuration helpers for Notion client access.
NOTION_API_TOKEN_ENV_VAR = 'NOTION_API_TOKEN'
module-attribute
¶
NOTION_DEFAULT_PARENT_PAGE_ID_ENV_VAR = 'NOTION_DEFAULT_PARENT_PAGE_ID'
module-attribute
¶
NotionClientSettings
¶
Bases: BaseModel
Validated configuration for accessing the Notion API.
from_env(env=None)
classmethod
¶
Load settings from environment variables.
require_parent()
¶
Return the default parent page ID or raise an error if missing.
resolve(*, api_token=None, default_parent_page_id=None, settings=None, env=None)
classmethod
¶
Resolve settings from explicit values, existing settings, or env.
redact_token(token)
¶
Redact a token value for safe logging.
Blocks¶
Helper utilities for working with Notion block payloads.
ALLOWED_BLOCK_TYPES = {'paragraph', 'heading_1', 'heading_2', 'heading_3', 'bulleted_list_item', 'numbered_list_item', 'to_do', 'toggle', 'callout', 'quote', 'code'}
module-attribute
¶
MAX_BLOCKS = 50
module-attribute
¶
MAX_TOTAL_TEXT_LENGTH = 4000
module-attribute
¶
bulleted_list_item(text)
¶
callout(text, *, icon=None)
¶
code(text, *, language='plain text')
¶
from_text(text)
¶
Convert a lightweight markdown-esque text into Notion blocks.
heading_1(text)
¶
heading_2(text)
¶
heading_3(text)
¶
numbered_list_item(text)
¶
paragraph(text)
¶
quote(text)
¶
sanitize_blocks(blocks, *, allow_code_links=False)
¶
Validate and sanitize a sequence of Notion block payloads.