archive_page
Archive (trash) a Notion page by providing its page ID. This tool integrates with the Notion MCP server to manage content removal efficiently and programmatically.
Instructions
Archive (trash) a Notion page
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pageId | Yes | The ID of the page to archive |
Implementation Reference
- src/tools/updatePage.ts:6-26 (handler)The core handler function that executes the archiving of a Notion page using the Notion API by setting the page's archived property to true.export async function archivePage( params: ArchivePageParams ): Promise<CallToolResult> { try { const response = await notion.pages.update({ page_id: params.pageId, archived: true, }); return { content: [ { type: "text", text: `Page archived successfully: ${response.id}`, }, ], }; } catch (error) { return handleNotionError(error); } }
- src/tools/index.ts:15-20 (registration)Registers the 'notion_pages' MCP tool, which dispatches to 'archive_page' action handler among other page operations.server.tool( "notion_pages", "Perform various page operations (create, archive, restore, search, update)", PAGES_OPERATION_SCHEMA, registerPagesOperationTool );
- src/schema/page.ts:92-94 (schema)Zod schema definition for the parameters required by the archive_page action: pageId (string).export const ARCHIVE_PAGE_SCHEMA = { pageId: z.string().describe("The ID of the page to archive"), };
- src/tools/pages.ts:16-17 (registration)Dispatches the 'archive_page' action call to the archivePage handler function within the notion_pages tool.case "archive_page": return archivePage(params.payload.params);
- src/schema/page.ts:154-160 (schema)Part of the discriminated union schema for PAGES_OPERATION_SCHEMA that defines the 'archive_page' action variant.action: z .literal("archive_page") .describe( "Use this action to archive an existing page, making it inactive." ), params: z.object(ARCHIVE_PAGE_SCHEMA), }),