exportWhiteboard
Export Heptabase whiteboards to markdown, JSON, or HTML formats with options to include cards, connections, and metadata for enhanced data organization and sharing.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"whiteboardId": "<whiteboardId>",
"outputPath": "<outputPath>"
},
"name": "exportWhiteboard"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| format | No | markdown | |
| includeCards | No | ||
| includeConnections | No | ||
| includeMetadata | No | ||
| outputPath | Yes | ||
| whiteboardId | Yes |
Implementation Reference
- src/tools/export.ts:21-58 (handler)Main handler function that fetches whiteboard data, generates export content in markdown, json, or html format, writes it to the specified output path, and returns a success message.
export async function exportWhiteboard( dataService: HeptabaseDataService, params: z.infer<typeof exportWhiteboardSchema> ) { const data = await dataService.getWhiteboard(params.whiteboardId, { includeCards: params.includeCards, includeConnections: params.includeConnections }); let content = ''; switch (params.format) { case 'markdown': content = await generateMarkdownExport(data, params); break; case 'json': content = JSON.stringify(data, null, 2); break; case 'html': content = await generateHtmlExport(data, params); break; } await fs.mkdir(path.dirname(params.outputPath), { recursive: true }); await fs.writeFile(params.outputPath, content, 'utf8'); const response = [`Exported whiteboard to ${params.outputPath}`]; if (params.includeMetadata) { response.push('Included metadata in export'); } return { content: [{ type: 'text', text: response.join('\n') }] }; } - src/tools/export.ts:6-13 (schema)Zod schema defining the input parameters for the exportWhiteboard tool, including whiteboard ID, export format, inclusion flags, and output path.
export const exportWhiteboardSchema = z.object({ whiteboardId: z.string(), format: z.enum(['markdown', 'json', 'html']).optional().default('markdown'), includeCards: z.boolean().optional().default(true), includeConnections: z.boolean().optional().default(false), includeMetadata: z.boolean().optional().default(false), outputPath: z.string() }); - src/server.ts:668-681 (registration)Tool registration in the MCP server: imports the handler and schema from export.ts, wraps the handler to ensure data service initialization, and registers it with this.server.tool.
const { exportWhiteboard, summarizeWhiteboard, exportWhiteboardSchema, summarizeWhiteboardSchema } = require('./tools/export'); // exportWhiteboard tool this.tools.exportWhiteboard = { inputSchema: exportWhiteboardSchema, handler: async (params) => { await this.ensureDataServiceInitialized(); return exportWhiteboard(this.dataService, params); } }; this.server.tool('exportWhiteboard', exportWhiteboardSchema.shape, async (params: z.infer<typeof exportWhiteboardSchema>) => { return this.tools.exportWhiteboard.handler(params); });