set_context
Define a context to influence creative rhythms by specifying its type and what it affects, such as lines, loops, or vibes.
Instructions
Set the context that influences rhythms
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| influences | No | What this context influences (lines/loops/vibes names) | |
| name | Yes | Context name | |
| type | Yes | Type of context |
Implementation Reference
- index.js:546-573 (handler)The main handler function for the 'set_context' tool. It destructures arguments, creates and stores a context object in the 'contexts' Map, retrieves a rhythm modifier for the context type, applies it to any influenced elements' rhythms if they exist, and returns a success message with visualization.setContext(args) { const { name, type, influences = [] } = args; const context = { name, type, influences, created_at: new Date().toISOString(), }; this.contexts.set(name, context); const rhythmModifier = this.getContextRhythmModifier(type); influences.forEach(element => { if (this.rhythms.has(`line_${element}`) || this.rhythms.has(`loop_${element}`) || this.rhythms.has(`vibe_${element}`)) { this.applyContextToRhythm(element, rhythmModifier); } }); return { content: [ { type: 'text', text: `🎭 Context "${name}" set!\n\nType: ${type}\nInfluences: ${influences.join(', ') || 'None'}\n\n${this.visualizeContext(type)}\n\nThe ${type} context will modify rhythms of influenced elements.`, }, ], }; }
- index.js:129-148 (schema)Input schema definition for the 'set_context' tool, specifying properties like name (required string), type (required enum), and optional influences array.inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Context name', }, type: { type: 'string', enum: ['creative', 'analytical', 'meditative', 'collaborative', 'experimental'], description: 'Type of context', }, influences: { type: 'array', items: { type: 'string' }, description: 'What this context influences (lines/loops/vibes names)', }, }, required: ['name', 'type'], },
- index.js:126-149 (registration)Tool registration in the ListToolsRequestSchema handler's tools array, defining the name, description, and inputSchema for 'set_context'.{ name: 'set_context', description: 'Set the context that influences rhythms', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Context name', }, type: { type: 'string', enum: ['creative', 'analytical', 'meditative', 'collaborative', 'experimental'], description: 'Type of context', }, influences: { type: 'array', items: { type: 'string' }, description: 'What this context influences (lines/loops/vibes names)', }, }, required: ['name', 'type'], }, },
- index.js:337-338 (registration)Registration of the tool handler dispatch in the CallToolRequestSchema switch statement, routing 'set_context' calls to the setContext method.case 'set_context': return this.setContext(args);
- index.js:894-903 (helper)Helper function used by the handler to determine the rhythm modification factor based on the context type.getContextRhythmModifier(contextType) { const modifiers = { creative: 1.5, analytical: 0.8, meditative: 0.5, collaborative: 1.2, experimental: 2.0, }; return modifiers[contextType] || 1.0; }