create_loop
Create iterative cycles with customizable patterns and rhythms to structure creative workflows and strategic processes.
Instructions
Create a loop - an iterative cycle
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the loop | |
| type | Yes | Type of loop pattern | |
| rhythm | No | Rhythm pattern of iterations |
Implementation Reference
- index.js:430-486 (handler)The handler function that validates input arguments, checks for duplicates, creates and stores a loop object in the internal state (this.loops Map), generates an associated rhythm generator, and returns a formatted text response with visualization.createLoop(args) { const { name, type, rhythm = 'constant' } = args; if (!name || name.trim().length === 0) { return { content: [ { type: 'text', text: `❌ Loop name is required. Please provide a name for the loop.`, }, ], }; } if (!type || type.trim().length === 0) { return { content: [ { type: 'text', text: `❌ Loop type is required. Please specify a type: infinite, convergent, divergent, spiral, or oscillating.`, }, ], }; } if (this.loops.has(name)) { return { content: [ { type: 'text', text: `⚠️ Loop "${name}" already exists. Use a different name or iterate the existing loop.`, }, ], }; } const loop = { name, type, rhythm, iterations: [], created_at: new Date().toISOString(), phase: 0, }; this.loops.set(name, loop); this.rhythms.set(`loop_${name}`, this.generateRhythm(rhythm)); return { content: [ { type: 'text', text: `🔄 Loop "${name}" created!\n\nType: ${type}\nRhythm: ${rhythm}\n\n${this.visualizeLoopPattern(type)}\n\nThe ${type} loop is ready with ${rhythm} rhythm.`, }, ], }; }
- index.js:75-94 (schema)JSON schema defining the input parameters for the create_loop tool: required 'name' (string) and 'type' (enum of loop patterns), optional 'rhythm' (enum of rhythm patterns). Used for validation in MCP calls.inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Name of the loop', }, type: { type: 'string', enum: ['infinite', 'convergent', 'divergent', 'spiral', 'oscillating'], description: 'Type of loop pattern', }, rhythm: { type: 'string', enum: ['constant', 'variable', 'fibonacci', 'exponential', 'harmonic'], description: 'Rhythm pattern of iterations', }, }, required: ['name', 'type'], },
- index.js:72-95 (registration)Tool registration in the ListToolsRequestHandler response array, providing name, description, and full inputSchema for client discovery.{ name: 'create_loop', description: 'Create a loop - an iterative cycle', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Name of the loop', }, type: { type: 'string', enum: ['infinite', 'convergent', 'divergent', 'spiral', 'oscillating'], description: 'Type of loop pattern', }, rhythm: { type: 'string', enum: ['constant', 'variable', 'fibonacci', 'exponential', 'harmonic'], description: 'Rhythm pattern of iterations', }, }, required: ['name', 'type'], }, },
- index.js:333-334 (registration)Dispatch registration in the CallToolRequestHandler switch statement, routing 'create_loop' calls to the createLoop handler method.case 'create_loop': return this.createLoop(args);