Skip to main content
Glama
awkoy

notion-mcp-server

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
NameRequiredDescriptionDefault
pageIdYesThe ID of the page to archive

Implementation Reference

  • 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);
      }
    }
  • 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
    );
  • 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"),
    };
  • Dispatches the 'archive_page' action call to the archivePage handler function within the notion_pages tool.
    case "archive_page":
      return archivePage(params.payload.params);
  • 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),
    }),

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/awkoy/notion-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server