create_flowchart
Generate flowchart diagrams with process boxes, decision diamonds, and connectors to visualize sequential workflows and decision processes.
Instructions
Create a flowchart diagram with sequential steps. Supports process boxes, decision diamonds, terminators, and connectors.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filename | Yes | Name for the output .drawio file (extension will be added automatically) | |
| steps | Yes | Array of flowchart steps |
Input Schema (JSON Schema)
{
"properties": {
"filename": {
"description": "Name for the output .drawio file (extension will be added automatically)",
"type": "string"
},
"steps": {
"description": "Array of flowchart steps",
"items": {
"properties": {
"connectorLabel": {
"description": "Optional label for the connector to this step",
"type": "string"
},
"label": {
"description": "Text label for the step",
"type": "string"
},
"type": {
"description": "Shape type for the step",
"enum": [
"process",
"decision",
"terminator",
"data",
"document",
"delay"
],
"type": "string"
}
},
"required": [
"label"
],
"type": "object"
},
"type": "array"
}
},
"required": [
"filename",
"steps"
],
"type": "object"
}
Implementation Reference
- index.js:68-104 (registration)Registration of the create_flowchart tool in the ListToolsRequestSchema handler, including name, description, and input schema.{ name: 'create_flowchart', description: 'Create a flowchart diagram with sequential steps. Supports process boxes, decision diamonds, terminators, and connectors.', inputSchema: { type: 'object', properties: { filename: { type: 'string', description: 'Name for the output .drawio file (extension will be added automatically)', }, steps: { type: 'array', description: 'Array of flowchart steps', items: { type: 'object', properties: { label: { type: 'string', description: 'Text label for the step', }, type: { type: 'string', enum: ['process', 'decision', 'terminator', 'data', 'document', 'delay'], description: 'Shape type for the step', }, connectorLabel: { type: 'string', description: 'Optional label for the connector to this step', }, }, required: ['label'], }, }, }, required: ['filename', 'steps'], }, },
- index.js:347-358 (handler)MCP tool handler function for create_flowchart that generates the diagram XML via the DrawioGenerator and saves it to a file.handleCreateFlowchart(args) { const xml = this.generator.createFlowchart(args.steps); const filePath = this.saveToFile(args.filename, xml); return { content: [ { type: 'text', text: `Flowchart diagram created successfully and saved to: ${filePath}\n\nYou can open this file directly in Draw.io.`, }, ], }; }
- index.js:71-103 (schema)Input schema defining parameters for the create_flowchart tool: filename and array of steps with labels, types, and optional connector labels.inputSchema: { type: 'object', properties: { filename: { type: 'string', description: 'Name for the output .drawio file (extension will be added automatically)', }, steps: { type: 'array', description: 'Array of flowchart steps', items: { type: 'object', properties: { label: { type: 'string', description: 'Text label for the step', }, type: { type: 'string', enum: ['process', 'decision', 'terminator', 'data', 'document', 'delay'], description: 'Shape type for the step', }, connectorLabel: { type: 'string', description: 'Optional label for the connector to this step', }, }, required: ['label'], }, }, }, required: ['filename', 'steps'], },
- drawio-generator.js:120-146 (helper)Core helper function in DrawioGenerator that creates sequential flowchart shapes and connectors based on steps, then generates the Draw.io XML.createFlowchart(steps) { const elements = []; const spacing = 150; let currentY = 50; let previousId = null; for (let i = 0; i < steps.length; i++) { const step = steps[i]; const type = step.type || 'process'; const label = step.label || `Step ${i + 1}`; const width = step.width || 120; const height = step.height || 60; const shape = this.createShape(label, type, 300, currentY, width, height); elements.push(shape); if (previousId) { const connector = this.createConnector(previousId, shape.id, step.connectorLabel || ''); elements.push(connector); } previousId = shape.id; currentY += spacing; } return this.generateDiagram(elements); }