getWhiteboard
Extract structured data from Heptabase whiteboards, including cards and connections, by specifying the whiteboard ID and desired retrieval depth. Integrates with Heptabase MCP for efficient data analysis and export.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| depth | No | ||
| includeCards | No | ||
| includeConnections | No | ||
| whiteboardId | Yes |
Implementation Reference
- src/server.ts:416-459 (handler)The handler function for the 'getWhiteboard' tool. It initializes the data service if needed, retrieves whiteboard data with optional includes, formats a textual summary of the whiteboard including cards and connections, and handles errors.handler: async (params) => { try { await this.ensureDataServiceInitialized(); const options = { includeCards: params.includeCards || false, includeConnections: params.includeConnections || false, depth: params.depth }; const result = await this.dataService!.getWhiteboard(params.whiteboardId, options); let text = `Whiteboard: ${result.whiteboard.name} (ID: ${result.whiteboard.id})\n`; text += `Created: ${result.whiteboard.createdTime}\n`; text += `Last edited: ${result.whiteboard.lastEditedTime}\n`; if (result.cards) { text += `\nCards: ${result.cards.length}\n`; result.cards.forEach(card => { text += `- ${card.title || 'Untitled'} (ID: ${card.id})\n`; }); } if (result.connections) { text += `\nConnections: ${result.connections.length}\n`; } return { content: [{ type: 'text', text }] }; } catch (error) { console.error('Error in getWhiteboard:', error); const errorMessage = error instanceof Error ? error.message : 'Unknown error'; return { content: [{ type: 'text', text: `Error: ${errorMessage}` }] }; } }
- src/server.ts:407-412 (schema)Zod input schema for the getWhiteboard tool, defining required whiteboardId and optional flags for including cards, connections, and recursion depth.const getWhiteboardSchema = z.object({ whiteboardId: z.string(), includeCards: z.boolean().optional(), includeConnections: z.boolean().optional(), depth: z.number().optional() });
- src/server.ts:462-464 (registration)Registers the 'getWhiteboard' tool with the MCP server using the defined schema and delegates execution to the internal handler.this.server.tool('getWhiteboard', getWhiteboardSchema.shape, async (params) => { return this.tools.getWhiteboard.handler(params); });
- src/server.ts:414-461 (registration)Internal registration of the getWhiteboard tool in the server's tools object.this.tools.getWhiteboard = { inputSchema: getWhiteboardSchema, handler: async (params) => { try { await this.ensureDataServiceInitialized(); const options = { includeCards: params.includeCards || false, includeConnections: params.includeConnections || false, depth: params.depth }; const result = await this.dataService!.getWhiteboard(params.whiteboardId, options); let text = `Whiteboard: ${result.whiteboard.name} (ID: ${result.whiteboard.id})\n`; text += `Created: ${result.whiteboard.createdTime}\n`; text += `Last edited: ${result.whiteboard.lastEditedTime}\n`; if (result.cards) { text += `\nCards: ${result.cards.length}\n`; result.cards.forEach(card => { text += `- ${card.title || 'Untitled'} (ID: ${card.id})\n`; }); } if (result.connections) { text += `\nConnections: ${result.connections.length}\n`; } return { content: [{ type: 'text', text }] }; } catch (error) { console.error('Error in getWhiteboard:', error); const errorMessage = error instanceof Error ? error.message : 'Unknown error'; return { content: [{ type: 'text', text: `Error: ${errorMessage}` }] }; } } };