@atikk-co-jp/notion-mcp-server 0.8.0 → 0.9.0

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.
Files changed (45) hide show
  1. package/README.ja.md +43 -40
  2. package/README.md +42 -40
  3. package/dist/src/converters/__tests__/page-to-markdown.test.js +103 -0
  4. package/dist/src/converters/page-to-markdown.d.ts +6 -3
  5. package/dist/src/converters/page-to-markdown.d.ts.map +1 -1
  6. package/dist/src/converters/page-to-markdown.js +12 -5
  7. package/dist/src/schemas/descriptions/fields.d.ts +3 -0
  8. package/dist/src/schemas/descriptions/fields.d.ts.map +1 -1
  9. package/dist/src/schemas/descriptions/fields.js +3 -0
  10. package/dist/src/tools/append-block-children.d.ts.map +1 -1
  11. package/dist/src/tools/append-block-children.js +6 -3
  12. package/dist/src/tools/append-blocks-simple.d.ts.map +1 -1
  13. package/dist/src/tools/append-blocks-simple.js +7 -3
  14. package/dist/src/tools/archive-database.d.ts.map +1 -1
  15. package/dist/src/tools/archive-database.js +6 -3
  16. package/dist/src/tools/archive-page.d.ts.map +1 -1
  17. package/dist/src/tools/archive-page.js +6 -3
  18. package/dist/src/tools/create-comment-simple.d.ts.map +1 -1
  19. package/dist/src/tools/create-comment-simple.js +6 -3
  20. package/dist/src/tools/create-comment.d.ts.map +1 -1
  21. package/dist/src/tools/create-comment.js +6 -3
  22. package/dist/src/tools/create-database.d.ts.map +1 -1
  23. package/dist/src/tools/create-database.js +8 -3
  24. package/dist/src/tools/create-page.d.ts.map +1 -1
  25. package/dist/src/tools/create-page.js +7 -3
  26. package/dist/src/tools/delete-block.d.ts.map +1 -1
  27. package/dist/src/tools/delete-block.js +6 -3
  28. package/dist/src/tools/move-page.d.ts.map +1 -1
  29. package/dist/src/tools/move-page.js +7 -3
  30. package/dist/src/tools/query-data-source.d.ts.map +1 -1
  31. package/dist/src/tools/query-data-source.js +6 -3
  32. package/dist/src/tools/retrieve-data-source.js +5 -5
  33. package/dist/src/tools/retrieve-database.js +1 -1
  34. package/dist/src/tools/search.d.ts +1 -1
  35. package/dist/src/tools/search.d.ts.map +1 -1
  36. package/dist/src/tools/search.js +34 -2
  37. package/dist/src/tools/update-block.d.ts.map +1 -1
  38. package/dist/src/tools/update-block.js +7 -3
  39. package/dist/src/tools/update-data-source.d.ts.map +1 -1
  40. package/dist/src/tools/update-data-source.js +6 -3
  41. package/dist/src/tools/update-database.d.ts.map +1 -1
  42. package/dist/src/tools/update-database.js +8 -3
  43. package/dist/src/tools/update-page.d.ts.map +1 -1
  44. package/dist/src/tools/update-page.js +8 -3
  45. package/package.json +1 -1
package/README.ja.md CHANGED
@@ -21,44 +21,47 @@ Notion API用のMCP(Model Context Protocol)サーバー。AIアシスタン
21
21
 
22
22
  ## API対応表
23
23
 
