Skip to main content
Glama

Port a shader

port_shader

Translates shader code between Unity ShaderLab, Godot, three.js, and GLSL/Shadertoy, mapping types, intrinsics, and uniforms into a first draft that flags leftovers to fix.

Instructions

Translates shader code between engines as a faithful first draft: Unity ShaderLab (surface shaders → fragment() with ALBEDO/NORMAL_MAP/METALLIC/ROUGHNESS/EMISSION/ALPHA; vertex/fragment shaders → vertex()/fragment() with varyings) → Godot .gdshader with Properties as uniforms (hints, ranges, _ST tiling), HLSL types/intrinsics/built-ins mapped (float4→vec4, lerp→mix, tex2D→texture, saturate→clamp, _Time.y→TIME, UnityObjectToClipPos→VERTEX, unity_ObjectToWorld→MODEL_MATRIX…); Shadertoy or plain GLSL → Godot canvas_item (iTime/iResolution/iChannelN/fragCoord mapped, Y flipped) or a three.js ShaderMaterial module; Godot .gdshader → three.js ShaderMaterial (uniforms object included) or Unity ShaderLab (canvas_item → sprite shader, spatial → Standard surface shader). Lighting models and coordinate spaces differ per engine, so the result lists leftovers (identifiers with no equivalent) and PORT: markers; compile it in the target engine before trusting it.

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": {
      "to": "<to>"
    },
    "name": "port_shader"
  }
}

Input Schema

NameRequiredDescriptionDefault
toYesTarget: godot, threejs or unity.
outNoOutput file (default workspace/shaders/<name>.<ext>).
fileNoShader file (.shader, .gdshader, .glsl, .hlsl, .cginc).
nameNoShader name for the output.
contentNoShader code instead of file.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.25.0

TDQS

A3.8/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations declare readOnlyHint=false, destructiveHint=false, idempotentHint=false, openWorldHint=false, so the mutation profile is already covered. The description adds real value beyond that: the output is explicitly a 'faithful first draft', it will contain leftover identifiers and PORT: markers, and it must be compiled in the target engine before trust — telling the agent the result is non-authoritative and incomplete.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose and caveat are front-loaded and the closing sentence is well-earned. However, the middle is one enormous run-on sentence with nested parenthetical arrow chains (float4→vec4, lerp→mix, iTime/iResolution/fragCoord…) that is hard to parse and would be far more scannable as a short bulleted mapping or by moving detail out of the description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 5-parameter, 100%-covered tool with no output schema, the description covers the transformation surface, the non-authoritative nature of the output, and the leftovers mechanism — enough to call it correctly. The only meaningful gaps are guidance on choosing this tool over sibling port tools and the file/content interaction.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema itself documents to, out, file, name, and content, giving a baseline of 3. The description adds no further detail on parameter behavior — it never explains the file-vs-content precedence, the default output path, or how 'name' affects extension selection.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb (translates) and resource (shader code between engines) and enumerates the exact source→target pairs supported: ShaderLab→Godot, Shadertoy/GLSL→Godot canvas_item or three.js, Godot→three.js or Unity. An agent can tell this apart from generic siblings like port_convert or port_draft without opening any schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The support matrix implicitly tells the agent which conversions are in scope, but there is no explicit when-to-use vs when-not, no mention of port_convert/port_draft alternatives, and no prerequisites (e.g., whether the file format must be detected first). The closing advice to compile in the target engine is a caveat rather than routing guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.