matimo-notion 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,63 @@
1
+ # Dependencies
2
+ **/node_modules/
3
+ package-lock.json
4
+ yarn.lock
5
+
6
+ # Build output
7
+ **/dist/
8
+ *.tsbuildinfo
9
+
10
+ # Python compiled / build
11
+ **/__pycache__/
12
+ *.py[cod]
13
+ *$py.class
14
+ *.egg-info/
15
+ *.egg
16
+ **/build/
17
+ **/.eggs/
18
+ **/.venv/
19
+ **/.mypy_cache/
20
+ **/.ruff_cache/
21
+ **/.pytest_cache/
22
+
23
+ # Test coverage
24
+ **/coverage/
25
+ **/.nyc_output/
26
+
27
+ # IDE
28
+ .vscode/
29
+ .idea/
30
+ *.swp
31
+ *.swo
32
+ *~
33
+ .DS_Store
34
+
35
+ # Environment
36
+ .env
37
+ .env.local
38
+ .env.*.local
39
+
40
+ # Logs
41
+ *.log
42
+ npm-debug.log*
43
+ yarn-debug.log*
44
+ yarn-error.log*
45
+
46
+ # OS
47
+ .DS_Store
48
+ Thumbs.db
49
+
50
+ # Temporary files
51
+ tmp/
52
+ temp/
53
+ *.tmp
54
+ typescript/examples/mcp/matimo-tools/.matimo-approvals.json
55
+ typescript/examples/mcp/matimo-tools/fetch-weather/definition.yaml
56
+ typescript/examples/mcp/matimo-tools/npm_downloads/definition.yaml
57
+ typescript/examples/mcp/matimo-tools/skills/ecosystem-health/SKILL.md
58
+ typescript/examples/mcp/matimo-tools/skills/matimo-health-check/SKILL.md
59
+ typescript/examples/mcp/matimo-tools/skills/moltbook-identity/SKILL.md
60
+ typescript/packages/cli/.matimo/certs/server.crt
61
+ typescript/packages/cli/.matimo/certs/server.key
62
+ typescript/examples/mcp/.matimo/certs/server.crt
63
+ typescript/examples/mcp/.matimo/certs/server.key
@@ -0,0 +1,106 @@
1
+ Metadata-Version: 2.4
2
+ Name: matimo-notion
3
+ Version: 0.1.0
4
+ Summary: Matimo provider — Notion tools (pages, databases, comments)
5
+ License: MIT
6
+ Keywords: agents,ai,matimo,notion,tools
7
+ Classifier: Development Status :: 4 - Beta
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Requires-Python: >=3.11
12
+ Requires-Dist: matimo-core<0.2.0,>=0.1.0
13
+ Description-Content-Type: text/markdown
14
+
15
+ # matimo-notion
16
+
17
+ > Notion tools for [Matimo](https://matimo.dev) — create pages, query databases, search, and manage content.
18
+
19
+ [![PyPI](https://img.shields.io/pypi/v/matimo-notion)](https://pypi.org/project/matimo-notion/)
20
+ [![Docs](https://img.shields.io/badge/docs-matimo.dev-blue)](https://matimo.dev/docs)
21
+
22
+ ---
23
+
24
+ ## Installation
25
+
26
+ ```bash
27
+ pip install matimo matimo-notion
28
+ ```
29
+
30
+ ---
31
+
32
+ ## Available Tools (7 Total)
33
+
34
+ | Tool | Description |
35
+ |------|-------------|
36
+ | `notion_search` | Search pages and databases across a workspace |
37
+ | `notion_list_databases` | List databases the integration has access to |
38
+ | `notion_query_database` | Query a database with optional filters and sorts |
39
+ | `notion_create_page` | Create a new page (in a database or as a child page) |
40
+ | `notion_update_page` | Update page properties or archive/restore a page |
41
+ | `notion_create_comment` | Add a comment to a page or discussion thread |
42
+ | `notion_get_user` | Get user profile by ID or get the bot user |
43
+
44
+ ---
45
+
46
+ ## Quick Start
47
+
48
+ ```python
49
+ import asyncio
50
+ from matimo import Matimo
51
+ from matimo_notion import get_tools_path
52
+
53
+ async def main():
54
+ matimo = await Matimo.init(get_tools_path())
55
+
56
+ # Search for pages/databases
57
+ results = await matimo.execute('notion_search', {
58
+ 'query': 'Product Roadmap',
59
+ })
60
+
61
+ # Query a database
62
+ rows = await matimo.execute('notion_query_database', {
63
+ 'database_id': 'your-database-id',
64
+ 'filter': {'property': 'Status', 'select': {'equals': 'In Progress'}},
65
+ })
66
+
67
+ # Create a page in a database
68
+ await matimo.execute('notion_create_page', {
69
+ 'parent_id': 'your-database-id',
70
+ 'title': 'New Task',
71
+ 'properties': {'Status': {'select': {'name': 'Todo'}}},
72
+ })
73
+
74
+ asyncio.run(main())
75
+ ```
76
+
77
+ ---
78
+
79
+ ## Authentication
80
+
81
+ ```bash
82
+ export NOTION_API_KEY="secret_your-integration-token"
83
+ ```
84
+
85
+ ### Setting Up a Notion Integration
86
+
87
+ 1. Go to [notion.so/my-integrations](https://www.notion.so/my-integrations) → **New integration**
88
+ 2. Set capabilities: Read content, Update content, Insert content
89
+ 3. Copy the **Internal Integration Secret**
90
+ 4. Share the pages/databases you want to access with your integration
91
+
92
+ ---
93
+
94
+ ## Documentation
95
+
96
+ - [Notion API Reference](https://developers.notion.com/reference)
97
+ - [Python Examples](https://github.com/tallclub/matimo/tree/main/python/examples/native/notion)
98
+
99
+ ---
100
+
101
+ ## Links
102
+
103
+ - **PyPI:** https://pypi.org/project/matimo-notion/
104
+ - **GitHub:** https://github.com/tallclub/matimo
105
+ - **Notion API Docs:** https://developers.notion.com/
106
+
@@ -0,0 +1,92 @@
1
+ # matimo-notion
2
+
3
+ > Notion tools for [Matimo](https://matimo.dev) — create pages, query databases, search, and manage content.
4
+
5
+ [![PyPI](https://img.shields.io/pypi/v/matimo-notion)](https://pypi.org/project/matimo-notion/)
6
+ [![Docs](https://img.shields.io/badge/docs-matimo.dev-blue)](https://matimo.dev/docs)
7
+
8
+ ---
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ pip install matimo matimo-notion
14
+ ```
15
+
16
+ ---
17
+
18
+ ## Available Tools (7 Total)
19
+
20
+ | Tool | Description |
21
+ |------|-------------|
22
+ | `notion_search` | Search pages and databases across a workspace |
23
+ | `notion_list_databases` | List databases the integration has access to |
24
+ | `notion_query_database` | Query a database with optional filters and sorts |
25
+ | `notion_create_page` | Create a new page (in a database or as a child page) |
26
+ | `notion_update_page` | Update page properties or archive/restore a page |
27
+ | `notion_create_comment` | Add a comment to a page or discussion thread |
28
+ | `notion_get_user` | Get user profile by ID or get the bot user |
29
+
30
+ ---
31
+
32
+ ## Quick Start
33
+
34
+ ```python
35
+ import asyncio
36
+ from matimo import Matimo
37
+ from matimo_notion import get_tools_path
38
+
39
+ async def main():
40
+ matimo = await Matimo.init(get_tools_path())
41
+
42
+ # Search for pages/databases
43
+ results = await matimo.execute('notion_search', {
44
+ 'query': 'Product Roadmap',
45
+ })
46
+
47
+ # Query a database
48
+ rows = await matimo.execute('notion_query_database', {
49
+ 'database_id': 'your-database-id',
50
+ 'filter': {'property': 'Status', 'select': {'equals': 'In Progress'}},
51
+ })
52
+
53
+ # Create a page in a database
54
+ await matimo.execute('notion_create_page', {
55
+ 'parent_id': 'your-database-id',
56
+ 'title': 'New Task',
57
+ 'properties': {'Status': {'select': {'name': 'Todo'}}},
58
+ })
59
+
60
+ asyncio.run(main())
61
+ ```
62
+
63
+ ---
64
+
65
+ ## Authentication
66
+
67
+ ```bash
68
+ export NOTION_API_KEY="secret_your-integration-token"
69
+ ```
70
+
71
+ ### Setting Up a Notion Integration
72
+
73
+ 1. Go to [notion.so/my-integrations](https://www.notion.so/my-integrations) → **New integration**
74
+ 2. Set capabilities: Read content, Update content, Insert content
75
+ 3. Copy the **Internal Integration Secret**
76
+ 4. Share the pages/databases you want to access with your integration
77
+
78
+ ---
79
+
80
+ ## Documentation
81
+
82
+ - [Notion API Reference](https://developers.notion.com/reference)
83
+ - [Python Examples](https://github.com/tallclub/matimo/tree/main/python/examples/native/notion)
84
+
85
+ ---
86
+
87
+ ## Links
88
+
89
+ - **PyPI:** https://pypi.org/project/matimo-notion/
90
+ - **GitHub:** https://github.com/tallclub/matimo
91
+ - **Notion API Docs:** https://developers.notion.com/
92
+
@@ -0,0 +1,27 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "matimo-notion"
7
+ version = "0.1.0"
8
+ description = "Matimo provider — Notion tools (pages, databases, comments)"
9
+ readme = "README.md"
10
+ license = { text = "MIT" }
11
+ requires-python = ">=3.11"
12
+ keywords = ["ai", "tools", "agents", "matimo", "notion"]
13
+ classifiers = [
14
+ "Development Status :: 4 - Beta",
15
+ "Intended Audience :: Developers",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Programming Language :: Python :: 3.11",
18
+ ]
19
+ dependencies = [
20
+ "matimo-core>=0.1.0,<0.2.0",
21
+ ]
22
+
23
+ [project.entry-points."matimo.providers"]
24
+ notion = "matimo_notion:get_tools_path"
25
+
26
+ [tool.hatch.build.targets.wheel]
27
+ packages = ["src/matimo_notion"]
@@ -0,0 +1,17 @@
1
+ """Matimo notion provider — exposes the path to YAML tool definitions."""
2
+ from __future__ import annotations
3
+
4
+ import importlib.resources
5
+ from pathlib import Path
6
+
7
+
8
+ def get_tools_path() -> str:
9
+ """Return the absolute path to the bundled notion tool definitions."""
10
+ try:
11
+ ref = importlib.resources.files("matimo_notion") / "tools"
12
+ return str(ref)
13
+ except Exception:
14
+ return str(Path(__file__).parent / "tools")
15
+
16
+
17
+ __all__ = ["get_tools_path"]
@@ -0,0 +1,97 @@
1
+ name: notion_create_comment
2
+ description: Add a comment to a Notion page, block, or discussion thread
3
+ version: "1.0.0"
4
+ parameters:
5
+ parent:
6
+ type: object
7
+ required: false
8
+ description: Parent target - provide one of page_id, block_id, or neither if using discussion_id
9
+ discussion_id:
10
+ type: string
11
+ required: false
12
+ description: The ID of existing discussion thread to respond to (alternative to parent)
13
+ rich_text:
14
+ type: array
15
+ required: true
16
+ description: Array of rich text objects representing comment content
17
+ attachments:
18
+ type: array
19
+ required: false
20
+ description: Array of file objects to attach to comment (max 3 allowed)
21
+ display_name:
22
+ type: object
23
+ required: false
24
+ description: Display name configuration for the comment author
25
+
26
+ execution:
27
+ type: http
28
+ method: POST
29
+ url: "https://api.notion.com/v1/comments"
30
+ headers:
31
+ Authorization: "Bearer {NOTION_API_KEY}"
32
+ "Notion-Version": "2022-06-28"
33
+ Content-Type: application/json
34
+ body:
35
+ parent: "{parent}"
36
+ discussion_id: "{discussion_id}"
37
+ rich_text: "{rich_text}"
38
+ attachments: "{attachments}"
39
+ display_name: "{display_name}"
40
+ timeout: 15000
41
+
42
+ authentication:
43
+ type: bearer
44
+ location: header
45
+ name: Authorization
46
+ notes:
47
+ env: NOTION_API_KEY
48
+ caution: "Ensure 'Insert comments' capability is enabled. Either page_id, block_id, or discussion_id required. Cannot start new inline discussions via API - must respond to existing threads or comment on pages/blocks."
49
+
50
+ output_schema:
51
+ type: object
52
+ properties:
53
+ object:
54
+ type: string
55
+ id:
56
+ type: string
57
+ created_time:
58
+ type: string
59
+ last_edited_time:
60
+ type: string
61
+ rich_text:
62
+ type: array
63
+ parent:
64
+ type: object
65
+ required: ["object", "id"]
66
+
67
+ examples:
68
+ - name: "Comment on page with simple text"
69
+ params:
70
+ parent:
71
+ page_id: be633bf1-dfa0-436d-b259-571129a590e5
72
+ rich_text:
73
+ - type: text
74
+ text:
75
+ content: "This looks great! Consider adding more examples."
76
+ expected_result: "Comment posted on the page"
77
+ - name: "Reply to discussion thread"
78
+ params:
79
+ discussion_id: "discussion-thread-id"
80
+ rich_text:
81
+ - type: text
82
+ text:
83
+ content: "I agree with this suggestion"
84
+ annotations:
85
+ bold: true
86
+ expected_result: "Reply added to existing discussion thread"
87
+ - name: "Comment on block with attachment"
88
+ params:
89
+ parent:
90
+ block_id: block-id-uuid
91
+ rich_text:
92
+ - type: text
93
+ text:
94
+ content: "Attached document:"
95
+ attachments:
96
+ - url: https://example.com/document.pdf
97
+ expected_result: "Comment posted on block with file attachment"
@@ -0,0 +1,127 @@
1
+ name: notion_create_page
2
+ description: Create a new page in a Notion database or as a child of an existing page
3
+ version: "1.0.0"
4
+ parameters:
5
+ parent:
6
+ type: object
7
+ required: true
8
+ description: |
9
+ Where to create the page. Provide ONE of:
10
+ - {"database_id": "..."} to create in a database
11
+ - {"page_id": "..."} to create as a sub-page
12
+ Get database_id from notion_list_databases.
13
+ properties:
14
+ type: object
15
+ required: false
16
+ description: |
17
+ Optional page properties (title, fields, etc).
18
+ Properties must match the parent database schema.
19
+ Simpler: just use 'markdown' parameter instead for content.
20
+ icon:
21
+ type: object
22
+ required: false
23
+ description: Page icon - object with type (emoji, external, file) and icon content
24
+ cover:
25
+ type: object
26
+ required: false
27
+ description: Page cover image - object with type (file, external) and image details
28
+ children:
29
+ type: array
30
+ required: false
31
+ description: Array of block objects to add to the page. Max 100 items
32
+ markdown:
33
+ type: string
34
+ required: false
35
+ description: |
36
+ Page content using Markdown syntax. Simple and works anywhere.
37
+ Example: "# My Title\n\nSome content here"
38
+ EASIEST WAY TO ADD CONTENT - use this instead of 'properties' for simplicity.
39
+ template:
40
+ type: object
41
+ required: false
42
+ description: Template to use for the page. Specify type and optional template_id
43
+ position:
44
+ type: object
45
+ required: false
46
+ description: Position of page in parent. Can specify before_id or after_id
47
+
48
+ execution:
49
+ type: function
50
+ code: './index.py'
51
+
52
+ authentication:
53
+ type: bearer
54
+ location: header
55
+ name: Authorization
56
+ notes:
57
+ env: NOTION_API_KEY
58
+ caution: "Ensure 'Insert content' capability is enabled on the parent. Properties must match parent database schema. For database parents, properties are required. For page parents, only title is supported via properties. Either children or markdown can be used, not both. When using template, children parameter is not allowed."
59
+
60
+ output_schema:
61
+ type: object
62
+ properties:
63
+ object:
64
+ type: string
65
+ id:
66
+ type: string
67
+ created_time:
68
+ type: string
69
+ last_edited_time:
70
+ type: string
71
+ archived:
72
+ type: boolean
73
+ in_trash:
74
+ type: boolean
75
+ is_locked:
76
+ type: boolean
77
+ url:
78
+ type: string
79
+ public_url:
80
+ type: string
81
+ parent:
82
+ type: object
83
+ properties:
84
+ type: object
85
+ icon:
86
+ type: object
87
+ cover:
88
+ type: object
89
+ required: ["object", "id", "url"]
90
+
91
+ examples:
92
+ - name: "Create page in database"
93
+ params:
94
+ parent:
95
+ database_id: a1d8501e-1ac1-43e9-a6bd-ea9fe6c8822b
96
+ properties:
97
+ Name:
98
+ title:
99
+ - text:
100
+ content: "New Page"
101
+ expected_result: "Creates a new page in the database with the specified properties"
102
+ - name: "Create page under existing page"
103
+ params:
104
+ parent:
105
+ page_id: be633bf1-dfa0-436d-b259-571129a590e5
106
+ children:
107
+ - object: block
108
+ type: paragraph
109
+ paragraph:
110
+ rich_text:
111
+ - type: text
112
+ text:
113
+ content: "Page content"
114
+ expected_result: "Creates a subpage with content blocks"
115
+ - name: "Create page with emoji icon"
116
+ params:
117
+ parent:
118
+ database_id: a1d8501e-1ac1-43e9-a6bd-ea9fe6c8822b
119
+ properties:
120
+ Name:
121
+ title:
122
+ - text:
123
+ content: "Task"
124
+ icon:
125
+ type: emoji
126
+ emoji: "✅"
127
+ expected_result: "Creates a page with an emoji icon"
@@ -0,0 +1,169 @@
1
+ """
2
+ notion_create_page — Creates a new page in a Notion database or as a child page.
3
+ Mirrors: typescript/packages/notion/tools/notion_create_page/index.ts
4
+ """
5
+ from __future__ import annotations
6
+
7
+ import os
8
+ import re
9
+ from typing import Any
10
+
11
+ import httpx
12
+
13
+ from matimo.errors import ErrorCode, MatimoError
14
+
15
+ _NOTION_VERSION = "2022-06-28"
16
+ _NOTION_PAGES_URL = "https://api.notion.com/v1/pages"
17
+ _NOTION_DATABASES_URL = "https://api.notion.com/v1/databases"
18
+
19
+
20
+ def _markdown_to_children(md: str) -> list[dict]:
21
+ """Convert markdown text to Notion block children (headings + paragraphs)."""
22
+ blocks: list[dict] = []
23
+ for part in re.split(r"\n\n+", md):
24
+ part = part.strip()
25
+ if not part:
26
+ continue
27
+ if part.startswith("### "):
28
+ blocks.append({
29
+ "object": "block", "type": "heading_3",
30
+ "heading_3": {"rich_text": [{"type": "text", "text": {"content": part[4:]}}]},
31
+ })
32
+ elif part.startswith("## "):
33
+ blocks.append({
34
+ "object": "block", "type": "heading_2",
35
+ "heading_2": {"rich_text": [{"type": "text", "text": {"content": part[3:]}}]},
36
+ })
37
+ elif part.startswith("# "):
38
+ blocks.append({
39
+ "object": "block", "type": "heading_1",
40
+ "heading_1": {"rich_text": [{"type": "text", "text": {"content": part[2:]}}]},
41
+ })
42
+ else:
43
+ blocks.append({
44
+ "object": "block", "type": "paragraph",
45
+ "paragraph": {"rich_text": [{"type": "text", "text": {"content": part}}]},
46
+ })
47
+ return blocks
48
+
49
+
50
+ async def run(params: dict[str, Any]) -> dict[str, Any]:
51
+ api_key = os.environ.get("NOTION_API_KEY")
52
+ if not api_key:
53
+ raise MatimoError(
54
+ "NOTION_API_KEY not set",
55
+ ErrorCode.AUTH_FAILED,
56
+ {"env_var": "NOTION_API_KEY"},
57
+ )
58
+
59
+ headers = {
60
+ "Authorization": f"Bearer {api_key}",
61
+ "Notion-Version": _NOTION_VERSION,
62
+ "Content-Type": "application/json",
63
+ }
64
+
65
+ parent: dict | None = params.get("parent")
66
+ properties: dict | None = params.get("properties")
67
+ icon: dict | None = params.get("icon")
68
+ cover: dict | None = params.get("cover")
69
+ children: list | None = params.get("children")
70
+ markdown: str | None = params.get("markdown")
71
+ template: dict | None = params.get("template")
72
+ position: dict | None = params.get("position")
73
+
74
+ async with httpx.AsyncClient(timeout=15.0) as client:
75
+ # Auto-discover a database if parent not provided
76
+ if not parent:
77
+ resp = await client.get(_NOTION_DATABASES_URL, headers=headers, params={"page_size": 1})
78
+ if resp.status_code != 200:
79
+ raise MatimoError(
80
+ f"Failed to auto-discover database: {resp.text}",
81
+ ErrorCode.EXECUTION_FAILED,
82
+ )
83
+ databases = resp.json().get("results", [])
84
+ if not databases:
85
+ raise MatimoError(
86
+ "No databases found in workspace. Create a database first or provide `parent` parameter.",
87
+ ErrorCode.EXECUTION_FAILED,
88
+ )
89
+ parent = {"database_id": databases[0]["id"]}
90
+
91
+ # Validate: children and markdown are mutually exclusive
92
+ has_children = isinstance(children, list) and len(children) > 0
93
+ has_markdown = isinstance(markdown, str) and markdown.strip()
94
+
95
+ if has_children and has_markdown:
96
+ raise MatimoError(
97
+ "Provide either `children` or `markdown`, not both",
98
+ ErrorCode.VALIDATION_FAILED,
99
+ {"children": len(children), "markdown": len(markdown)},
100
+ )
101
+
102
+ if template and has_children:
103
+ raise MatimoError(
104
+ "`template` cannot be used together with `children`.",
105
+ ErrorCode.VALIDATION_FAILED,
106
+ )
107
+
108
+ # Convert markdown → children if needed
109
+ if not has_children and has_markdown:
110
+ children = _markdown_to_children(markdown)
111
+
112
+ is_database_parent = isinstance(parent, dict) and "database_id" in parent
113
+
114
+ # Build base request body
115
+ body: dict[str, Any] = {"parent": parent}
116
+ if properties:
117
+ body["properties"] = properties
118
+ if icon:
119
+ body["icon"] = icon
120
+ if cover:
121
+ body["cover"] = cover
122
+ if children:
123
+ body["children"] = children
124
+ if template:
125
+ body["template"] = template
126
+ if position:
127
+ body["position"] = position
128
+
129
+ # When creating in a database without explicit properties, try common title field names
130
+ title_candidates = None
131
+ if is_database_parent and not properties and has_markdown:
132
+ first_line = re.sub(r"^#+\s*", "", markdown.split("\n")[0]).strip() or "New Page"
133
+ title_candidates = ["Name", "Title", "title", "name"]
134
+
135
+ if title_candidates:
136
+ last_error: dict | None = None
137
+ for candidate in title_candidates:
138
+ candidate_props = {
139
+ candidate: {"title": [{"text": {"content": first_line}}]}
140
+ }
141
+ try_body = {**body, "properties": candidate_props}
142
+ resp = await client.post(_NOTION_PAGES_URL, headers=headers, json=try_body)
143
+ if resp.status_code == 200:
144
+ return {"success": True, "status_code": resp.status_code, "data": resp.json()}
145
+ err_data = resp.json()
146
+ msg = err_data.get("message", "")
147
+ if "is not a property that exists" in msg:
148
+ last_error = err_data
149
+ continue
150
+ # Non-recoverable error
151
+ return {"success": False, "status_code": resp.status_code, "error": err_data}
152
+
153
+ return {"success": False, "status_code": 0, "error": last_error or "All title candidates failed"}
154
+
155
+ # Single request
156
+ resp = await client.post(_NOTION_PAGES_URL, headers=headers, json=body)
157
+ if resp.status_code == 200:
158
+ return {"success": True, "status_code": resp.status_code, "data": resp.json()}
159
+
160
+ err_data = resp.json()
161
+ raise MatimoError(
162
+ err_data.get("message", "Notion API error"),
163
+ ErrorCode.EXECUTION_FAILED,
164
+ {
165
+ "status": resp.status_code,
166
+ "code": err_data.get("code"),
167
+ "request_id": err_data.get("request_id"),
168
+ },
169
+ )
@@ -0,0 +1,55 @@
1
+ name: notion_get_user
2
+ description: Retrieve information about a Notion user
3
+ version: "1.0.0"
4
+ parameters:
5
+ user_id:
6
+ type: string
7
+ required: true
8
+ description: The UUID of the user to retrieve
9
+
10
+ execution:
11
+ type: http
12
+ method: GET
13
+ url: "https://api.notion.com/v1/users/{user_id}"
14
+ headers:
15
+ Authorization: "Bearer {NOTION_API_KEY}"
16
+ "Notion-Version": "2022-06-28"
17
+ timeout: 10000
18
+
19
+ authentication:
20
+ type: bearer
21
+ location: header
22
+ name: Authorization
23
+ notes:
24
+ env: NOTION_API_KEY
25
+ caution: "Ensure 'Read user information' capability is enabled. Returns user details including name, avatar, email (if available). User IDs can be obtained from page.created_by, page.last_edited_by, or database results."
26
+
27
+ output_schema:
28
+ type: object
29
+ properties:
30
+ object:
31
+ type: string
32
+ id:
33
+ type: string
34
+ type:
35
+ type: string
36
+ name:
37
+ type: string
38
+ avatar_url:
39
+ type: string
40
+ person:
41
+ type: object
42
+ properties:
43
+ email:
44
+ type: string
45
+ required: ["object", "id", "type"]
46
+
47
+ examples:
48
+ - name: "Get user information"
49
+ params:
50
+ user_id: "e79a0b74-3aba-4149-9f74-0bb5791a6ee6"
51
+ expected_result: "Returns user details with name, avatar, email"
52
+ - name: "Get bot user info"
53
+ params:
54
+ user_id: "c2f20311-9e54-4d11-8c79-7398424ae41e"
55
+ expected_result: "Returns bot/integration user information"
@@ -0,0 +1,70 @@
1
+ name: notion_list_databases
2
+ description: |
3
+ List all databases (data sources) available in your Notion workspace.
4
+ Use this to discover what databases exist before querying them.
5
+ Each database has an id, title, icon, and URL that you can use for further operations.
6
+ version: "1.0.0"
7
+
8
+ parameters:
9
+ page_size:
10
+ type: number
11
+ required: false
12
+ description: How many databases to return (1-100). Omit to use Notion's default (up to 100).
13
+
14
+ execution:
15
+ type: http
16
+ method: POST
17
+ url: "https://api.notion.com/v1/search"
18
+ headers:
19
+ Authorization: "Bearer {NOTION_API_KEY}"
20
+ "Notion-Version": "2022-06-28"
21
+ Content-Type: application/json
22
+ body:
23
+ filter:
24
+ property: object
25
+ value: database
26
+ page_size: "{page_size}"
27
+ timeout: 15000
28
+
29
+ authentication:
30
+ type: bearer
31
+ location: header
32
+ name: Authorization
33
+ notes:
34
+ env: NOTION_API_KEY
35
+ caution: "Lists only databases shared with your integration. Respects integration's read capabilities."
36
+
37
+ output_schema:
38
+ type: object
39
+ properties:
40
+ object:
41
+ type: string
42
+ results:
43
+ type: array
44
+ items:
45
+ type: object
46
+ properties:
47
+ id:
48
+ type: string
49
+ title:
50
+ type: array
51
+ icon:
52
+ type: object
53
+ url:
54
+ type: string
55
+ has_more:
56
+ type: boolean
57
+ next_cursor:
58
+ anyOf:
59
+ - type: string
60
+ - type: "null"
61
+
62
+ examples:
63
+ - name: "List all databases in workspace"
64
+ params:
65
+ page_size: 10
66
+ expected_result: "Returns array of database objects with id, title, icon, and url"
67
+ - name: "List first database only"
68
+ params:
69
+ page_size: 1
70
+ expected_result: "Returns single database object"
@@ -0,0 +1,102 @@
1
+ name: notion_query_database
2
+ description: Query pages from a Notion database to retrieve content. Use notion_list_databases first to get the database ID.
3
+ version: "1.0.0"
4
+ parameters:
5
+ database_id:
6
+ type: string
7
+ required: true
8
+ description: The ID of the database to query. Get from notion_list_databases (item.id)
9
+ sorts:
10
+ type: array
11
+ required: false
12
+ description: Array of sort objects to order results by properties or timestamps
13
+ filter:
14
+ type: object
15
+ required: false
16
+ description: Filter criteria as JSON object to narrow results
17
+ page_size:
18
+ type: number
19
+ required: false
20
+ description: Number of results per request (default 100, max 100)
21
+ start_cursor:
22
+ type: string
23
+ required: false
24
+ description: Cursor for pagination to retrieve next set of results
25
+ archived:
26
+ type: boolean
27
+ required: false
28
+ description: If true, include archived pages in results
29
+ in_trash:
30
+ type: boolean
31
+ required: false
32
+ description: If true, include pages in trash in results
33
+ result_type:
34
+ type: string
35
+ required: false
36
+ description: Filter results by type - page or data_source (for wikis only)
37
+
38
+ execution:
39
+ type: http
40
+ method: POST
41
+ url: "https://api.notion.com/v1/databases/{database_id}/query"
42
+ headers:
43
+ Authorization: "Bearer {NOTION_API_KEY}"
44
+ "Notion-Version": "2022-06-28"
45
+ Content-Type: application/json
46
+ body:
47
+ sorts: "{sorts}"
48
+ filter: "{filter}"
49
+ page_size: "{page_size}"
50
+ start_cursor: "{start_cursor}"
51
+ archived: "{archived}"
52
+ in_trash: "{in_trash}"
53
+ result_type: "{result_type}"
54
+ timeout: 15000
55
+
56
+ authentication:
57
+ type: bearer
58
+ location: header
59
+ name: Authorization
60
+ notes:
61
+ env: NOTION_API_KEY
62
+ api_version: "2022-06-28"
63
+ caution: "Uses current Notion API (2022-06-28). Ensure 'Read content' capability is enabled on the integration. Filter and sort are optional - omit if not needed. API returns max 100 items per call."
64
+
65
+ output_schema:
66
+ type: object
67
+ properties:
68
+ object:
69
+ type: string
70
+ type:
71
+ type: string
72
+ results:
73
+ type: array
74
+ has_more:
75
+ type: boolean
76
+ next_cursor:
77
+ anyOf:
78
+ - type: string
79
+ - type: "null"
80
+ required: ["object", "results", "has_more"]
81
+
82
+ examples:
83
+ - name: "Query data source - all pages"
84
+ params:
85
+ database_id: "d9824bdc-8445-4327-be8b-5b47500af6ce"
86
+ expected_result: "Returns paginated list of all pages in the database"
87
+ - name: "Query data source - with filter"
88
+ params:
89
+ database_id: "d9824bdc-8445-4327-be8b-5b47500af6ce"
90
+ filter:
91
+ property: Status
92
+ status:
93
+ equals: Done
94
+ expected_result: "Returns pages where the Status property equals 'Done'"
95
+ - name: "Query data source - with sorting"
96
+ params:
97
+ database_id: "d9824bdc-8445-4327-be8b-5b47500af6ce"
98
+ sorts:
99
+ - property: Created
100
+ direction: descending
101
+ page_size: 25
102
+ expected_result: "Returns up to 25 pages sorted by creation date (descending)"
@@ -0,0 +1,89 @@
1
+ name: notion_search
2
+ description: Search across all pages and data sources in Notion workspace by title
3
+ version: "1.0.0"
4
+ parameters:
5
+ query:
6
+ type: string
7
+ required: false
8
+ description: Search text to find in page/data_source titles - omit to return all shared items
9
+ filter_object:
10
+ type: object
11
+ required: false
12
+ description: Filter results by object type - page or data_source
13
+ sort_direction:
14
+ type: string
15
+ required: false
16
+ description: Sort direction - ascending or descending
17
+ sort_timestamp:
18
+ type: string
19
+ required: false
20
+ description: Sort by timestamp - last_edited_time (default) or created_time
21
+ page_size:
22
+ type: number
23
+ required: false
24
+ description: Number of results per request
25
+ start_cursor:
26
+ type: string
27
+ required: false
28
+ description: Cursor for pagination to retrieve next set of results
29
+
30
+ execution:
31
+ type: http
32
+ method: POST
33
+ url: "https://api.notion.com/v1/search"
34
+ headers:
35
+ Authorization: "Bearer {NOTION_API_KEY}"
36
+ "Notion-Version": "2022-06-28"
37
+ Content-Type: application/json
38
+ body:
39
+ query: "{query}"
40
+ filter: "{filter_object}"
41
+ sort:
42
+ direction: "{sort_direction}"
43
+ timestamp: "{sort_timestamp}"
44
+ page_size: "{page_size}"
45
+ start_cursor: "{start_cursor}"
46
+ timeout: 15000
47
+
48
+ authentication:
49
+ type: bearer
50
+ location: header
51
+ name: Authorization
52
+ notes:
53
+ env: NOTION_API_KEY
54
+ caution: "Omit 'query' parameter to return all pages/data sources shared with integration. Filter and sort are optional. Results respect integration's read capabilities. API version 2022-06-28."
55
+
56
+ output_schema:
57
+ type: object
58
+ properties:
59
+ object:
60
+ type: string
61
+ type:
62
+ type: string
63
+ page_or_data_source:
64
+ type: object
65
+ results:
66
+ type: array
67
+ has_more:
68
+ type: boolean
69
+ next_cursor:
70
+ anyOf:
71
+ - type: string
72
+ - type: "null"
73
+ required: ["object", "type", "results", "has_more"]
74
+
75
+ examples:
76
+ - name: "Search for pages by title"
77
+ params:
78
+ query: "meeting notes"
79
+ expected_result: "Returns all pages with 'meeting notes' in title"
80
+ - name: "Search data sources only"
81
+ params:
82
+ filter_object: "data_source"
83
+ sort_timestamp: "last_edited_time"
84
+ sort_direction: "descending"
85
+ expected_result: "Returns recently edited data sources only"
86
+ - name: "Get all shared items"
87
+ params:
88
+ page_size: 50
89
+ expected_result: "Returns first 50 pages and data sources shared with integration"
@@ -0,0 +1,117 @@
1
+ name: notion_update_page
2
+ description: Update properties, icon, cover, or other attributes of an existing Notion page
3
+ version: "1.0.0"
4
+ parameters:
5
+ page_id:
6
+ type: string
7
+ required: true
8
+ description: The ID of the page to update (UUID format, dashes optional)
9
+ properties:
10
+ type: object
11
+ required: false
12
+ description: Page properties to update as JSON object - must match parent data source schema
13
+ icon:
14
+ type: object
15
+ required: false
16
+ description: Page icon object with type and content (emoji, external URL, or file)
17
+ cover:
18
+ type: object
19
+ required: false
20
+ description: Page cover image object with type and file/external URL details
21
+ is_locked:
22
+ type: boolean
23
+ required: false
24
+ description: Whether to lock page from editing in Notion UI
25
+ template:
26
+ type: object
27
+ required: false
28
+ description: Template object to apply - type default or template_id with specific template ID
29
+ erase_content:
30
+ type: boolean
31
+ required: false
32
+ description: Whether to erase all existing page content (use with template to replace content)
33
+ archived:
34
+ type: boolean
35
+ required: false
36
+ description: Whether to archive or restore the page
37
+ in_trash:
38
+ type: boolean
39
+ required: false
40
+ description: Whether to move page to trash or restore it
41
+
42
+ execution:
43
+ type: http
44
+ method: PATCH
45
+ url: "https://api.notion.com/v1/pages/{page_id}"
46
+ headers:
47
+ Authorization: "Bearer {NOTION_API_KEY}"
48
+ "Notion-Version": "2022-06-28"
49
+ Content-Type: application/json
50
+ body:
51
+ properties: "{properties}"
52
+ icon: "{icon}"
53
+ cover: "{cover}"
54
+ is_locked: "{is_locked}"
55
+ template: "{template}"
56
+ erase_content: "{erase_content}"
57
+ archived: "{archived}"
58
+ in_trash: "{in_trash}"
59
+ timeout: 15000
60
+
61
+ authentication:
62
+ type: bearer
63
+ location: header
64
+ name: Authorization
65
+ notes:
66
+ env: NOTION_API_KEY
67
+ caution: "Ensure 'Update content' capability is enabled. Only include parameters you want to change. Cannot update parent, created_by, created_time, last_edited_by, last_edited_time, or rollup properties via API."
68
+
69
+ output_schema:
70
+ type: object
71
+ properties:
72
+ object:
73
+ type: string
74
+ id:
75
+ type: string
76
+ created_time:
77
+ type: string
78
+ last_edited_time:
79
+ type: string
80
+ archived:
81
+ type: boolean
82
+ in_trash:
83
+ type: boolean
84
+ is_locked:
85
+ type: boolean
86
+ properties:
87
+ type: object
88
+ required: ["object", "id", "last_edited_time"]
89
+
90
+ examples:
91
+ - name: "Update page title"
92
+ params:
93
+ page_id: "be633bf1-dfa0-436d-b259-571129a590e5"
94
+ properties:
95
+ Name:
96
+ title:
97
+ - text:
98
+ content: Updated Title
99
+ expected_result: "Page title updated to 'Updated Title'"
100
+ - name: "Update page icon"
101
+ params:
102
+ page_id: "be633bf1-dfa0-436d-b259-571129a590e5"
103
+ icon:
104
+ type: emoji
105
+ emoji: "🎉"
106
+ expected_result: "Page icon changed to celebration emoji"
107
+ - name: "Update page with cover and apply template"
108
+ params:
109
+ page_id: "be633bf1-dfa0-436d-b259-571129a590e5"
110
+ cover:
111
+ type: external
112
+ external:
113
+ url: https://example.com/image.png
114
+ template:
115
+ type: default
116
+ erase_content: true
117
+ expected_result: "Page cover set, default template applied, existing content replaced"