Skip to main content
Glama

notion_retrieve_page

Retrieve specific properties of a Notion page by its ID using the Notion API. Filter the response to include only selected properties for efficient data management.

Instructions

Retrieves a Notion page by ID. Returns page properties, not page content.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filter_propertiesNoOptional list of property IDs to filter the response
page_idYesThe ID of the page to retrieve

Implementation Reference

  • The handleRetrievePageTool function that executes the core logic of the 'notion_retrieve_page' tool by retrieving the page via NotionClient.retrievePage and returning formatted content or error.
    export async function handleRetrievePageTool(client: NotionClient, args: any) {
        try {
            const retrieveArgs: RetrievePageArgs = {
                page_id: args.page_id,
                ...(args.filter_properties && { filter_properties: args.filter_properties })
            };
    
            const response = await client.retrievePage(retrieveArgs);
            
            return {
                content: [
                    {
                        type: 'text',
                        text: `Retrieved page: ${response.id}\n` +
                              `URL: ${'url' in response ? response.url : 'N/A'}\n` +
                              `Created: ${'created_time' in response ? response.created_time : 'N/A'}\n` +
                              `Last edited: ${'last_edited_time' in response ? response.last_edited_time : 'N/A'}\n` +
                              `Properties: ${'properties' in response ? JSON.stringify(response.properties, null, 2) : 'N/A'}`
                    }
                ]
            };
        } catch (error: any) {
            return {
                content: [
                    {
                        type: 'text',
                        text: `Error retrieving page: ${error.message || 'Unknown error'}`
                    }
                ],
                isError: true
            };
        }
    }
  • The tool definition including the input schema for validating arguments like page_id and optional filter_properties.
    export const retrievePageToolDefinition: Tool = {
        name: 'notion_retrieve_page',
        description: 'Retrieves a Notion page by ID. Returns page properties, not page content.',
        inputSchema: {
            type: 'object',
            properties: {
                page_id: {
                    type: 'string',
                    description: 'The ID of the page to retrieve'
                },
                filter_properties: {
                    type: 'array',
                    items: {
                        type: 'string'
                    },
                    description: 'Optional list of property IDs to filter the response'
                }
            },
            required: ['page_id']
        }
    };
  • src/server.ts:43-50 (registration)
    Registration of the 'notion_retrieve_page' tool definition (as retrievePageToolDefinition) in the ListTools request handler.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
        tools: [
            createPageToolDefinition,
            retrievePageToolDefinition,
            updatePageToolDefinition,
            retrievePagePropertyToolDefinition
        ],
    }));
  • src/server.ts:52-75 (registration)
    Dispatch registration in the CallTool request handler switch statement, mapping 'notion_retrieve_page' to handleRetrievePageTool.
        this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
            const { name, arguments: args } = request.params;
    
            switch (name) {
                case 'notion_create_page':
                    return handleCreatePageTool(this.client, args);
                
                case 'notion_retrieve_page':
                    return handleRetrievePageTool(this.client, args);
                
                case 'notion_update_page':
                    return handleUpdatePageTool(this.client, args);
                
                case 'notion_retrieve_page_property':
                    return handleRetrievePagePropertyTool(this.client, args);
                
                default:
                    throw new McpError(
                        ErrorCode.MethodNotFound,
                        `Unknown tool: ${name}`
                    );
            }
        });
    }
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/michaelwaves/notion-mcp'

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