Skip to main content
Glama

create-page

Add a new page to a Notion database or existing page by specifying parent type, ID, properties, and optional content blocks.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
parent_typeYesType of parent (database or page)
parent_idYesID of the parent database or page
propertiesYesJSON string of page properties
childrenNoJSON string of page content blocks

Implementation Reference

  • MCP tool registration for 'create-page', defining the input schema with Zod, the handler function that processes parameters, calls NotionService.createPage, and returns the result or formatted error.
    this.server.tool(
      "create-page",
      {
        parent_type: z
          .enum(["database_id", "page_id"])
          .describe("Type of parent (database or page)"),
        parent_id: z.string().describe("ID of the parent database or page"),
        properties: z.string().describe("JSON string of page properties"),
        children: z
          .string()
          .optional()
          .describe("JSON string of page content blocks"),
      },
      async ({ parent_type, parent_id, properties, children }) => {
        const params: any = {
          parent: {
            type: parent_type,
            [parent_type]: parent_id,
          },
          properties: JSON.parse(properties),
        };
    
        if (children) {
          params.children = JSON.parse(children);
        }
    
        try {
          const page = await this.notionService.createPage(params);
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(page, null, 2),
              },
            ],
          };
        } catch (error) {
          console.error("Error in create-page tool:", error);
          return {
            content: [
              {
                type: "text",
                text: `Error: Failed to create page - ${
                  (error as Error).message
                }`,
              },
            ],
            isError: true,
          };
        }
      }
    );
  • Helper method in NotionService that executes the actual Notion API call to create a page using the client.pages.create method.
    async createPage(params: CreatePage) {
      try {
        return await this.client.pages.create({
          parent:
            params.parent.type === "database_id"
              ? { database_id: params.parent.database_id! }
              : { page_id: params.parent.page_id! },
          properties: params.properties,
          children: params.children,
          icon: params.icon,
          cover: params.cover,
        });
      } catch (error) {
        this.handleError(error);
      }
    }
  • Zod schema (CreatePageSchema) and TypeScript type (CreatePage) defining the structure for page creation parameters used in NotionService.createPage.
    export const CreatePageSchema = z.object({
      parent: z.object({
        database_id: z.string().optional(),
        page_id: z.string().optional(),
        type: z.enum(["database_id", "page_id"]),
      }),
      properties: z.record(z.any()),
      children: z.array(z.any()).optional(),
      icon: z.any().optional(),
      cover: z.any().optional(),
    });
    
    export type CreatePage = z.infer<typeof CreatePageSchema>;
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tool has no description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tool has no description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Tool has no description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/ramidecodes/mcp-server-notion'

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