Skip to main content
Glama

apply_layout

Applies automatic layout algorithms to organize diagram nodes. Choose from hierarchical, organic, tree, radialTree, or circle to restructure your draw.io diagram automatically.

Instructions

Trigger a draw.io built-in automatic layout algorithm on the diagram. Requires the diagram to be open in VS Code with the companion extension connected.

Available layouts:

  • "hierarchical": Best for flowcharts, org charts, architecture diagrams. Arranges nodes in layers by rank.

  • "organic": Force-directed layout. Good for graphs with many cross-connections. Nodes spread out naturally.

  • "tree": Compact tree layout. Best for strict tree/hierarchy structures.

  • "radialTree": Tree layout radiating outward from center.

  • "circle": Arranges all nodes in a circle.

After layout, draw.io saves the updated positions back to the .drawio file automatically.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
layoutYesLayout algorithm to apply
spacingNoPrimary spacing between nodes in px (default: layout-dependent, typically 30-50)
filePathNoPath to the .drawio file (scopes layout to the correct editor)
directionNoLayout direction (default: vertical). Only applies to hierarchical and tree layouts.
interRankSpacingNoSpacing between ranks/layers in px (default: layout-dependent). Only for hierarchical and tree.
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It discloses key traits: the necessity of an open editor/extension, and that positions are automatically saved back to the .drawio file. This is valuable context beyond the schema, though it does not mention undo potential or error cases.

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 well-structured and front-loaded with the core action, followed by a prerequisite, a list of layout options, and a post-condition. Each sentence serves a purpose and the layout list is essential for tool selection. No wasted words.

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

Completeness4/5

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

Given the tool's complexity (multiple layout algorithms, prerequisite conditions) and no output schema, the description covers the essential contextual elements: what it does, when it can be used, what options exist, and the side effect on the file. It lacks detail on potential errors or return behavior, but that is not critical for a layout-triggering tool.

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

Parameters4/5

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

Although schema coverage is 100%, the description adds significant semantic value for the 'layout' parameter by detailing each enum option's use case (e.g., 'hierarchical' for flowcharts, 'organic' for force-directed). This goes beyond the schema's minimal 'Layout algorithm to apply' and helps the agent choose correctly.

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

Purpose5/5

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

The description clearly states the tool's function: 'Trigger a draw.io built-in automatic layout algorithm on the diagram.' It uses a specific verb ('trigger') and resource ('draw.io layout algorithm'), distinguishing it from siblings like check_layout, which checks rather than applies a layout.

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

Usage Guidelines4/5

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

The description provides clear context for when to use the tool, including a prerequisite (diagram must be open with companion extension) and guidance on which layout to choose for different diagram types. However, it does not explicitly mention when not to use this tool or name alternative tools, so it stops short of full when/when-not guidance.

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/abossard/drawio-mcp'

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