Skip to main content
Glama
makenotion
by makenotion

API-post-page

Create and customize pages in Notion with structured content, including titles, blocks, icons, and cover images, using natural language commands to streamline workspace organization.

Instructions

Notion | Create a page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
childrenNoThe content to be rendered on the new page, represented as an array of [block objects](https://developers.notion.com/reference/block).
coverNoThe cover image of the new page, represented as a [file object](https://developers.notion.com/reference/file-object).
iconNoThe icon of the new page. Either an [emoji object](https://developers.notion.com/reference/emoji-object) or an [external file object](https://developers.notion.com/reference/file-object)..
parentYes
propertiesYes

Implementation Reference

  • Generic MCP CallToolRequestSchema handler that implements the execution logic for the 'API-post-page' tool (and all similar API tools). It resolves the OpenAPI operation using the tool name as key and executes it via the HTTP client.
    // Handle tool calling
    this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
      const { name, arguments: params } = request.params
    
      // Find the operation in OpenAPI spec
      const operation = this.findOperation(name)
      if (!operation) {
        throw new Error(`Method ${name} not found`)
      }
    
      try {
        // Execute the operation
        const response = await this.httpClient.executeOperation(operation, params)
    
        // Convert response to MCP format
        return {
          content: [
            {
              type: 'text', // currently this is the only type that seems to be used by mcp server
              text: JSON.stringify(response.data), // TODO: pass through the http status code text?
            },
          ],
        }
      } catch (error) {
        console.error('Error in tool call', error)
        if (error instanceof HttpClientError) {
          console.error('HttpClientError encountered, returning structured error', error)
          const data = error.data?.response?.data ?? error.data ?? {}
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify({
                  status: 'error', // TODO: get this from http status code?
                  ...(typeof data === 'object' ? data : { data: data }),
                }),
              },
            ],
          }
        }
        throw error
      }
    })
  • MCP ListToolsRequestSchema handler registration, which dynamically generates and registers the list of tools including 'API-post-page' by combining 'API' with each OpenAPI operationId (e.g., 'post-page') as `${toolName}-${method.name}`.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => {
      const tools: Tool[] = []
    
      // Add methods as separate tools to match the MCP format
      Object.entries(this.tools).forEach(([toolName, def]) => {
        def.methods.forEach(method => {
          const toolNameWithMethod = `${toolName}-${method.name}`;
          const truncatedToolName = this.truncateToolName(toolNameWithMethod);
          tools.push({
            name: truncatedToolName,
            description: method.description,
            inputSchema: method.inputSchema as Tool['inputSchema'],
          })
        })
      })
    
      return { tools }
    })
  • OpenAPIToMCPConverter.convertToMCPTools generates the tool definitions and schemas for all operations under 'API' tool group, creating inputSchema from parameters/requestBody and mapping 'API-post-page' to the corresponding OpenAPI POST /page operation (assuming operationId='post-page').
      const apiName = 'API'
    
      const openApiLookup: Record<string, OpenAPIV3.OperationObject & { method: string; path: string }> = {}
      const tools: Record<string, { methods: NewToolMethod[] }> = {
        [apiName]: { methods: [] },
      }
      const zip: Record<string, { openApi: OpenAPIV3.OperationObject & { method: string; path: string }; mcp: NewToolMethod }> = {}
      for (const [path, pathItem] of Object.entries(this.openApiSpec.paths || {})) {
        if (!pathItem) continue
    
        for (const [method, operation] of Object.entries(pathItem)) {
          if (!this.isOperation(method, operation)) continue
    
          const mcpMethod = this.convertOperationToMCPMethod(operation, method, path)
          if (mcpMethod) {
            const uniqueName = this.ensureUniqueName(mcpMethod.name)
            mcpMethod.name = uniqueName
            mcpMethod.description = this.getDescription(operation.summary || operation.description || '')
            tools[apiName]!.methods.push(mcpMethod)
            openApiLookup[apiName + '-' + uniqueName] = { ...operation, method, path }
            zip[apiName + '-' + uniqueName] = { openApi: { ...operation, method, path }, mcp: mcpMethod }
          }
        }
      }
    
      return { tools, openApiLookup, zip }
    }
  • Helper function that resolves the tool name 'API-post-page' to the specific OpenAPI operation details stored under that key in openApiLookup.
    private findOperation(operationId: string): (OpenAPIV3.OperationObject & { method: string; path: string }) | null {
      return this.openApiLookup[operationId] ?? null
    }
  • Core helper that performs the HTTP execution for the resolved OpenAPI operation of 'API-post-page', using openapi-client-axios generated client.
    async executeOperation<T = any>(
      operation: OpenAPIV3.OperationObject & { method: string; path: string },
      params: Record<string, any> = {},
    ): Promise<HttpClientResponse<T>> {
      const api = await this.api
      const operationId = operation.operationId
      if (!operationId) {
        throw new Error('Operation ID is required')
      }
    
      // Handle file uploads if present
      const formData = await this.prepareFileUpload(operation, params)
    
      // Separate parameters based on their location
      const urlParameters: Record<string, any> = {}
      const bodyParams: Record<string, any> = formData || { ...params }
    
      // Extract path and query parameters based on operation definition
      if (operation.parameters) {
        for (const param of operation.parameters) {
          if ('name' in param && param.name && param.in) {
            if (param.in === 'path' || param.in === 'query') {
              if (params[param.name] !== undefined) {
                urlParameters[param.name] = params[param.name]
                if (!formData) {
                  delete bodyParams[param.name]
                }
              }
            }
          }
        }
      }
    
      // Add all parameters as url parameters if there is no requestBody defined
      if (!operation.requestBody && !formData) {
        for (const key in bodyParams) {
          if (bodyParams[key] !== undefined) {
            urlParameters[key] = bodyParams[key]
            delete bodyParams[key]
          }
        }
      }
    
      const operationFn = (api as any)[operationId]
      if (!operationFn) {
        throw new Error(`Operation ${operationId} not found`)
      }
    
      try {
        // If we have form data, we need to set the correct headers
        const hasBody = Object.keys(bodyParams).length > 0
        const headers = formData
          ? formData.getHeaders()
          : { ...(hasBody ? { 'Content-Type': 'application/json' } : { 'Content-Type': null }) }
        const requestConfig = {
          headers: {
            ...headers,
          },
        }
    
        // first argument is url parameters, second is body parameters
        const response = await operationFn(urlParameters, hasBody ? bodyParams : undefined, requestConfig)
    
        // Convert axios headers to Headers object
        const responseHeaders = new Headers()
        Object.entries(response.headers).forEach(([key, value]) => {
          if (value) responseHeaders.append(key, value.toString())
        })
    
        return {
          data: response.data,
          status: response.status,
          headers: responseHeaders,
        }
      } catch (error: any) {
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure but only states the basic action. It doesn't mention authentication requirements, rate limits, error conditions, what happens on success (e.g., returns new page ID), or whether the operation is idempotent. For a creation tool with no annotation coverage, this is inadequate.

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

Conciseness5/5

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

The description is extremely concise at just three words, front-loading the essential information ('Notion | Create a page') with zero wasted words. Every element earns its place, making it highly efficient despite potential completeness issues.

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

Completeness2/5

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

For a creation tool with 5 parameters (2 required), no annotations, no output schema, and complex nested objects, the description is severely incomplete. It doesn't address what the tool returns, error handling, authentication needs, or provide any context about the Notion API integration. The conciseness comes at the expense of necessary context.

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

Parameters3/5

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

The description adds no parameter information beyond what's in the schema (which has 60% coverage). It doesn't explain the purpose of 'parent' or 'properties' parameters, nor does it provide context about optional parameters like 'children', 'cover', and 'icon'. With moderate schema coverage, the baseline is appropriate.

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

Purpose4/5

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

The description clearly states the action ('Create a page') and the resource ('Notion'), making the purpose immediately understandable. However, it doesn't differentiate this from sibling tools like 'API-create-a-database' or 'API-patch-page' beyond the basic resource type, which prevents a perfect score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'API-patch-page' (for updates) and 'API-create-a-database' (for creating databases), there's no indication of when this specific page creation tool is appropriate, leaving usage context unclear.

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

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

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