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
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"path": "<path>"
},
"name": "shader_read"
}
}Input 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 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}` }] }; } - src/tools/unity-mcp-tools.ts:165-178 (schema)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 }); } - src/tools/unity-mcp-tools.ts:165-178 (registration)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'] } },