Skip to main content
Glama
btn0s

Granola MCP Server

by btn0s

list_granola_documents

Retrieve and display all Granola documents with basic metadata using the Granola MCP Server. Specify a limit to control the number of documents returned.

Instructions

List all Granola documents with basic metadata.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of documents to return (default: 50)

Implementation Reference

  • Handler for the 'list_granola_documents' tool. Retrieves all documents using apiClient.getAllDocuments(), limits them, and returns JSON with id, title, created_at, updated_at.
    case "list_granola_documents": {
      const limit = (args?.limit as number) || 50;
      const allDocs = await apiClient.getAllDocuments();
      const docs = allDocs.slice(0, limit);
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(
              {
                count: docs.length,
                documents: docs.map((doc) => ({
                  id: doc.id,
                  title: doc.title || "Untitled",
                  created_at: doc.created_at,
                  updated_at: doc.updated_at,
                })),
              },
              null,
              2
            ),
          },
        ],
      };
    }
  • src/index.ts:136-150 (registration)
    Tool registration in the tools array, including name, description, and inputSchema.
      {
        name: "list_granola_documents",
        description: "List all Granola documents with basic metadata.",
        inputSchema: {
          type: "object",
          properties: {
            limit: {
              type: "number",
              description: "Maximum number of documents to return (default: 50)",
              default: 50,
            },
          },
        },
      },
    ];
  • Helper method getAllDocuments() in GranolaApiClient that paginates and fetches all Granola documents from the API using fetchDocuments.
    async getAllDocuments(): Promise<GranolaDocument[]> {
      const allDocs: GranolaDocument[] = [];
      let offset = 0;
      const limit = 100;
    
      while (true) {
        const docs = await this.fetchDocuments(limit, offset);
        if (docs.length === 0) {
          break;
        }
        allDocs.push(...docs);
        offset += limit;
        if (offset > 10000) {
          break;
        }
      }
    
      return allDocs;
    }

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