shader_read
Extract and read shader files directly from Unity projects using this tool, enabling efficient access and management of shader assets within the development workflow.
Instructions
Read a shader from Unity project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path to the shader file |
Implementation Reference
- src/tools/unity-mcp-tools.ts:393-404 (handler)Handler for shader_read tool: validates input, calls adapter.readShader(path), and formats response with shader content.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}` }] }; }
- src/tools/unity-mcp-tools.ts:166-178 (schema)Tool schema definition for shader_read, specifying input requirements (path to shader file).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'] } },
- Helper method that sends HTTP POST to Unity server with method 'shader/read' and path parameter.async readShader(path: string): Promise<any> { return this.call('shader/read', { path }); }