Skip to main content
Glama
SunCreation

MCP Notion Server (@suncreation)

by SunCreation

notion_search

Search Notion pages and databases by title to find specific content. Filter results by type, sort by edit time, and retrieve information in JSON or markdown formats.

Instructions

Search pages or databases by title in Notion

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryNoText to search for in page or database titles
filterNoFilter results by object type (page or database)
sortNoSort order of results
start_cursorNoPagination start cursor
page_sizeNoNumber of results to return (max 100).
formatNoSpecify the response format. 'json' returns the original data structure, 'markdown' returns a more readable format. Use 'markdown' when the user only needs to read the page and isn't planning to write or modify it. Use 'json' when the user needs to read the page with the intention of writing to or modifying it.markdown

Implementation Reference

  • Tool request handler for 'notion_search' that extracts arguments and calls notionClient.search() with query, filter, sort, start_cursor, and page_size parameters
    case "notion_search": {
      const args = request.params.arguments as unknown as args.SearchArgs;
      response = await notionClient.search(
        args.query,
        args.filter,
        args.sort,
        args.start_cursor,
        args.page_size
      );
      break;
    }
  • Tool schema definition for 'notion_search' defining name, description, and inputSchema with properties for query, filter, sort, start_cursor, page_size, and format
    // Search tool
    export const searchTool: Tool = {
      name: "notion_search",
      description: "Search pages or databases by title in Notion",
      inputSchema: {
        type: "object",
        properties: {
          query: {
            type: "string",
            description: "Text to search for in page or database titles",
          },
          filter: {
            type: "object",
            description: "Filter results by object type (page or database)",
            properties: {
              property: {
                type: "string",
                description: "Must be 'object'",
              },
              value: {
                type: "string",
                description: "Either 'page' or 'database'",
              },
            },
          },
          sort: {
            type: "object",
            description: "Sort order of results",
            properties: {
              direction: {
                type: "string",
                enum: ["ascending", "descending"],
              },
              timestamp: {
                type: "string",
                enum: ["last_edited_time"],
              },
            },
          },
          start_cursor: {
            type: "string",
            description: "Pagination start cursor",
          },
          page_size: {
            type: "number",
            description: "Number of results to return (max 100). ",
          },
          format: formatParameter,
        },
      },
    };
  • Tool registration in ListToolsRequestSchema handler where schemas.searchTool is added to the allTools array and filtered by enabledToolsSet
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      const allTools = [
        schemas.appendBlockChildrenTool,
        schemas.retrieveBlockTool,
        schemas.retrieveBlockChildrenTool,
        schemas.deleteBlockTool,
        schemas.updateBlockTool,
        schemas.createPageTool,
        schemas.retrievePageTool,
        schemas.updatePagePropertiesTool,
        schemas.listAllUsersTool,
        schemas.retrieveUserTool,
        schemas.retrieveBotUserTool,
        schemas.createDatabaseTool,
        schemas.queryDatabaseTool,
        schemas.retrieveDatabaseTool,
        schemas.updateDatabaseTool,
        schemas.createDatabaseItemTool,
        schemas.createCommentTool,
        schemas.retrieveCommentsTool,
        schemas.searchTool,
      ];
      return {
        tools: filterTools(allTools, enabledToolsSet),
      };
    });
  • NotionClientWrapper.search() method implementation that makes a POST request to the Notion API /search endpoint with query, filter, sort, start_cursor, and page_size parameters
    async search(
      query?: string,
      filter?: { property: string; value: string },
      sort?: {
        direction: "ascending" | "descending";
        timestamp: "last_edited_time";
      },
      start_cursor?: string,
      page_size?: number
    ): Promise<ListResponse> {
      const body: Record<string, any> = {};
      if (query) body.query = query;
      if (filter) body.filter = filter;
      if (sort) body.sort = sort;
      if (start_cursor) body.start_cursor = start_cursor;
      if (page_size) body.page_size = page_size;
    
      const response = await fetch(`${this.baseUrl}/search`, {
        method: "POST",
        headers: this.headers,
        body: JSON.stringify(body),
      });
    
      return response.json();
    }
  • TypeScript interface SearchArgs defining the argument types for the search function with optional query, filter, sort, start_cursor, page_size, and format properties
    export interface SearchArgs {
      query?: string;
      filter?: { property: string; value: string };
      sort?: {
        direction: "ascending" | "descending";
        timestamp: "last_edited_time";
      };
      start_cursor?: string;
      page_size?: number;
      format?: "json" | "markdown";
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions searching by title but doesn't cover key aspects like whether this is a read-only operation, potential rate limits, authentication needs, or what the output looks like (e.g., pagination details). This leaves significant gaps for a tool with 6 parameters.

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 and front-loaded in a single sentence: 'Search pages or databases by title in Notion'. It wastes no words and directly states the core functionality without unnecessary elaboration.

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?

Given the tool's complexity (6 parameters, nested objects, no output schema, and no annotations), the description is insufficient. It doesn't explain behavioral traits, output format, or usage context, making it incomplete for effective agent use despite the concise structure.

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 minimal parameter semantics beyond the schema, which has 100% coverage. It implies the 'query' parameter is for titles but doesn't elaborate on other parameters like 'filter', 'sort', or 'format'. With high schema coverage, the baseline is 3, as the schema does most of the work.

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 tool's purpose: 'Search pages or databases by title in Notion'. It specifies the action (search) and the target resources (pages or databases), though it doesn't explicitly differentiate from sibling tools like 'notion_query_database' or 'notion_retrieve_page', which is why it doesn't reach a score of 5.

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. It doesn't mention sibling tools or specify contexts where this search tool is preferred over others like 'notion_query_database' or 'notion_retrieve_page', leaving the agent without usage direction.

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

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