shader_create
Create new shaders in Unity projects by specifying name, content, and folder location to customize visual effects.
Instructions
Create a new shader in Unity project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the shader (without .shader extension) | |
| content | No | Shader content (optional, will use template if not provided) | |
| folder | No | Target folder path (default: Assets/Shaders) |
Implementation Reference
- src/tools/unity-mcp-tools.ts:380-390 (handler)Handler for the shader_create tool. Validates the 'name' parameter and calls the adapter's createShader method, returning success message with path and GUID.case 'shader_create': { if (!args.name) { throw new Error('name is required'); } const result = await this.adapter.createShader(args.name, args.content, args.folder); return { content: [{ type: 'text', text: `Shader created successfully:\nPath: ${result.path}\nGUID: ${result.guid}` }] };
- src/tools/unity-mcp-tools.ts:146-162 (schema)Input schema defining parameters for shader_create: name (required), optional content and folder.inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Name of the shader (without .shader extension)' }, content: { type: 'string', description: 'Shader content (optional, will use template if not provided)' }, folder: { type: 'string', description: 'Target folder path (default: Assets/Shaders)' } }, required: ['name']
- src/tools/unity-mcp-tools.ts:143-164 (registration)Tool registration object added to the tools array in getTools() method.{ name: 'shader_create', description: 'Create a new shader in Unity project', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Name of the shader (without .shader extension)' }, content: { type: 'string', description: 'Shader content (optional, will use template if not provided)' }, folder: { type: 'string', description: 'Target folder path (default: Assets/Shaders)' } }, required: ['name'] } },
- Helper method in UnityHttpAdapter that forwards the create shader request to the Unity HTTP server via the generic call method.async createShader(name: string, content?: string, folder?: string): Promise<any> { return this.call('shader/create', { name, content, folder }); }