Skip to main content
Glama

export_tree

Export hierarchical research trees to JSON, Markdown, Mermaid, or DOT formats for visualization and documentation purposes.

Instructions

Export a tiling tree in various formats for visualization or documentation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
treeIdYesID of the tree to export
formatYesExport format

Implementation Reference

  • Core handler implementation for the 'export_tree' tool. Dispatches to format-specific export methods based on the input format parameter.
    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}`);
      }
    }
  • Input schema definition for the 'export_tree' tool, specifying required parameters treeId and format with allowed enum values.
    {
      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"],
      },
    },
  • MCP server dispatch handler case for 'export_tree' that invokes treeManager.export and formats the response.
    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' via the TOOLS constant for MCP tool discovery.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: TOOLS,
    }));
  • Helper function used by exportMarkdown to recursively build the markdown representation of the tree.
    private tileToMarkdown(tile: Tile, depth: number): string {
      const indent = "  ".repeat(depth);
      const prefix = "#".repeat(Math.min(depth + 2, 6));
    
      let md = `${indent}${prefix} ${tile.title}\n\n`;
      md += `${indent}${tile.description}\n\n`;
    
      if (tile.splitAttribute) {
        md += `${indent}**Split by:** ${tile.splitAttribute}\n`;
        if (tile.splitRationale) {
          md += `${indent}**Rationale:** ${tile.splitRationale}\n`;
        }
        if (tile.isMECE !== undefined) {
          md += `${indent}**MECE Validated:** ${tile.isMECE ? "✓" : "✗"}\n`;
        }
        md += "\n";
      }
    
      if (tile.isLeaf && tile.evaluation) {
        md += `${indent}**Evaluation:**\n`;
        const evaluation = tile.evaluation;
        if (evaluation.impact) md += `${indent}- Impact: ${evaluation.impact}/10\n`;
        if (evaluation.feasibility) md += `${indent}- Feasibility: ${evaluation.feasibility}/10\n`;
        if (evaluation.uniqueness) md += `${indent}- Uniqueness: ${evaluation.uniqueness}/10\n`;
        if (evaluation.timeframe) md += `${indent}- Timeframe: ${evaluation.timeframe}\n`;
        if (evaluation.notes) md += `${indent}- Notes: ${evaluation.notes}\n`;
        md += "\n";
      }
    
      // Add children
      for (const childId of tile.childrenIds) {
        const child = this.tiles.get(childId);
        if (child) {
          md += this.tileToMarkdown(child, depth + 1);
        }
      }
    
      return md;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It mentions the tool exports 'in various formats' but doesn't disclose behavioral traits such as whether this is a read-only operation, if it requires specific permissions, what the output looks like (e.g., file download vs. inline data), or any rate limits. The description is minimal and lacks critical operational details.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose ('Export a tiling tree') and adds value with the purpose clause ('for visualization or documentation'). There is no wasted verbiage, and every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is incomplete for a tool that likely produces significant output data. It doesn't explain what the exported result contains (e.g., tree structure, metadata) or how it's delivered, leaving gaps for an AI agent to understand the tool's behavior fully. The context signals indicate a simple parameter set, but the description doesn't compensate for the lack of structured output information.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents both parameters (treeId and format with enum values). The description adds no additional meaning beyond what the schema provides, such as explaining what a 'tiling tree' is or how formats differ. Baseline 3 is appropriate since the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Export') and resource ('a tiling tree'), and specifies the purpose ('for visualization or documentation'). It distinguishes from siblings like 'get_trees' (list) or 'get_tree_validation_report' (validation) by focusing on export functionality. However, it doesn't explicitly differentiate from all siblings (e.g., 'explore_path' might also output data).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an existing tree), exclusions, or comparisons to siblings like 'get_trees' (which might retrieve tree data without export formatting). Usage is implied only by the purpose statement.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/k-chrispens/tiling-trees-mcp'

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