get-page
Retrieve specific Notion pages by ID to access content and properties within your workspace.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page_id | Yes | The ID of the page to retrieve |
Implementation Reference
- src/lib/mcp-server.ts:282-313 (registration)MCP tool registration for 'get-page', including inline Zod schema for page_id and the handler function that calls NotionService.retrievePage and formats the responsethis.server.tool( "get-page", { page_id: z.string().describe("The ID of the page to retrieve"), }, async ({ page_id }) => { try { const page = await this.notionService.retrievePage(page_id); return { content: [ { type: "text", text: JSON.stringify(page, null, 2), }, ], }; } catch (error) { console.error("Error in get-page tool:", error); return { content: [ { type: "text", text: `Error: Failed to retrieve page - ${ (error as Error).message }`, }, ], isError: true, }; } } );
- src/lib/notion.ts:168-176 (handler)Core implementation in NotionService that retrieves the page using the official Notion SDKasync retrievePage(pageId: string) { try { return await this.client.pages.retrieve({ page_id: pageId, }); } catch (error) { this.handleError(error); } }
- src/lib/mcp-server.ts:284-285 (schema)Zod input schema for the get-page tool defining the required page_id parameter{ page_id: z.string().describe("The ID of the page to retrieve"),
- src/lib/notion.ts:60-68 (helper)Helper method used by retrievePage to handle and rethrow Notion API errors appropriatelyprivate handleError(error: unknown): never { if (error instanceof APIResponseError) { throw new NotionAPIError(error.message, error.code, error.status); } else if (isNotionClientError(error)) { throw new NotionAPIError(error.message, error.code); } else { throw error; } }