shader_create
Generate and integrate a custom shader into Unity projects using a name, optional content, and target folder path for streamlined asset creation and management.
Instructions
Create a new shader in Unity project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | No | Shader content (optional, will use template if not provided) | |
| folder | No | Target folder path (default: Assets/Shaders) | |
| name | Yes | Name of the shader (without .shader extension) |
Implementation Reference
- src/tools/unity-mcp-tools.ts:380-391 (handler)Handler implementation in executeTool that validates input and delegates to UnityHttpAdapter.createShadercase '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:143-164 (registration)Tool registration including name, description, and input schema in getTools(){ 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'] } },
- Adapter helper method that performs HTTP POST to Unity server's 'shader/create' endpointasync createShader(name: string, content?: string, folder?: string): Promise<any> { return this.call('shader/create', { name, content, folder }); }