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.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list_granola_documents"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of documents to return (default: 50) |
Implementation Reference
- src/index.ts:456-480 (handler)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, }, }, }, }, ]; - src/granola-api.ts:105-123 (helper)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; }