24
- | カテゴリ | Notion API | MCPツール | 形式 |
25
- |---------|-----------|----------|------|
26
- | **ページ** | | | |
27
- | | [Create page](https://developers.notion.com/reference/post-page) | `create-page` | JSON |
28
- | | | `create-page-simple` | Markdown |
29
- | | [Retrieve page](https://developers.notion.com/reference/retrieve-a-page) | `retrieve-page` | simple/json |
30
- | | [Update page](https://developers.notion.com/reference/patch-page) | `update-page` | JSON |
31
- | | [Retrieve page property](https://developers.notion.com/reference/retrieve-a-page-property-item) | `retrieve-page-property` | JSON |
32
- | | [Move page](https://developers.notion.com/reference/post-page-move) | `move-page` | JSON |
33
- | | [Archive page](https://developers.notion.com/reference/patch-page) | `archive-page` | JSON |
34
- | **データベース** | | | |
35
- | | [Create database](https://developers.notion.com/reference/create-a-database) | `create-database` | JSON |
36
- | | [Retrieve database](https://developers.notion.com/reference/retrieve-a-database) | `retrieve-database` | simple/json |
37
- | | [Update database](https://developers.notion.com/reference/update-a-database) | `update-database` | JSON |
38
- | | [Archive database](https://developers.notion.com/reference/update-a-database) | `archive-database` | JSON |
39
- | **データソース** | | | |
40
- | | [Retrieve data source](https://developers.notion.com/reference/retrieve-a-data-source) | `retrieve-data-source` | simple/json |
41
- | | [Query data source](https://developers.notion.com/reference/post-data-source-query) | `query-data-source` | simple/json |
42
- | | [Update data source](https://developers.notion.com/reference/patch-data-source) | `update-data-source` | JSON |
43
- | **ブロック** | | | |
44
- | | [Retrieve block](https://developers.notion.com/reference/retrieve-a-block) | `retrieve-block` | markdown/json |
45
- | | [Update block](https://developers.notion.com/reference/update-a-block) | `update-block` | JSON |
46
- | | | `update-block-simple` | Markdown |
47
- | | [Delete block](https://developers.notion.com/reference/delete-a-block) | `delete-block` | JSON |
48
- | | [Retrieve block children](https://developers.notion.com/reference/get-block-children) | `get-block-children` | markdown/json |
49
- | | [Append block children](https://developers.notion.com/reference/patch-block-children) | `append-block-children` | JSON |
50
- | | | `append-blocks-simple` | Markdown |
51
- | **コメント** | | | |
52
- | | [Create comment](https://developers.notion.com/reference/create-a-comment) | `create-comment` | JSON |
53
- | | [List comments](https://developers.notion.com/reference/retrieve-comments) | `list-comments` | JSON |
54
- | **ユーザー** | | | |
55
- | | [List users](https://developers.notion.com/reference/get-users) | `list-users` | JSON |
56
- | | [Retrieve user](https://developers.notion.com/reference/get-user) | `retrieve-user` | JSON |
57
- | | [Retrieve bot user](https://developers.notion.com/reference/get-self) | `retrieve-bot-user` | JSON |
58
- | **検索** | | | |
59
- | | [Search](https://developers.notion.com/reference/post-search) | `search` | JSON |
60
-
61
- = Markdown入力対応(入力トークン約80%削減)
24
+ > = Markdown入力対応(入力トークン約80%削減)
25
+ >
26
+ > 📤 = 最小レスポンス(id/urlのみ)- 出力トークン約90%削減
27
+
28
+ | カテゴリ | Notion API | MCPツール | 入力 | 出力(デフォルト) |
29
+ |---------|-----------|----------|------|-------------------|
30
+ | **ページ** | | | | |
31
+ | | [Create page](https://developers.notion.com/reference/post-page) | `create-page` 📤 | JSON | `{id, url}` |
32
+ | | | `create-page-simple` ⭐📤 | Markdown | `{id, url}` |
33
+ | | [Retrieve page](https://developers.notion.com/reference/retrieve-a-page) | `retrieve-page` | JSON | **simple**/json |
34
+ | | [Update page](https://developers.notion.com/reference/patch-page) | `update-page` 📤 | JSON | `{id, url}` |
35
+ | | [Retrieve page property](https://developers.notion.com/reference/retrieve-a-page-property-item) | `retrieve-page-property` | JSON | json |
36
+ | | [Move page](https://developers.notion.com/reference/post-page-move) | `move-page` 📤 | JSON | `{id, url}` |
37
+ | | [Archive page](https://developers.notion.com/reference/patch-page) | `archive-page` 📤 | JSON | `{id}` |
38
+ | **データベース** | | | | |
39
+ | | [Create database](https://developers.notion.com/reference/create-a-database) | `create-database` 📤 | JSON | `{id, url}` |
40
+ | | [Retrieve database](https://developers.notion.com/reference/retrieve-a-database) | `retrieve-database` | JSON | **simple**/json |
41
+ | | [Update database](https://developers.notion.com/reference/update-a-database) | `update-database` 📤 | JSON | `{id, url}` |
42
+ | | [Archive database](https://developers.notion.com/reference/update-a-database) | `archive-database` 📤 | JSON | `{id}` |
43
+ | **データソース** | | | | |
44
+ | | [Retrieve data source](https://developers.notion.com/reference/retrieve-a-data-source) | `retrieve-data-source` | JSON | **simple**/json |
45
+ | | [Query data source](https://developers.notion.com/reference/post-data-source-query) | `query-data-source` | JSON | **simple**/json |
46
+ | | [Update data source](https://developers.notion.com/reference/patch-data-source) | `update-data-source` 📤 | JSON | `{id}` |
47
+ | **ブロック** | | | | |
48
+ | | [Retrieve block](https://developers.notion.com/reference/retrieve-a-block) | `retrieve-block` | JSON | **markdown**/json |
49
+ | | [Update block](https://developers.notion.com/reference/update-a-block) | `update-block` 📤 | JSON | `{id}` |
50
+ | | | `update-block-simple` ⭐📤 | Markdown | `{id}` |
51
+ | | [Delete block](https://developers.notion.com/reference/delete-a-block) | `delete-block` 📤 | JSON | `{id}` |
52
+ | | [Retrieve block children](https://developers.notion.com/reference/get-block-children) | `get-block-children` | JSON | **markdown**/json |
53
+ | | [Append block children](https://developers.notion.com/reference/patch-block-children) | `append-block-children` 📤 | JSON | `{block_ids}` |
54
+ | | | `append-blocks-simple` ⭐📤 | Markdown | `{block_ids}` |
55
+ | **コメント** | | | | |
56
+ | | [Create comment](https://developers.notion.com/reference/create-a-comment) | `create-comment` 📤 | JSON | `{id}` |
57
+ | | | `create-comment-simple` ⭐📤 | Markdown | `{id}` |
58
+ | | [List comments](https://developers.notion.com/reference/retrieve-comments) | `list-comments` | JSON | json |
59
+ | **ユーザー** | | | | |
60
+ | | [List users](https://developers.notion.com/reference/get-users) | `list-users` | JSON | json |
61
+ | | [Retrieve user](https://developers.notion.com/reference/get-user) | `retrieve-user` | JSON | json |
62
+ | | [Retrieve bot user](https://developers.notion.com/reference/get-self) | `retrieve-bot-user` | JSON | json |
63
+ | **検索** | | | | |
64
+ | | [Search](https://developers.notion.com/reference/post-search) | `search` | JSON | **simple**/json |
62
65
 
63
66
  ## インストール
64
67
 
@@ -81,7 +84,7 @@ Claude Desktopの設定ファイル(macOSの場合: `~/.config/claude/claude_d
81
84
  "mcpServers": {
82
85
  "notion": {
83
86
  "command": "npx",
84
- "args": ["-y", "atikk-notion-mcp-server"],
87
+ "args": ["-y", "@atikk-co-jp/notion-mcp-server"],
85
88
  "env": {
86
89
  "NOTION_TOKEN": "your-notion-integration-token"
87
90
  }
@@ -99,7 +102,7 @@ Claude Desktopの設定ファイル(macOSの場合: `~/.config/claude/claude_d
99
102
  "mcpServers": {
100
103
  "notion": {
101
104
  "command": "npx",
102
- "args": ["-y", "atikk-notion-mcp-server"],
105
+ "args": ["-y", "@atikk-co-jp/notion-mcp-server"],
103
106
  "env": {
104
107
  "NOTION_TOKEN": "your-notion-integration-token"
105
108
  }
package/README.md CHANGED
@@ -22,44 +22,46 @@ MCP (Model Context Protocol) server for Notion API. Enables AI assistants to int
22
22
  ## API Coverage
23
23
 
24
24
  > ⭐ = Markdown input supported (reduces input tokens by ~80%)
25
-
26
- | Category | Notion API | MCP Tool | Format |
27
- |----------|-----------|----------|--------|
28
- | **Pages** | | | |
29
- | | [Create page](https://developers.notion.com/reference/post-page) | `create-page` | JSON |
30
- | | | `create-page-simple` | Markdown |
31
- | | [Retrieve page](https://developers.notion.com/reference/retrieve-a-page) | `retrieve-page` | simple/json |
32
- | | [Update page](https://developers.notion.com/reference/patch-page) | `update-page` | JSON |
33
- | | [Retrieve page property](https://developers.notion.com/reference/retrieve-a-page-property-item) | `retrieve-page-property` | JSON |
34
- | | [Move page](https://developers.notion.com/reference/post-page-move) | `move-page` | JSON |
35
- | | [Archive page](https://developers.notion.com/reference/patch-page) | `archive-page` | JSON |
36
- | **Databases** | | | |
37
- | | [Create database](https://developers.notion.com/reference/create-a-database) | `create-database` | JSON |
38
- | | [Retrieve database](https://developers.notion.com/reference/retrieve-a-database) | `retrieve-database` | simple/json |
39
- | | [Update database](https://developers.notion.com/reference/update-a-database) | `update-database` | JSON |
40
- | | [Archive database](https://developers.notion.com/reference/update-a-database) | `archive-database` | JSON |
41
- | **Data Sources** | | | |
42
- | | [Retrieve data source](https://developers.notion.com/reference/retrieve-a-data-source) | `retrieve-data-source` | simple/json |
43
- | | [Query data source](https://developers.notion.com/reference/post-data-source-query) | `query-data-source` | simple/json |
44
- | | [Update data source](https://developers.notion.com/reference/patch-data-source) | `update-data-source` | JSON |
45
- | **Blocks** | | | |
46
- | | [Retrieve block](https://developers.notion.com/reference/retrieve-a-block) | `retrieve-block` | markdown/json |
47
- | | [Update block](https://developers.notion.com/reference/update-a-block) | `update-block` | JSON |
48
- | | | `update-block-simple` | Markdown |
49
- | | [Delete block](https://developers.notion.com/reference/delete-a-block) | `delete-block` | JSON |
50
- | | [Retrieve block children](https://developers.notion.com/reference/get-block-children) | `get-block-children` | markdown/json |
51
- | | [Append block children](https://developers.notion.com/reference/patch-block-children) | `append-block-children` | JSON |
52
- | | | `append-blocks-simple` | Markdown |
53
- | **Comments** | | | |
54
- | | [Create comment](https://developers.notion.com/reference/create-a-comment) | `create-comment` | JSON |
55
- | | | `create-comment-simple` | Markdown |
56
- | | [List comments](https://developers.notion.com/reference/retrieve-comments) | `list-comments` | JSON |
57
- | **Users** | | | |
58
- | | [List users](https://developers.notion.com/reference/get-users) | `list-users` | JSON |
59
- | | [Retrieve user](https://developers.notion.com/reference/get-user) | `retrieve-user` | JSON |
60
- | | [Retrieve bot user](https://developers.notion.com/reference/get-self) | `retrieve-bot-user` | JSON |
61
- | **Search** | | | |
62
- | | [Search](https://developers.notion.com/reference/post-search) | `search` | JSON |
25
+ >
26
+ > 📤 = Minimal response (id/url only) - reduces output tokens by ~90%
27
+
28
+ | Category | Notion API | MCP Tool | Input | Output (default) |
29
+ |----------|-----------|----------|-------|------------------|
30
+ | **Pages** | | | | |
31
+ | | [Create page](https://developers.notion.com/reference/post-page) | `create-page` 📤 | JSON | `{id, url}` |
32
+ | | | `create-page-simple` ⭐📤 | Markdown | `{id, url}` |
33
+ | | [Retrieve page](https://developers.notion.com/reference/retrieve-a-page) | `retrieve-page` | JSON | **simple**/json |
34
+ | | [Update page](https://developers.notion.com/reference/patch-page) | `update-page` 📤 | JSON | `{id, url}` |
35
+ | | [Retrieve page property](https://developers.notion.com/reference/retrieve-a-page-property-item) | `retrieve-page-property` | JSON | json |
36
+ | | [Move page](https://developers.notion.com/reference/post-page-move) | `move-page` 📤 | JSON | `{id, url}` |
37
+ | | [Archive page](https://developers.notion.com/reference/patch-page) | `archive-page` 📤 | JSON | `{id}` |
38
+ | **Databases** | | | | |
39
+ | | [Create database](https://developers.notion.com/reference/create-a-database) | `create-database` 📤 | JSON | `{id, url}` |
40
+ | | [Retrieve database](https://developers.notion.com/reference/retrieve-a-database) | `retrieve-database` | JSON | **simple**/json |
41
+ | | [Update database](https://developers.notion.com/reference/update-a-database) | `update-database` 📤 | JSON | `{id, url}` |
42
+ | | [Archive database](https://developers.notion.com/reference/update-a-database) | `archive-database` 📤 | JSON | `{id}` |
43
+ | **Data Sources** | | | | |
44
+ | | [Retrieve data source](https://developers.notion.com/reference/retrieve-a-data-source) | `retrieve-data-source` | JSON | **simple**/json |
45
+ | | [Query data source](https://developers.notion.com/reference/post-data-source-query) | `query-data-source` | JSON | **simple**/json |
46
+ | | [Update data source](https://developers.notion.com/reference/patch-data-source) | `update-data-source` 📤 | JSON | `{id}` |
47
+ | **Blocks** | | | | |
48
+ | | [Retrieve block](https://developers.notion.com/reference/retrieve-a-block) | `retrieve-block` | JSON | **markdown**/json |
49
+ | | [Update block](https://developers.notion.com/reference/update-a-block) | `update-block` 📤 | JSON | `{id}` |
50
+ | | | `update-block-simple` ⭐📤 | Markdown | `{id}` |
51
+ | | [Delete block](https://developers.notion.com/reference/delete-a-block) | `delete-block` 📤 | JSON | `{id}` |
52
+ | | [Retrieve block children](https://developers.notion.com/reference/get-block-children) | `get-block-children` | JSON | **markdown**/json |
53
+ | | [Append block children](https://developers.notion.com/reference/patch-block-children) | `append-block-children` 📤 | JSON | `{block_ids}` |
54
+ | | | `append-blocks-simple` ⭐📤 | Markdown | `{block_ids}` |
55
+ | **Comments** | | | | |
56
+ | | [Create comment](https://developers.notion.com/reference/create-a-comment) | `create-comment` 📤 | JSON | `{id}` |
57
+ | | | `create-comment-simple` ⭐📤 | Markdown | `{id}` |
58
+ | | [List comments](https://developers.notion.com/reference/retrieve-comments) | `list-comments` | JSON | json |
59
+ | **Users** | | | | |
60
+ | | [List users](https://developers.notion.com/reference/get-users) | `list-users` | JSON | json |
61
+ | | [Retrieve user](https://developers.notion.com/reference/get-user) | `retrieve-user` | JSON | json |
62
+ | | [Retrieve bot user](https://developers.notion.com/reference/get-self) | `retrieve-bot-user` | JSON | json |
63
+ | **Search** | | | | |
64
+ | | [Search](https://developers.notion.com/reference/post-search) | `search` | JSON | **simple**/json |
63
65
 
64
66
  ## Installation
65
67
 
@@ -82,7 +84,7 @@ Add to your Claude Desktop configuration (`~/.config/claude/claude_desktop_confi
82
84
  "mcpServers": {
83
85
  "notion": {
84
86
  "command": "npx",
85
- "args": ["-y", "atikk-notion-mcp-server"],
87
+ "args": ["-y", "@atikk-co-jp/notion-mcp-server"],
86
88
  "env": {
87
89
  "NOTION_TOKEN": "your-notion-integration-token"
88
90
  }
@@ -100,7 +102,7 @@ Add to your `.mcp.json`:
100
102
  "mcpServers": {
101
103
  "notion": {
102
104
  "command": "npx",
103
- "args": ["-y", "atikk-notion-mcp-server"],
105
+ "args": ["-y", "@atikk-co-jp/notion-mcp-server"],
104
106
  "env": {
105
107
  "NOTION_TOKEN": "your-notion-integration-token"
106
108
  }
@@ -445,6 +445,55 @@ describe('pageToSimple', () => {
445
445
  const result = pageToSimple(page);
446
446
  expect(result.url).toBe('');
447
447
  });
448
+ it('filters properties with fields parameter', () => {
449
+ const page = asPage({
450
+ id: 'page-123',
451
+ url: 'https://notion.so/page-123',
452
+ properties: {
453
+ Name: {
454
+ type: 'title',
455
+ title: [{ type: 'text', text: { content: 'My Page' }, plain_text: 'My Page' }],
456
+ },
457
+ Status: {
458
+ type: 'select',
459
+ select: { id: '1', name: 'Active', color: 'green' },
460
+ },
461
+ Priority: {
462
+ type: 'select',
463
+ select: { id: '2', name: 'High', color: 'red' },
464
+ },
465
+ },
466
+ });
467
+ const result = pageToSimple(page, ['Name', 'Status']);
468
+ expect(result).toEqual({
469
+ id: 'page-123',
470
+ url: 'https://notion.so/page-123',
471
+ properties: {
472
+ Name: 'My Page',
473
+ Status: 'Active',
474
+ },
475
+ });
476
+ expect(result.properties).not.toHaveProperty('Priority');
477
+ });
478
+ it('returns all properties when fields is empty array', () => {
479
+ const page = asPage({
480
+ id: 'page-123',
481
+ url: 'https://notion.so/page-123',
482
+ properties: {
483
+ Name: {
484
+ type: 'title',
485
+ title: [{ type: 'text', text: { content: 'My Page' }, plain_text: 'My Page' }],
486
+ },
487
+ Status: {
488
+ type: 'select',
489
+ select: { id: '1', name: 'Active', color: 'green' },
490
+ },
491
+ },
492
+ });
493
+ const result = pageToSimple(page, []);
494
+ expect(result.properties).toHaveProperty('Name');
495
+ expect(result.properties).toHaveProperty('Status');
496
+ });
448
497
  });
449
498
  describe('pagesToSimple', () => {
450
499
  it('converts array of pages to simple format', () => {
@@ -489,6 +538,60 @@ describe('pagesToSimple', () => {
489
538
  it('handles undefined input', () => {
490
539
  expect(pagesToSimple(undefined)).toEqual([]);
491
540
  });
541
+ it('filters properties with fields parameter', () => {
542
+ const pages = asPages([
543
+ {
544
+ id: 'page-1',
545
+ url: 'https://notion.so/page-1',
546
+ properties: {
547
+ Name: {
548
+ type: 'title',
549
+ title: [{ type: 'text', text: { content: 'Page 1' }, plain_text: 'Page 1' }],
550
+ },
551
+ Status: {
552
+ type: 'select',
553
+ select: { id: '1', name: 'Active', color: 'green' },
554
+ },
555
+ Priority: {
556
+ type: 'select',
557
+ select: { id: '2', name: 'High', color: 'red' },
558
+ },
559
+ },
560
+ },
561
+ {
562
+ id: 'page-2',
563
+ url: 'https://notion.so/page-2',
564
+ properties: {
565
+ Name: {
566
+ type: 'title',
567
+ title: [{ type: 'text', text: { content: 'Page 2' }, plain_text: 'Page 2' }],
568
+ },
569
+ Status: {
570
+ type: 'select',
571
+ select: { id: '1', name: 'Done', color: 'blue' },
572
+ },
573
+ Priority: {
574
+ type: 'select',
575
+ select: { id: '2', name: 'Low', color: 'gray' },
576
+ },
577
+ },
578
+ },
579
+ ]);
580
+ const result = pagesToSimple(pages, ['Name', 'Status']);
581
+ expect(result).toHaveLength(2);
582
+ expect(result[0]).toEqual({
583
+ id: 'page-1',
584
+ url: 'https://notion.so/page-1',
585
+ properties: { Name: 'Page 1', Status: 'Active' },
586
+ });
587
+ expect(result[1]).toEqual({
588
+ id: 'page-2',
589
+ url: 'https://notion.so/page-2',
590
+ properties: { Name: 'Page 2', Status: 'Done' },
591
+ });
592
+ expect(result[0].properties).not.toHaveProperty('Priority');
593
+ expect(result[1].properties).not.toHaveProperty('Priority');
594
+ });
492
595
  });
493
596
  describe('real world data', () => {
494
597
  it('converts actual Notion page properties', () => {
@@ -23,9 +23,10 @@ export declare function pagePropertiesToSimple(properties: PageObjectResponse['p
23
23
  /**
24
24
  * ページプロパティをオブジェクト形式に変換(キー: プロパティ名、値: 値)
25
25
  * @param properties - Notion APIから取得したプロパティオブジェクト
26
+ * @param fields - 取得するプロパティ名の配列(指定しない場合は全プロパティ)
26
27
  * @returns シンプル化されたプロパティオブジェクト
27
28
  */
28
- export declare function pagePropertiesToObject(properties: PageObjectResponse['properties']): Record<string, PropertyValue>;
29
+ export declare function pagePropertiesToObject(properties: PageObjectResponse['properties'], fields?: string[]): Record<string, PropertyValue>;
29
30
  /**
30
31
  * シンプル化されたページオブジェクトの型
31
32
  */
@@ -37,13 +38,15 @@ export interface SimplePage {
37
38
  /**
38
39
  * ページオブジェクトをシンプルな形式に変換
39
40
  * @param page - Notion APIから取得したページオブジェクト
41
+ * @param fields - 取得するプロパティ名の配列(指定しない場合は全プロパティ)
40
42
  * @returns シンプル化されたページオブジェクト
41
43
  */
42
- export declare function pageToSimple(page: PageObjectResponse): SimplePage;
44
+ export declare function pageToSimple(page: PageObjectResponse, fields?: string[]): SimplePage;
43
45
  /**
44
46
  * ページ配列をシンプルな形式に変換
45
47
  * @param pages - Notion APIから取得したページ配列
48
+ * @param fields - 取得するプロパティ名の配列(指定しない場合は全プロパティ)
46
49
  * @returns シンプル化されたページ配列
47
50
  */
48
- export declare function pagesToSimple(pages: PageObjectResponse[]): SimplePage[];
51
+ export declare function pagesToSimple(pages: PageObjectResponse[], fields?: string[]): SimplePage[];
49
52
  //# sourceMappingURL=page-to-markdown.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"page-to-markdown.d.ts","sourceRoot":"","sources":["../../../src/converters/page-to-markdown.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAwB,MAAM,qBAAqB,CAAA;AAGnF;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,aAAa,CAAA;CACrB;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,EAAE,GAAG,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AA4KjG;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,kBAAkB,CAAC,YAAY,CAAC,GAC3C,cAAc,EAAE,CAUlB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,kBAAkB,CAAC,YAAY,CAAC,GAC3C,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAU/B;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAA;IACV,GAAG,EAAE,MAAM,CAAA;IACX,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;CAC1C;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,kBAAkB,GAAG,UAAU,CAMjE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,EAAE,GAAG,UAAU,EAAE,CAKvE"}
1
+ {"version":3,"file":"page-to-markdown.d.ts","sourceRoot":"","sources":["../../../src/converters/page-to-markdown.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAwB,MAAM,qBAAqB,CAAA;AAGnF;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,aAAa,CAAA;CACrB;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,EAAE,GAAG,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AA4KjG;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,kBAAkB,CAAC,YAAY,CAAC,GAC3C,cAAc,EAAE,CAUlB;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,kBAAkB,CAAC,YAAY,CAAC,EAC5C,MAAM,CAAC,EAAE,MAAM,EAAE,GAChB,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAc/B;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAA;IACV,GAAG,EAAE,MAAM,CAAA;IACX,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;CAC1C;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,kBAAkB,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,UAAU,CAMpF;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,UAAU,EAAE,CAK1F"}
@@ -162,14 +162,19 @@ export function pagePropertiesToSimple(properties) {
162
162
  /**
163
163
  * ページプロパティをオブジェクト形式に変換(キー: プロパティ名、値: 値)
164
164
  * @param properties - Notion APIから取得したプロパティオブジェクト
165
+ * @param fields - 取得するプロパティ名の配列(指定しない場合は全プロパティ)
165
166
  * @returns シンプル化されたプロパティオブジェクト
166
167
  */
167
- export function pagePropertiesToObject(properties) {
168
+ export function pagePropertiesToObject(properties, fields) {
168
169
  if (!properties) {
169
170
  return {};
170
171
  }
171
172
  const result = {};
172
173
  for (const [name, prop] of Object.entries(properties)) {
174
+ // fieldsが指定されている場合は、指定されたプロパティのみを含める
175
+ if (fields && fields.length > 0 && !fields.includes(name)) {
176
+ continue;
177
+ }
173
178
  result[name] = extractPropertyValue(prop);
174
179
  }
175
180
  return result;
@@ -177,23 +182,25 @@ export function pagePropertiesToObject(properties) {
177
182
  /**
178
183
  * ページオブジェクトをシンプルな形式に変換
179
184
  * @param page - Notion APIから取得したページオブジェクト
185
+ * @param fields - 取得するプロパティ名の配列(指定しない場合は全プロパティ)
180
186
  * @returns シンプル化されたページオブジェクト
181
187
  */
182
- export function pageToSimple(page) {
188
+ export function pageToSimple(page, fields) {
183
189
  return {
184
190
  id: page.id,
185
191
  url: page.url ?? '',
186
- properties: pagePropertiesToObject(page.properties),
192
+ properties: pagePropertiesToObject(page.properties, fields),
187
193
  };
188
194
  }
189
195
  /**
190
196
  * ページ配列をシンプルな形式に変換
191
197
  * @param pages - Notion APIから取得したページ配列
198
+ * @param fields - 取得するプロパティ名の配列(指定しない場合は全プロパティ)
192
199
  * @returns シンプル化されたページ配列
193
200
  */
194
- export function pagesToSimple(pages) {
201
+ export function pagesToSimple(pages, fields) {
195
202
  if (!pages) {
196
203
  return [];
197
204
  }
198
- return pages.map(pageToSimple);
205
+ return pages.map((page) => pageToSimple(page, fields));
199
206
  }
@@ -93,6 +93,9 @@ export declare const Fields: {
93
93
  readonly sorts: {
94
94
  readonly desc: "Sort array. Example: [{\"property\":\"Date\",\"direction\":\"descending\"}]";
95
95
  };
96
+ readonly fields: {
97
+ readonly desc: "Property names to include in response (simple format only). Example: [\"Name\", \"Status\", \"Date\"]";
98
+ };
96
99
  readonly children: {
97
100
  readonly desc: "Block objects array";
98
101
  };
@@ -1 +1 @@
1
- {"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../../src/schemas/descriptions/fields.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,GAAG;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;CAC9D;AAED;;;GAGG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmK2B,CAAA;AAE9C;;;;;;;GAOG;AACH,eAAO,MAAM,CAAC,EAgBN,GAAG,CAAC,IAAI,MAAM,OAAO,MAAM,GAAG,MAAM,GAAE,GAAG;IAE/C,cAAc,EAAE,MAAM,CAAA;IACtB,qBAAqB,EAAE,MAAM,CAAA;IAC7B,iBAAiB,EAAE,MAAM,CAAA;IACzB,iBAAiB,EAAE,MAAM,CAAA;IACzB,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA"}
1
+ {"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../../src/schemas/descriptions/fields.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,GAAG;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;CAC9D;AAED;;;GAGG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsK2B,CAAA;AAE9C;;;;;;;GAOG;AACH,eAAO,MAAM,CAAC,EAgBN,GAAG,CAAC,IAAI,MAAM,OAAO,MAAM,GAAG,MAAM,GAAE,GAAG;IAE/C,cAAc,EAAE,MAAM,CAAA;IACtB,qBAAqB,EAAE,MAAM,CAAA;IAC7B,iBAAiB,EAAE,MAAM,CAAA;IACzB,iBAAiB,EAAE,MAAM,CAAA;IACzB,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA"}
@@ -107,6 +107,9 @@ export const Fields = {
107
107
  sorts: {
108
108
  desc: 'Sort array. Example: [{"property":"Date","direction":"descending"}]',
109
109
  },
110
+ fields: {
111
+ desc: 'Property names to include in response (simple format only). Example: ["Name", "Status", "Date"]',
112
+ },
110
113
  // ============================================
111
114
  // Blocks
112
115
  // ============================================
@@ -1 +1 @@
1
- {"version":3,"file":"append-block-children.d.ts","sourceRoot":"","sources":["../../../src/tools/append-block-children.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAevD,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAmCzF"}
1
+ {"version":3,"file":"append-block-children.d.ts","sourceRoot":"","sources":["../../../src/tools/append-block-children.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAevD,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAuCzF"}
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { F } from '../schemas/descriptions/index.js';
3
- import { formatResponse, handleErrorWithContext } from '../utils/index.js';
3
+ import { formatSimpleResponse, handleErrorWithContext } from '../utils/index.js';
4
4
  // Minimal schema for MCP (full validation by Notion API)
5
5
  const inputSchema = {
6
6
  block_id: z.string().describe(F.block_id),
@@ -11,7 +11,7 @@ export function registerAppendBlockChildren(server, notion) {
11
11
  server.registerTool('append-block-children', {
12
12
  description: 'Append new blocks as children to a block or page. ' +
13
13
  'Supports all block types: paragraph, headings, lists, code, images, etc. ' +
14
- 'Returns the created blocks with their IDs. ' +
14
+ 'Returns the created block IDs. ' +
15
15
  'Use the "after" parameter to insert blocks at a specific position.',
16
16
  inputSchema,
17
17
  }, async ({ block_id, children, after }) => {
@@ -24,7 +24,10 @@ export function registerAppendBlockChildren(server, notion) {
24
24
  params.after = after;
25
25
  }
26
26
  const response = await notion.blocks.children.append(params);
27
- return formatResponse(response);
27
+ // Return minimal response (block_ids only)
28
+ return formatSimpleResponse({
29
+ block_ids: response.results.map((block) => block.id),
30
+ });
28
31
  }
29
32
  catch (error) {
30
33
  return handleErrorWithContext(error, notion, {
@@ -1 +1 @@
1
- {"version":3,"file":"append-blocks-simple.d.ts","sourceRoot":"","sources":["../../../src/tools/append-blocks-simple.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAIxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAWvD,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CA0BxF"}
1
+ {"version":3,"file":"append-blocks-simple.d.ts","sourceRoot":"","sources":["../../../src/tools/append-blocks-simple.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAIxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAWvD,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CA+BxF"}
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { markdownToBlocks } from '../converters/index.js';
3
3
  import { F } from '../schemas/descriptions/index.js';
4
- import { formatResponse, handleError } from '../utils/index.js';
4
+ import { formatSimpleResponse, handleError } from '../utils/index.js';
5
5
  // Minimal schema for MCP
6
6
  const inputSchema = {
7
7
  block_id: z.string().describe(F.block_id),
@@ -12,7 +12,8 @@ export function registerAppendBlocksSimple(server, notion) {
12
12
  server.registerTool('append-blocks-simple', {
13
13
  description: 'Append blocks to a page using Markdown. ' +
14
14
  'Simpler than append-block-children: just provide markdown text. ' +
15
- 'Supports: headings (#), lists (- or 1.), checkboxes (- [ ]), code blocks (```), quotes (>), tables (| |), images (![]()), bold (**), italic (*), links ([]()), etc.',
15
+ 'Supports: headings (#), lists (- or 1.), checkboxes (- [ ]), code blocks (```), quotes (>), tables (| |), images (![]()), bold (**), italic (*), links ([]()), etc. ' +
16
+ 'Returns created block IDs.',
16
17
  inputSchema,
17
18
  }, async ({ block_id, content, after }) => {
18
19
  try {
@@ -23,7 +24,10 @@ export function registerAppendBlocksSimple(server, notion) {
23
24
  children,
24
25
  ...(after && { after }),
25
26
  });
26
- return formatResponse(response);
27
+ // Return minimal response (block_ids only)
28
+ return formatSimpleResponse({
29
+ block_ids: response.results.map((block) => block.id),
30
+ });
27
31
  }
28
32
  catch (error) {
29
33
  return handleError(error);
@@ -1 +1 @@
1
- {"version":3,"file":"archive-database.d.ts","sourceRoot":"","sources":["../../../src/tools/archive-database.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAQvD,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAmBrF"}
1
+ {"version":3,"file":"archive-database.d.ts","sourceRoot":"","sources":["../../../src/tools/archive-database.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAQvD,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAwBrF"}
@@ -1,12 +1,12 @@
1
1
  import { z } from 'zod';
2
2
  import { F } from '../schemas/descriptions/index.js';
3
- import { formatResponse, handleError } from '../utils/index.js';
3
+ import { formatSimpleResponse, handleError } from '../utils/index.js';
4
4
  const inputSchema = {
5
5
  database_id: z.string().describe(F.database_id),
6
6
  };
7
7
  export function registerArchiveDatabase(server, notion) {
8
8
  server.registerTool('archive-database', {
9
- description: 'Move a database to trash. Recoverable for 30 days via Notion UI.',
9
+ description: 'Move a database to trash. Recoverable for 30 days via Notion UI. Returns database ID.',
10
10
  inputSchema,
11
11
  }, async ({ database_id }) => {
12
12
  try {
@@ -14,7 +14,10 @@ export function registerArchiveDatabase(server, notion) {
14
14
  database_id,
15
15
  in_trash: true,
16
16
  });
17
- return formatResponse(response);
17
+ // Return minimal response (id only)
18
+ return formatSimpleResponse({
19
+ id: response.id,
20
+ });
18
21
  }
19
22
  catch (error) {
20
23
  return handleError(error);
@@ -1 +1 @@
1
- {"version":3,"file":"archive-page.d.ts","sourceRoot":"","sources":["../../../src/tools/archive-page.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAQvD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAmBjF"}
1
+ {"version":3,"file":"archive-page.d.ts","sourceRoot":"","sources":["../../../src/tools/archive-page.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAQvD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAwBjF"}
@@ -1,12 +1,12 @@
1
1
  import { z } from 'zod';
2
2
  import { F } from '../schemas/descriptions/index.js';
3
- import { formatResponse, handleError } from '../utils/index.js';
3
+ import { formatSimpleResponse, handleError } from '../utils/index.js';
4
4
  const inputSchema = {
5
5
  page_id: z.string().describe(F.page_id),
6
6
  };
7
7
  export function registerArchivePage(server, notion) {
8
8
  server.registerTool('archive-page', {
9
- description: 'Move a page to trash. Recoverable for 30 days via Notion UI.',
9
+ description: 'Move a page to trash. Recoverable for 30 days via Notion UI. Returns page ID.',
10
10
  inputSchema,
11
11
  }, async ({ page_id }) => {
12
12
  try {
@@ -14,7 +14,10 @@ export function registerArchivePage(server, notion) {
14
14
  page_id,
15
15
  archived: true,
16
16
  });
17
- return formatResponse(response);
17
+ // Return minimal response (id only)
18
+ return formatSimpleResponse({
19
+ id: response.id,
20
+ });
18
21
  }
19
22
  catch (error) {
20
23
  return handleError(error);
@@ -1 +1 @@
1
- {"version":3,"file":"create-comment-simple.d.ts","sourceRoot":"","sources":["../../../src/tools/create-comment-simple.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAGxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAWvD,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAmDzF"}
1
+ {"version":3,"file":"create-comment-simple.d.ts","sourceRoot":"","sources":["../../../src/tools/create-comment-simple.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAGxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAWvD,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAuDzF"}
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { parseInlineMarkdown } from '../converters/index.js';
3
3
  import { F } from '../schemas/descriptions/index.js';
4
- import { formatResponse, handleError } from '../utils/index.js';
4
+ import { formatSimpleResponse, handleError } from '../utils/index.js';
5
5
  const inputSchema = {
6
6
  page_id: z.string().optional().describe(F.page_id),
7
7
  block_id: z.string().optional().describe(F.block_id),
@@ -10,7 +10,7 @@ const inputSchema = {
10
10
  };
11
11
  export function registerCreateCommentSimple(server, notion) {
12
12
  server.registerTool('create-comment-simple', {
13
- description: 'Add a comment using Markdown. Simpler than create-comment.',
13
+ description: 'Add a comment using Markdown. Simpler than create-comment. Returns comment ID.',
14
14
  inputSchema,
15
15
  }, async ({ page_id, block_id, discussion_id, content }) => {
16
16
  try {
@@ -42,7 +42,10 @@ export function registerCreateCommentSimple(server, notion) {
42
42
  params.parent = { block_id };
43
43
  }
44
44
  const response = await notion.comments.create(params);
45
- return formatResponse(response);
45
+ // Return minimal response (id only)
46
+ return formatSimpleResponse({
47
+ id: response.id,
48
+ });
46
49
  }
47
50
  catch (error) {
48
51
  return handleError(error);
@@ -1 +1 @@
1
- {"version":3,"file":"create-comment.d.ts","sourceRoot":"","sources":["../../../src/tools/create-comment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAYvD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAuDnF"}
1
+ {"version":3,"file":"create-comment.d.ts","sourceRoot":"","sources":["../../../src/tools/create-comment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAYvD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CA2DnF"}
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { F } from '../schemas/descriptions/index.js';
3
- import { formatResponse, handleErrorWithContext } from '../utils/index.js';
3
+ import { formatSimpleResponse, handleErrorWithContext } from '../utils/index.js';
4
4
  // Minimal schema for MCP (full validation by Notion API)
5
5
  const inputSchema = {
6
6
  page_id: z.string().optional().describe(F.page_id),
@@ -13,7 +13,7 @@ export function registerCreateComment(server, notion) {
13
13
  description: 'Add a comment to a Notion page. Creates a new discussion or adds to an existing one. ' +
14
14
  'Comments support rich text formatting (bold, italic, links, etc.). ' +
15
15
  'Use discussion_id to reply to an existing comment thread. ' +
16
- 'Returns the created comment with its ID.',
16
+ 'Returns the created comment ID.',
17
17
  inputSchema,
18
18
  }, async ({ page_id, block_id, discussion_id, rich_text }) => {
19
19
  try {
@@ -44,7 +44,10 @@ export function registerCreateComment(server, notion) {
44
44
  params.parent = { block_id };
45
45
  }
46
46
  const response = await notion.comments.create(params);
47
- return formatResponse(response);
47
+ // Return minimal response (id only)
48
+ return formatSimpleResponse({
49
+ id: response.id,
50
+ });
48
51
  }
49
52
  catch (error) {
50
53
  return handleErrorWithContext(error, notion, {
@@ -1 +1 @@
1
- {"version":3,"file":"create-database.d.ts","sourceRoot":"","sources":["../../../src/tools/create-database.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAGxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAevD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CA+BpF"}
1
+ {"version":3,"file":"create-database.d.ts","sourceRoot":"","sources":["../../../src/tools/create-database.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAGxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAevD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAqCpF"}
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { F } from '../schemas/descriptions/index.js';
3
- import { formatResponse, handleErrorWithContext } from '../utils/index.js';
3
+ import { formatSimpleResponse, handleErrorWithContext } from '../utils/index.js';
4
4
  // Minimal schema for MCP (full validation by Notion API)
5
5
  // Uses z.any() for title/icon/cover to reduce context size (~2,300 tokens saved)
6
6
  const inputSchema = {
@@ -15,7 +15,8 @@ export function registerCreateDatabase(server, notion) {
15
15
  server.registerTool('create-database', {
16
16
  description: 'Create a new database as a subpage of an existing Notion page. ' +
17
17
  'Requires a parent_page_id and properties object defining the database schema. ' +
18
- 'Each database must have exactly one title property. (API version 2025-09-03)',
18
+ 'Each database must have exactly one title property. ' +
19
+ 'Returns database ID and URL. (API version 2025-09-03)',
19
20
  inputSchema,
20
21
  }, async ({ parent_page_id, title, properties, icon, cover, is_inline }) => {
21
22
  try {
@@ -29,7 +30,11 @@ export function registerCreateDatabase(server, notion) {
29
30
  ...(is_inline !== undefined && { is_inline }),
30
31
  };
31
32
  const response = await notion.databases.create(params);
32
- return formatResponse(response);
33
+ // Return minimal response (id + url only)
34
+ return formatSimpleResponse({
35
+ id: response.id,
36
+ url: 'url' in response ? response.url : undefined,
37
+ });
33
38
  }
34
39
  catch (error) {
35
40
  return handleErrorWithContext(error, notion, {
@@ -1 +1 @@
1
- {"version":3,"file":"create-page.d.ts","sourceRoot":"","sources":["../../../src/tools/create-page.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAoBvD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CA6ChF"}
1
+ {"version":3,"file":"create-page.d.ts","sourceRoot":"","sources":["../../../src/tools/create-page.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAoBvD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAkDhF"}
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { F } from '../schemas/descriptions/index.js';
3
- import { formatResponse, handleErrorWithContext } from '../utils/index.js';
3
+ import { formatSimpleResponse, handleErrorWithContext } from '../utils/index.js';
4
4
  // Minimal schema for MCP (full validation by Notion API)
5
5
  const inputSchema = {
6
6
  data_source_id: z.string().describe(F.data_source_id),
@@ -13,7 +13,7 @@ export function registerCreatePage(server, notion) {
13
13
  server.registerTool('create-page', {
14
14
  description: 'Create a new page in a Notion data source. Requires a data_source_id and properties object. ' +
15
15
  'Optionally include initial content blocks, icon, and cover image. ' +
16
- 'Returns the created page with its ID and URL. (API version 2025-09-03)',
16
+ 'Returns the created page ID and URL. (API version 2025-09-03)',
17
17
  inputSchema,
18
18
  }, async ({ data_source_id, properties, children, icon, cover }) => {
19
19
  try {
@@ -31,7 +31,11 @@ export function registerCreatePage(server, notion) {
31
31
  params.cover = cover;
32
32
  }
33
33
  const response = await notion.pages.create(params);
34
- return formatResponse(response);
34
+ // Return minimal response (id + url only)
35
+ return formatSimpleResponse({
36
+ id: response.id,
37
+ url: 'url' in response ? response.url : undefined,
38
+ });
35
39
  }
36
40
  catch (error) {
37
41
  return handleErrorWithContext(error, notion, {
@@ -1 +1 @@
1
- {"version":3,"file":"delete-block.d.ts","sourceRoot":"","sources":["../../../src/tools/delete-block.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAQvD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAkBjF"}
1
+ {"version":3,"file":"delete-block.d.ts","sourceRoot":"","sources":["../../../src/tools/delete-block.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAQvD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAsBjF"}
@@ -1,18 +1,21 @@
1
1
  import { z } from 'zod';
2
2
  import { F } from '../schemas/descriptions/index.js';
3
- import { formatResponse, handleError } from '../utils/index.js';
3
+ import { formatSimpleResponse, handleError } from '../utils/index.js';
4
4
  const inputSchema = {
5
5
  block_id: z.string().describe(F.block_id),
6
6
  };
7
7
  export function registerDeleteBlock(server, notion) {
8
8
  server.registerTool('delete-block', {
9
9
  description: 'Delete a block by its ID. The block will be archived (moved to trash). ' +
10
- 'Returns the archived block object.',
10
+ 'Returns deleted block ID.',
11
11
  inputSchema,
12
12
  }, async ({ block_id }) => {
13
13
  try {
14
14
  const response = await notion.blocks.delete({ block_id });
15
- return formatResponse(response);
15
+ // Return minimal response (id only)
16
+ return formatSimpleResponse({
17
+ id: response.id,
18
+ });
16
19
  }
17
20
  catch (error) {
18
21
  return handleError(error);
@@ -1 +1 @@
1
- {"version":3,"file":"move-page.d.ts","sourceRoot":"","sources":["../../../src/tools/move-page.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAcvD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAuC9E"}
1
+ {"version":3,"file":"move-page.d.ts","sourceRoot":"","sources":["../../../src/tools/move-page.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAcvD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CA2C9E"}
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { F } from '../schemas/descriptions/index.js';
3
- import { formatResponse, handleError } from '../utils/index.js';
3
+ import { formatSimpleResponse, handleError } from '../utils/index.js';
4
4
  const inputSchema = {
5
5
  page_id: z.string().describe(F.page_id),
6
6
  parent: z
@@ -14,7 +14,7 @@ export function registerMovePage(server, notion) {
14
14
  server.registerTool('move-page', {
15
15
  description: 'Move a page to a new parent (page or data source). ' +
16
16
  'Provide either page_id or data_source_id as the new parent. ' +
17
- '(API version 2025-09-03)',
17
+ 'Returns page ID and URL. (API version 2025-09-03)',
18
18
  inputSchema,
19
19
  }, async ({ page_id, parent }) => {
20
20
  try {
@@ -36,7 +36,11 @@ export function registerMovePage(server, notion) {
36
36
  page_id,
37
37
  parent: parentParam,
38
38
  });
39
- return formatResponse(response);
39
+ // Return minimal response (id + url only)
40
+ return formatSimpleResponse({
41
+ id: response.id,
42
+ url: 'url' in response ? response.url : undefined,
43
+ });
40
44
  }
41
45
  catch (error) {
42
46
  return handleError(error);
@@ -1 +1 @@
1
- {"version":3,"file":"query-data-source.d.ts","sourceRoot":"","sources":["../../../src/tools/query-data-source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAGxE,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAmBnE,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAqCrF"}
1
+ {"version":3,"file":"query-data-source.d.ts","sourceRoot":"","sources":["../../../src/tools/query-data-source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAGxE,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAoBnE,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAwCrF"}
@@ -11,15 +11,17 @@ const inputSchema = {
11
11
  sorts: z.array(z.any()).optional().describe(F.sorts),
12
12
  start_cursor: z.string().optional().describe(F.start_cursor),
13
13
  page_size: z.number().optional().describe(F.page_size),
14
- format: z.enum(['json', 'simple']).optional().describe(F.format),
14
+ format: z.enum(['json', 'simple']).optional().default('simple').describe(F.format),
15
+ fields: z.array(z.string()).optional().describe(F.fields),
15
16
  };
16
17
  export function registerQueryDataSource(server, notion) {
17
18
  server.registerTool('query-data-source', {
18
19
  description: 'Query a Notion data source with optional filters and sorts. Returns paginated results. ' +
19
20
  "Use format='simple' (default) for human-readable output with reduced token usage. " +
21
+ 'Use fields parameter to limit which properties are returned (simple format only). ' +
20
22
  '(API version 2025-09-03)',
21
23
  inputSchema,
22
- }, async ({ data_source_id, filter, sorts, start_cursor, page_size, format }) => {
24
+ }, async ({ data_source_id, filter, sorts, start_cursor, page_size, format, fields }) => {
23
25
  try {
24
26
  const response = await notion.dataSources.query({
25
27
  data_source_id,
@@ -31,9 +33,10 @@ export function registerQueryDataSource(server, notion) {
31
33
  if (format === 'simple') {
32
34
  // Filter to full pages and cast for pagesToSimple converter
33
35
  const fullPages = response.results.filter(isFullPage);
34
- const simplePages = pagesToSimple(fullPages);
36
+ const simplePages = pagesToSimple(fullPages, fields);
35
37
  return formatSimplePaginatedResponse(simplePages, response.has_more, response.next_cursor);
36
38
  }
39
+ // JSON format: full Notion API response
37
40
  return formatPaginatedResponse(response.results, response.has_more, response.next_cursor);
38
41
  }
39
42
  catch (error) {
@@ -4,7 +4,7 @@ import { F } from '../schemas/descriptions/index.js';
4
4
  import { formatResponse, formatSimpleResponse, handleError } from '../utils/index.js';
5
5
  const inputSchema = {
6
6
  data_source_id: z.string().describe(F.data_source_id),
7
- format: z.enum(['json', 'simple']).optional().describe(F.format),
7
+ format: z.enum(['json', 'simple']).optional().default('simple').describe(F.format),
8
8
  };
9
9
  export function registerRetrieveDataSource(server, notion) {
10
10
  server.registerTool('retrieve-data-source', {
@@ -29,19 +29,19 @@ export function registerRetrieveDataSource(server, notion) {
29
29
  id: prop.id,
30
30
  type: prop.type,
31
31
  };
32
- // Include options for select/multi_select/status
32
+ // Include options for select/multi_select/status (names only for simple format)
33
33
  const propAny = prop;
34
34
  if (prop.type === 'select' && propAny.select) {
35
35
  const selectProp = propAny.select;
36
- simpleProp.options = selectProp.options;
36
+ simpleProp.options = selectProp.options?.map((o) => o.name);
37
37
  }
38
38
  else if (prop.type === 'multi_select' && propAny.multi_select) {
39
39
  const multiSelectProp = propAny.multi_select;
40
- simpleProp.options = multiSelectProp.options;
40
+ simpleProp.options = multiSelectProp.options?.map((o) => o.name);
41
41
  }
42
42
  else if (prop.type === 'status' && propAny.status) {
43
43
  const statusProp = propAny.status;
44
- simpleProp.options = statusProp.options;
44
+ simpleProp.options = statusProp.options?.map((o) => o.name);
45
45
  }
46
46
  simpleProperties[name] = simpleProp;
47
47
  }
@@ -4,7 +4,7 @@ import { F } from '../schemas/descriptions/index.js';
4
4
  import { formatResponse, formatSimpleResponse, handleError } from '../utils/index.js';
5
5
  const inputSchema = {
6
6
  database_id: z.string().describe(F.database_id),
7
- format: z.enum(['json', 'simple']).optional().describe(F.format),
7
+ format: z.enum(['json', 'simple']).optional().default('simple').describe(F.format),
8
8
  };
9
9
  export function registerRetrieveDatabase(server, notion) {
10
10
  server.registerTool('retrieve-database', {
@@ -1,4 +1,4 @@
1
1
  import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
- import type { NotionClient } from '../notion-client.js';
2
+ import { type NotionClient } from '../notion-client.js';
3
3
  export declare function registerSearch(server: McpServer, notion: NotionClient): void;
4
4
  //# sourceMappingURL=search.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/tools/search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AA6BvD,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAmD5E"}
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/tools/search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAGxE,OAAO,EAAc,KAAK,YAAY,EAA2B,MAAM,qBAAqB,CAAA;AAmC5F,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAyF5E"}
@@ -1,6 +1,8 @@
1
1
  import { z } from 'zod';
2
+ import { pagesToSimple } from '../converters/index.js';
3
+ import { isFullPage } from '../notion-client.js';
2
4
  import { F } from '../schemas/descriptions/index.js';
3
- import { formatPaginatedResponse, handleErrorWithContext } from '../utils/index.js';
5
+ import { formatPaginatedResponse, formatSimplePaginatedResponse, handleErrorWithContext, } from '../utils/index.js';
4
6
  const inputSchema = {
5
7
  query: z.string().optional().describe(F.query),
6
8
  filter: z
@@ -19,16 +21,20 @@ const inputSchema = {
19
21
  .describe(F.sort),
20
22
  start_cursor: z.string().optional().describe(F.start_cursor),
21
23
  page_size: z.number().min(1).max(100).optional().describe(F.page_size),
24
+ format: z.enum(['json', 'simple']).optional().default('simple').describe(F.format),
25
+ fields: z.array(z.string()).optional().describe(F.fields),
22
26
  };
23
27
  export function registerSearch(server, notion) {
24
28
  server.registerTool('search', {
25
29
  description: 'Search across all pages and data sources in the workspace by title and content. ' +
26
30
  'Filter results by type (page or data_source) and sort by last edited time. ' +
27
31
  'Returns paginated results. ' +
32
+ "Use format='simple' (default) for human-readable output with reduced token usage. " +
33
+ 'Use fields parameter to limit which properties are returned (simple format only). ' +
28
34
  'For querying a specific data source with filters, use query-data-source instead. ' +
29
35
  '(API version 2025-09-03)',
30
36
  inputSchema,
31
- }, async ({ query, filter, sort, start_cursor, page_size }) => {
37
+ }, async ({ query, filter, sort, start_cursor, page_size, format, fields }) => {
32
38
  try {
33
39
  const params = {};
34
40
  if (query) {
@@ -47,6 +53,32 @@ export function registerSearch(server, notion) {
47
53
  params.page_size = page_size;
48
54
  }
49
55
  const response = await notion.search(params);
56
+ if (format === 'simple') {
57
+ // Convert results to simple format
58
+ const simpleResults = response.results.map((result) => {
59
+ if (result.object === 'page' && isFullPage(result)) {
60
+ // Use pagesToSimple for pages
61
+ const [simplePage] = pagesToSimple([result], fields);
62
+ return { object: 'page', ...simplePage };
63
+ }
64
+ if (result.object === 'data_source') {
65
+ // Simple format for data sources
66
+ const ds = result;
67
+ return {
68
+ object: 'data_source',
69
+ id: ds.id,
70
+ title: ds.title?.map((t) => t.plain_text).join('') ?? '',
71
+ url: ds.url ?? '',
72
+ };
73
+ }
74
+ // Fallback for partial objects
75
+ return {
76
+ object: result.object,
77
+ id: result.id,
78
+ };
79
+ });
80
+ return formatSimplePaginatedResponse(simpleResults, response.has_more, response.next_cursor);
81
+ }
50
82
  return formatPaginatedResponse(response.results, response.has_more, response.next_cursor);
51
83
  }
52
84
  catch (error) {
@@ -1 +1 @@
1
- {"version":3,"file":"update-block.d.ts","sourceRoot":"","sources":["../../../src/tools/update-block.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAUvD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CA8BjF"}
1
+ {"version":3,"file":"update-block.d.ts","sourceRoot":"","sources":["../../../src/tools/update-block.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAUvD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAmCjF"}
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { F } from '../schemas/descriptions/index.js';
3
- import { formatResponse, handleErrorWithContext } from '../utils/index.js';
3
+ import { formatSimpleResponse, handleErrorWithContext } from '../utils/index.js';
4
4
  const inputSchema = {
5
5
  block_id: z.string().describe(F.block_id),
6
6
  block: z.record(z.string(), z.any()).describe(F.block),
@@ -10,7 +10,8 @@ export function registerUpdateBlock(server, notion) {
10
10
  server.registerTool('update-block', {
11
11
  description: 'Update a block by its ID. Provide the block type and its properties. ' +
12
12
  'Example: { "paragraph": { "rich_text": [{ "text": { "content": "Updated text" } }] } }. ' +
13
- 'Set archived to true to move the block to trash.',
13
+ 'Set archived to true to move the block to trash. ' +
14
+ 'Returns updated block ID.',
14
15
  inputSchema,
15
16
  }, async ({ block_id, block, archived }) => {
16
17
  try {
@@ -22,7 +23,10 @@ export function registerUpdateBlock(server, notion) {
22
23
  params.archived = archived;
23
24
  }
24
25
  const response = await notion.blocks.update(params);
25
- return formatResponse(response);
26
+ // Return minimal response (id only)
27
+ return formatSimpleResponse({
28
+ id: response.id,
29
+ });
26
30
  }
27
31
  catch (error) {
28
32
  return handleErrorWithContext(error, notion, {
@@ -1 +1 @@
1
- {"version":3,"file":"update-data-source.d.ts","sourceRoot":"","sources":["../../../src/tools/update-data-source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAcvD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CA+BtF"}
1
+ {"version":3,"file":"update-data-source.d.ts","sourceRoot":"","sources":["../../../src/tools/update-data-source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAcvD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAmCtF"}
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { F } from '../schemas/descriptions/index.js';
3
- import { formatResponse, handleErrorWithContext } from '../utils/index.js';
3
+ import { formatSimpleResponse, handleErrorWithContext } from '../utils/index.js';
4
4
  // Minimal schema for MCP (full validation by Notion API)
5
5
  const inputSchema = {
6
6
  data_source_id: z.string().describe(F.data_source_id),
@@ -10,7 +10,7 @@ export function registerUpdateDataSource(server, notion) {
10
10
  server.registerTool('update-data-source', {
11
11
  description: 'Update a data source schema (properties/columns). ' +
12
12
  'Use this to add, update, or delete properties. Set a property to null to delete it. ' +
13
- '(API version 2025-09-03)',
13
+ 'Returns data source ID. (API version 2025-09-03)',
14
14
  inputSchema,
15
15
  }, async ({ data_source_id, properties }) => {
16
16
  try {
@@ -19,7 +19,10 @@ export function registerUpdateDataSource(server, notion) {
19
19
  params.properties = properties;
20
20
  }
21
21
  const response = await notion.dataSources.update(params);
22
- return formatResponse(response);
22
+ // Return minimal response (id only)
23
+ return formatSimpleResponse({
24
+ id: response.id,
25
+ });
23
26
  }
24
27
  catch (error) {
25
28
  return handleErrorWithContext(error, notion, {
@@ -1 +1 @@
1
- {"version":3,"file":"update-database.d.ts","sourceRoot":"","sources":["../../../src/tools/update-database.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAGxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAkBvD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAgCpF"}
1
+ {"version":3,"file":"update-database.d.ts","sourceRoot":"","sources":["../../../src/tools/update-database.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAGxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAkBvD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAsCpF"}
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { F } from '../schemas/descriptions/index.js';
3
- import { formatResponse, handleErrorWithContext } from '../utils/index.js';
3
+ import { formatSimpleResponse, handleErrorWithContext } from '../utils/index.js';
4
4
  // Minimal schema for MCP (full validation by Notion API)
5
5
  // Note: Properties (schema) updates should use update-data-source in API 2025-09-03
6
6
  // Uses z.any() for title/description/icon/cover to reduce context size (~3,700 tokens saved)
@@ -17,7 +17,8 @@ const inputSchema = {
17
17
  export function registerUpdateDatabase(server, notion) {
18
18
  server.registerTool('update-database', {
19
19
  description: 'Update a Notion database container. Can modify title, description, icon, cover, inline status, archive status, and lock status. ' +
20
- 'For schema (properties/columns) updates, use update-data-source instead. (API version 2025-09-03)',
20
+ 'For schema (properties/columns) updates, use update-data-source instead. ' +
21
+ 'Returns database ID and URL. (API version 2025-09-03)',
21
22
  inputSchema,
22
23
  }, async ({ database_id, title, description, icon, cover, is_inline, archived, is_locked }) => {
23
24
  try {
@@ -33,7 +34,11 @@ export function registerUpdateDatabase(server, notion) {
33
34
  ...(is_locked !== undefined && { is_locked }),
34
35
  };
35
36
  const response = await notion.databases.update(params);
36
- return formatResponse(response);
37
+ // Return minimal response (id + url only)
38
+ return formatSimpleResponse({
39
+ id: response.id,
40
+ url: 'url' in response ? response.url : undefined,
41
+ });
37
42
  }
38
43
  catch (error) {
39
44
  return handleErrorWithContext(error, notion, {
@@ -1 +1 @@
1
- {"version":3,"file":"update-page.d.ts","sourceRoot":"","sources":["../../../src/tools/update-page.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAoBvD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAsDhF"}
1
+ {"version":3,"file":"update-page.d.ts","sourceRoot":"","sources":["../../../src/tools/update-page.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAoBvD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CA4DhF"}
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { F } from '../schemas/descriptions/index.js';
3
- import { formatResponse, handleErrorWithContext } from '../utils/index.js';
3
+ import { formatSimpleResponse, handleErrorWithContext } from '../utils/index.js';
4
4
  // Minimal schema for MCP (full validation by Notion API)
5
5
  const inputSchema = {
6
6
  page_id: z.string().describe(F.page_id),
@@ -16,7 +16,8 @@ export function registerUpdatePage(server, notion) {
16
16
  'Partial updates are supported - only provide the fields you want to change. ' +
17
17
  'Set icon or cover to null to remove them. ' +
18
18
  'Set archived to true to move the page to trash. ' +
19
- 'Set is_locked to true to lock the page in the UI.',
19
+ 'Set is_locked to true to lock the page in the UI. ' +
20
+ 'Returns updated page ID and URL.',
20
21
  inputSchema,
21
22
  }, async ({ page_id, properties, archived, icon, cover, is_locked }) => {
22
23
  try {
@@ -37,7 +38,11 @@ export function registerUpdatePage(server, notion) {
37
38
  params.is_locked = is_locked;
38
39
  }
39
40
  const response = await notion.pages.update(params);
40
- return formatResponse(response);
41
+ // Return minimal response (id + url only)
42
+ return formatSimpleResponse({
43
+ id: response.id,
44
+ url: 'url' in response ? response.url : undefined,
45
+ });
41
46
  }
42
47
  catch (error) {
43
48
  // Note: update-page uses page_id, not data_source_id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atikk-co-jp/notion-mcp-server",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "MCP server for Notion API - Create, read, update pages and databases",
5
5
  "type": "module",
6
6
  "license": "MIT",