Skip to main content
Glama
EoinFalconer

Granola MCP Server

by EoinFalconer

filter_by_folder

Filter meetings by folder to organize and access specific meeting content within the Granola.ai workspace.

Instructions

Filter meetings by folder

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
folder_idYesFolder ID to filter by

Implementation Reference

  • Complete filter_by_folder tool implementation with registration, schema, and handler logic. The tool filters meetings by folder ID, retrieves documents from that folder, and returns a formatted list of document titles and dates.
    // Tool: filter_by_folder server.addTool({ name: 'filter_by_folder', description: 'Filter meetings by folder', parameters: z.object({ folder_id: z.string().describe('Folder ID to filter by') }), execute: async ({ folder_id }) => { await ensureDataLoaded(); // Find the folder const folder = foldersCache.find(f => f.id === folder_id); if (!folder) { return `Folder '${folder_id}' not found`; } const folderName = folder.title || folder.name || 'Untitled'; const docIds = folder.document_ids || []; const docs = docIds .map(id => documentsCache.get(id)) .filter((doc): doc is GranolaDocument => doc !== undefined); if (docs.length === 0) { return `No documents found in folder '${folderName}'`; } const output: string[] = [ `# Documents in Folder: ${folderName}\n`, `Found ${docs.length} document(s)\n` ]; for (const doc of docs) { output.push(`• **${getTitle(doc)}** (${doc.id})`); output.push(` Date: ${formatDate(doc.created_at)}`); output.push(''); } return output.join('\n'); } });
  • Zod schema defining the tool's input parameters: folder_id as a required string with description.
    parameters: z.object({ folder_id: z.string().describe('Folder ID to filter by') }),
  • Execute function that implements the tool logic: loads data, finds folder by ID, retrieves documents, and formats output with titles and dates.
    execute: async ({ folder_id }) => { await ensureDataLoaded(); // Find the folder const folder = foldersCache.find(f => f.id === folder_id); if (!folder) { return `Folder '${folder_id}' not found`; } const folderName = folder.title || folder.name || 'Untitled'; const docIds = folder.document_ids || []; const docs = docIds .map(id => documentsCache.get(id)) .filter((doc): doc is GranolaDocument => doc !== undefined); if (docs.length === 0) { return `No documents found in folder '${folderName}'`; } const output: string[] = [ `# Documents in Folder: ${folderName}\n`, `Found ${docs.length} document(s)\n` ]; for (const doc of docs) { output.push(`• **${getTitle(doc)}** (${doc.id})`); output.push(` Date: ${formatDate(doc.created_at)}`); output.push(''); } return output.join('\n'); }
  • Helper function formatDate that converts date strings to formatted local date strings for display in the tool output.
    function formatDate(dateStr: string | null | undefined): string { if (!dateStr) return 'Unknown date'; try { const date = new Date(dateStr); return date.toLocaleString('en-US', { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', hour12: false }); } catch { return dateStr; }
  • Helper function getTitle that safely extracts document title with fallback to 'Untitled Meeting'.
    function getTitle(doc: GranolaDocument): string { return doc.title || 'Untitled Meeting'; }

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

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