export_research_tree
Export research trees in JSON, Markdown, Mermaid, or DOT formats to visualize research hierarchies and analyze connections between questions, hypotheses, methods, and results.
Instructions
Export the research tree in various formats for visualization or further analysis
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| format | Yes | Export format | |
| nodeId | No | Export from specific node (optional, default: entire tree) |
Input Schema (JSON Schema)
{
"properties": {
"format": {
"description": "Export format",
"enum": [
"json",
"markdown",
"mermaid",
"dot"
],
"type": "string"
},
"nodeId": {
"description": "Export from specific node (optional, default: entire tree)",
"type": "string"
}
},
"required": [
"format"
],
"type": "object"
}
Implementation Reference
- src/research-tree.ts:975-993 (handler)Core handler method in ResearchTreeManager that exports a tiling tree (research tree) in specified format: json, markdown, mermaid, or dot. Dispatches to private format-specific methods.export(format: string, treeId: string): string { const tree = this.trees.get(treeId); if (!tree) { throw new Error(`Tree ${treeId} not found`); } switch (format) { case "json": return this.exportJSON(tree); case "markdown": return this.exportMarkdown(tree); case "mermaid": return this.exportMermaid(tree); case "dot": return this.exportDOT(tree); default: throw new Error(`Unknown export format: ${format}`); } }
- src/index.ts:344-360 (schema)Input schema definition for the export_tree tool, specifying required treeId and format parameters.name: "export_tree", description: "Export a tiling tree in various formats for visualization or documentation", inputSchema: { type: "object", properties: { treeId: { type: "string", description: "ID of the tree to export", }, format: { type: "string", enum: ["json", "markdown", "mermaid", "dot"], description: "Export format", }, }, required: ["treeId", "format"], },
- src/index.ts:627-640 (registration)Registration of the tool handler in the MCP server's CallToolRequestSchema switch statement, invoking ResearchTreeManager.export.case "export_tree": { const result = treeManager.export( args.format as any, args.treeId as string ); return { content: [ { type: "text", text: result, }, ], }; }
- src/index.ts:393-395 (registration)Registers the list of tools including export_tree for ListTools requests.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS, }));
- src/research-tree.ts:1007-1018 (helper)Helper method to export the tree as formatted Markdown documentation with hierarchical structure.private exportMarkdown(tree: TilingTree): string { let md = `# ${tree.name}\n\n`; md += `**Problem Statement:** ${tree.problemStatement}\n\n`; md += `---\n\n`; const rootTile = this.tiles.get(tree.rootTileId); if (rootTile) { md += this.tileToMarkdown(rootTile, 0); } return md; }