list_workspaces
Retrieve all available workspaces in Granola.ai to organize and access meeting notes, transcripts, and content across projects.
Instructions
List all available workspaces
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/server.ts:259-284 (registration)Tool registration for 'list_workspaces' using FastMCP server.addTool(). Includes tool name, description, parameters schema (empty object), and the execute handler function that lists all available workspaces from workspacesCache.// Tool: list_workspaces server.addTool({ name: 'list_workspaces', description: 'List all available workspaces', parameters: z.object({}), execute: async () => { await ensureDataLoaded(); if (workspacesCache.length === 0) { return 'No workspaces found'; } const output: string[] = ['# Workspaces\n']; for (const ws of workspacesCache) { output.push(`## ${ws.name || 'Unnamed Workspace'}`); output.push(`**ID:** ${ws.id}`); if (ws.created_at) { output.push(`**Created:** ${formatDate(ws.created_at)}`); } output.push(''); } return output.join('\n'); } });
- src/server.ts:264-283 (handler)Handler function that executes the list_workspaces tool. Ensures data is loaded, checks if workspacesCache is empty, then formats and returns a markdown list of all workspaces with their ID, name, and creation date.execute: async () => { await ensureDataLoaded(); if (workspacesCache.length === 0) { return 'No workspaces found'; } const output: string[] = ['# Workspaces\n']; for (const ws of workspacesCache) { output.push(`## ${ws.name || 'Unnamed Workspace'}`); output.push(`**ID:** ${ws.id}`); if (ws.created_at) { output.push(`**Created:** ${formatDate(ws.created_at)}`); } output.push(''); } return output.join('\n'); }
- src/types.ts:24-29 (schema)Workspace interface defining the structure of workspace objects with id, name, created_at, and optional owner_id fields. This is the type used for workspacesCache items.export interface Workspace { id: string; name: string; created_at: string; owner_id?: string; }
- src/server.ts:30-35 (helper)ensureDataLoaded helper function called by the list_workspaces handler. Checks if cache is empty or stale and triggers loadData() if needed to ensure fresh data.async function ensureDataLoaded() { const now = Date.now(); if (documentsCache.size === 0 || (now - lastFetchTime) > CACHE_TTL) { await loadData(); } }
- src/server.ts:65-80 (helper)formatDate helper function used by the list_workspaces handler to format workspace creation dates in a human-readable format with local timezone.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; } }