Skip to main content
Glama

layout_graph

Compute graph layout coordinates and edge routing paths from graph structure using elkjs. Takes nodes, edges, and layout options; returns node positions and polyline edge sections.

Instructions

Compute graph layout with elkjs and return node positions (x,y,width,height) and edge routing (sections with start/end/bend points). Pass graph structure in graph and layout settings in options separately. Hierarchy: use node.parent (flat) or node.children (nested), not both on one node. Put all edges in graph.edges; they are placed under the lowest common ancestor (LCA). Coordinates: defaults to absolute mode. When options.absoluteCoordinates=true, all returned node x/y and edge section points are in one global coordinate system. When options.absoluteCoordinates=false, values are returned in local coordinate systems (nodes/ports/labels relative to their containing node), so for typical rendering you should keep the default true. Node x/y are the top-left corner of the node bounding box (ELK semantics). edge.sections[] is an ordered list of routed polyline segments; each section has startPoint/endPoint and optional bendPoints (intermediate polyline vertices). edge.junctionPoints? may be present when ELK computes junction points (e.g. hyperedges).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
graphYesGraph with nodes and edges
optionsNoLayout options (algorithm, direction, ...)
Behavior5/5

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

With no annotations, the description fully discloses behavior: absolute vs local coordinate modes, node x/y as top-left corner, edge sections as polyline segments, optional junctionPoints, and the effect of absoluteCoordinates. It also clarifies that all edges go under LCA.

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

Conciseness4/5

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

The description is thorough and well-structured, starting with the overall result and then detailing each aspect. It is somewhat lengthy but every sentence contributes useful information. Could be slightly more concise, but still effective.

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

Completeness5/5

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

Given the complexity of graph layout and the absence of an output schema, the description covers all essential aspects: input structure, hierarchy rules, coordinate modes, edge routing details, and the distinction between graph data and layout options. No obvious gaps.

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?

Schema coverage is 100%, so baseline is 3. The description adds significant value by explaining the relationship between the two parameters (graph vs options), hierarchy constraints, LCA placement of edges, and details about the output coordinate system and edge routing structure.

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 it computes graph layout using elkjs and returns node positions (x,y,width,height) and edge routing (sections with start/end/bend points). It distinguishes itself from siblings like validate_graph and list_algorithms by being the primary layout computation tool.

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?

Provides explicit guidance on how to pass graph structure and options separately, hierarchy rules (parent vs children), edge placement (LCA), and coordinate modes (absolute vs local). However, it doesn't explicitly state when to use this tool versus alternatives like validate_graph, which could be helpful.

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/cocrates/elk-mcp'

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