Skip to main content
Glama

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
NameRequiredDescriptionDefault
nameYesName of the shader (without .shader extension)
contentNoShader content (optional, will use template if not provided)
folderNoTarget folder path (default: Assets/Shaders)

Implementation Reference

  • 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}`
        }]
      };
  • 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']
  • 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 });
    }

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/zabaglione/mcp-server-unity'

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