Skip to main content
Glama

create_sequence_diagram

Generate UML sequence diagrams to visualize interactions between participants, creating .drawio files for use in Draw.io.

Instructions

Create a UML sequence diagram showing interactions between participants/actors.

Input Schema

NameRequiredDescriptionDefault
filenameYesName for the output .drawio file (extension will be added automatically)
participantsYesArray of participant names
interactionsYesArray of interactions between participants

Input Schema (JSON Schema)

{ "properties": { "filename": { "description": "Name for the output .drawio file (extension will be added automatically)", "type": "string" }, "interactions": { "description": "Array of interactions between participants", "items": { "properties": { "dashed": { "description": "Use dashed line for return messages", "type": "boolean" }, "from": { "description": "Source participant name", "type": "string" }, "message": { "description": "Message/interaction label", "type": "string" }, "to": { "description": "Target participant name", "type": "string" } }, "required": [ "from", "to", "message" ], "type": "object" }, "type": "array" }, "participants": { "description": "Array of participant names", "items": { "type": "string" }, "type": "array" } }, "required": [ "filename", "participants", "interactions" ], "type": "object" }

Implementation Reference

  • MCP tool call handler for create_sequence_diagram: invokes generator to produce diagram XML, saves to file, and returns success message with file path.
    handleCreateSequenceDiagram(args) { const xml = this.generator.createSequenceDiagram(args.participants, args.interactions); const filePath = this.saveToFile(args.filename, xml); return { content: [ { type: 'text', text: `Sequence diagram created successfully and saved to: ${filePath}\n\nYou can open this file directly in Draw.io.`, }, ], }; }
  • JSON schema defining the input parameters for the create_sequence_diagram tool: filename, participants array, and interactions array with from/to/message/dashed.
    inputSchema: { type: 'object', properties: { filename: { type: 'string', description: 'Name for the output .drawio file (extension will be added automatically)', }, participants: { type: 'array', description: 'Array of participant names', items: { type: 'string' }, }, interactions: { type: 'array', description: 'Array of interactions between participants', items: { type: 'object', properties: { from: { type: 'string', description: 'Source participant name', }, to: { type: 'string', description: 'Target participant name', }, message: { type: 'string', description: 'Message/interaction label', }, dashed: { type: 'boolean', description: 'Use dashed line for return messages', }, }, required: ['from', 'to', 'message'], }, }, }, required: ['filename', 'participants', 'interactions'], },
  • index.js:105-149 (registration)
    Registration of the create_sequence_diagram tool in the ListTools response, providing name, description, and input schema.
    { name: 'create_sequence_diagram', description: 'Create a UML sequence diagram showing interactions between participants/actors.', inputSchema: { type: 'object', properties: { filename: { type: 'string', description: 'Name for the output .drawio file (extension will be added automatically)', }, participants: { type: 'array', description: 'Array of participant names', items: { type: 'string' }, }, interactions: { type: 'array', description: 'Array of interactions between participants', items: { type: 'object', properties: { from: { type: 'string', description: 'Source participant name', }, to: { type: 'string', description: 'Target participant name', }, message: { type: 'string', description: 'Message/interaction label', }, dashed: { type: 'boolean', description: 'Use dashed line for return messages', }, }, required: ['from', 'to', 'message'], }, }, }, required: ['filename', 'participants', 'interactions'], }, },
  • Core helper method in DrawioGenerator class that builds the sequence diagram by creating actor shapes for participants and styled connectors for interactions, then generates the full Draw.io XML.
    createSequenceDiagram(participants, interactions) { const elements = []; const participantSpacing = 200; const interactionHeight = 100; const participantIds = {}; // Create participants participants.forEach((participant, index) => { const x = 100 + (index * participantSpacing); const shape = this.createShape(participant, 'actor', x, 50, 40, 80); elements.push(shape); participantIds[participant] = shape.id; }); // Create interactions interactions.forEach((interaction, index) => { const sourceId = participantIds[interaction.from]; const targetId = participantIds[interaction.to]; if (sourceId && targetId) { const connector = this.createConnector( sourceId, targetId, interaction.message, 'edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;dashed=' + (interaction.dashed ? '1' : '0') + ';' ); elements.push(connector); } }); return this.generateDiagram(elements); }

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/thechandanbhagat/diagram-master'

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