Skip to main content
Glama

insert

Add code at a precise line number to modify Strudel music patterns during live coding sessions.

Instructions

Insert code at specific line

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
positionYesLine number
codeYesCode to insert

Implementation Reference

  • The main handler logic for the 'insert' MCP tool. Validates inputs, splits the current pattern into lines, inserts the new code at the specified position using Array.splice, and writes the updated pattern back using writePatternSafe.
    case 'insert': InputValidator.validatePositiveInteger(args.position, 'position'); InputValidator.validateStringLength(args.code, 'code', 10000, true); const lines = (await this.getCurrentPatternSafe()).split('\n'); lines.splice(args.position, 0, args.code); return await this.writePatternSafe(lines.join('\n'));
  • Registration of the 'insert' tool in the getTools() method, including name, description, and input schema definition for MCP protocol compliance.
    { name: 'insert', description: 'Insert code at specific line', inputSchema: { type: 'object', properties: { position: { type: 'number', description: 'Line number' }, code: { type: 'string', description: 'Code to insert' } }, required: ['position', 'code'] }
  • Input schema definition for the 'insert' tool specifying position (number) and code (string) parameters.
    inputSchema: { type: 'object', properties: { position: { type: 'number', description: 'Line number' }, code: { type: 'string', description: 'Code to insert' } }, required: ['position', 'code']

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/williamzujkowski/strudel-mcp-server'

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