Skip to main content
Glama

shader_read

Read shader files from Unity projects to access and analyze shader code for development, debugging, or integration purposes.

Instructions

Read a shader from Unity project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesPath to the shader file

Implementation Reference

  • Handler for the shader_read tool. Validates path argument, calls UnityHttpAdapter.readShader, and formats the shader content in the tool response.
    case 'shader_read': {
      if (!args.path) {
        throw new Error('path is required');
      }
      const result = await this.adapter.readShader(args.path);
      return {
        content: [{
          type: 'text',
          text: `Shader content from ${result.path}:\n\n${result.content}`
        }]
      };
    }
  • Tool schema definition including name, description, and input validation requiring a 'path' parameter.
    {
      name: 'shader_read',
      description: 'Read a shader from Unity project',
      inputSchema: {
        type: 'object',
        properties: {
          path: {
            type: 'string',
            description: 'Path to the shader file'
          }
        },
        required: ['path']
      }
    },
  • Adapter helper method that sends HTTP POST request to Unity MCP server endpoint 'shader/read' with the file path.
    async readShader(path: string): Promise<any> {
      return this.call('shader/read', { path });
    }
  • Registration of the shader_read tool in the getTools() method's return array.
    {
      name: 'shader_read',
      description: 'Read a shader from Unity project',
      inputSchema: {
        type: 'object',
        properties: {
          path: {
            type: 'string',
            description: 'Path to the shader file'
          }
        },
        required: ['path']
      }
    },

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