Get Diagram Source
diagrams_getGet the raw source of a PlantUML or Mermaid diagram by file path, returning the full text or a specific character window for large diagrams.
Instructions
Retrieve the raw source text of a single PlantUML or Mermaid diagram, in full or as an explicit character window.
Args:
relative_path (string): Path to the diagram relative to the diagrams root, as returned by diagrams_list
offset (number, optional): Zero-based character offset where the returned window starts (default: 0)
max_chars (number, optional): Maximum characters to return from offset (1-100000). Omit to return the full source
Returns: JSON with schema: { "relative_path": string, "type": "plantuml" | "mermaid", "content": string, // full source, or the requested [offset, offset+max_chars) window "is_partial": boolean, // true when content is a window rather than the full source "offset": number, // effective character offset of this window "total_chars": number, // full source length in characters "returned_chars": number,// length of the returned content "has_more": boolean // true when source after this window remains }
The text block always equals structuredContent.content. Content is never silently truncated: omitting offset/max_chars returns everything, and requesting a window is always reported via is_partial/has_more.
Examples:
Use when: "Show me the order-flow diagram" -> relative_path="system/order-flow.puml"
Use when: "Read the first 2000 characters of the big diagram" -> relative_path="...", offset=0, max_chars=2000, then offset=2000 for the next window
Don't use when: You need to list what diagrams exist first (use diagrams_list)
Error Handling:
Returns "Error: No diagram found at ''" if the file doesn't exist
Returns "Error: Refused to access path outside the diagrams root" if relative_path attempts to escape the diagrams directory (e.g. via '../..')
Returns "Error: Invalid source window: ..." if offset/max_chars are negative, non-integer, or max_chars is outside 1-100000
Returns "Error: offset is out of range ..." if offset points past the end of the source
Unexpected internal failures return a generic "Error: Unexpected internal error ..." with isError:true and are logged to stderr without source, paths, or secrets
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| offset | No | Zero-based character offset into the diagram source where the returned window starts (default: 0). | |
| max_chars | No | Maximum characters to return starting at offset (1-100000). Omit to return the full source. | |
| relative_path | Yes | Path to the diagram, relative to the diagrams root (e.g. 'system/order-flow.puml'). Get this from diagrams_list. |