Skip to main content
Glama
btn0s

Granola MCP Server

by btn0s

search_granola_notes

Search through Granola notes and documents using a query string to find relevant meeting content and information.

Instructions

Search through Granola notes/documents by query string. Returns matching documents with their content.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query to find matching notes/documents
limitNoMaximum number of results to return (default: 10)

Implementation Reference

  • Handler function for the 'search_granola_notes' tool. Searches Granola documents using the API client, processes content by converting ProseMirror to Markdown, and returns results as JSON.
    case "search_granola_notes": {
      const query = args?.query as string;
      const limit = (args?.limit as number) || 10;
      const results = await apiClient.searchDocuments(query, limit);
    
      const processedResults = await Promise.all(
        results.map(async (doc) => {
          let markdown = "";
          let hasContent = false;
    
          if (
            doc.last_viewed_panel &&
            typeof doc.last_viewed_panel === "object" &&
            doc.last_viewed_panel.content &&
            typeof doc.last_viewed_panel.content === "object" &&
            doc.last_viewed_panel.content.type === "doc"
          ) {
            markdown = convertProseMirrorToMarkdown(
              doc.last_viewed_panel.content
            );
            hasContent = markdown.trim().length > 0;
          } else if (
            doc.notes &&
            typeof doc.notes === "object" &&
            doc.notes.type === "doc"
          ) {
            markdown = convertProseMirrorToMarkdown(doc.notes);
            hasContent = markdown.trim().length > 0;
          }
    
          return {
            id: doc.id,
            title: doc.title || "Untitled",
            markdown: markdown.substring(0, 2000) || "",
            content_preview: markdown.substring(0, 500) || "",
            has_content: hasContent,
            created_at: doc.created_at,
            updated_at: doc.updated_at,
          };
        })
      );
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(
              {
                query,
                count: processedResults.length,
                results: processedResults,
              },
              null,
              2
            ),
          },
        ],
      };
    }
  • Input schema definition for the 'search_granola_notes' tool, specifying query (required string) and optional limit (number).
    inputSchema: {
      type: "object",
      properties: {
        query: {
          type: "string",
          description: "Search query to find matching notes/documents",
        },
        limit: {
          type: "number",
          description: "Maximum number of results to return (default: 10)",
          default: 10,
        },
      },
      required: ["query"],
    },
  • src/index.ts:28-47 (registration)
    Registration of the 'search_granola_notes' tool in the tools array, which is returned by the ListTools handler.
    {
      name: "search_granola_notes",
      description:
        "Search through Granola notes/documents by query string. Returns matching documents with their content.",
      inputSchema: {
        type: "object",
        properties: {
          query: {
            type: "string",
            description: "Search query to find matching notes/documents",
          },
          limit: {
            type: "number",
            description: "Maximum number of results to return (default: 10)",
            default: 10,
          },
        },
        required: ["query"],
      },
    },

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/btn0s/granola-mcp'

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