Skip to content

Make arrow-to-shape binding easier for AI agents (and document the mechanism) #33

@sammcj

Description

@sammcj

When AI agents create diagrams through the MCP, arrows and lines are almost always unbound/floating. Moving a shape leaves its arrows behind.

This is because creating bound arrows requires knowledge of a complex bidirectional binding protocol that isn't documented in the MCP's read_me output or element format reference.

What's required for a bound arrow today:

  1. The arrow needs startBinding and endBinding objects with elementId, focus, gap, and fixedPoint
  2. Each connected shape needs the arrow added to its boundElements array as {"id": "arrow-id", "type": "arrow"}
  3. Both sides must be consistent or the binding silently fails

This is error-prone even for human developers. For AI agents generating element JSON, it's the single most common diagram quality issue - every agent-generated Excalidraw diagram I've seen has floating arrows.

Suggested improvement options:

  • Option A - Auto-bind: If an arrow's start/end point is within or on the edge of a shape, automatically create the binding. This is how the Excalidraw editor UI works when a human draws an arrow to a shape.
  • Option B - Shorthand properties: Accept startElementId and endElementId on arrow elements in create_view, and have the server resolve the bindings (calculate fixedPoint from geometry, add the arrow to each shape's boundElements).
  • Option C - Document it: At minimum, add the binding format to the read_me output with an example. Currently read_me describes arrow elements but doesn't mention startBinding/endBinding or the requirement for shapes to list bound
    arrows.

Option A would be the biggest improvement since it would make every existing agent's diagrams better without any prompt or code changes.

Reproduction: Create any diagram with create_view where arrows connect shapes. The arrows will not follow the shapes when dragged in the Excalidraw editor, because no binding metadata is present.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions