Skip to main content
Glama

create_shader_from_code

Read create-shaders Skill first. Create a Web effect/transition library asset from inline TypeScript and editable properties; apply with edit_item when requested.

Effects extend EffectProcessor and process one input texture. Transitions extend TransitionProcessor and combine outgoing/incoming textures. Both implement initialize(ctx) and render(ctx), use ctx.compileShader/ctx.renderPass, and return a WebGLTexture. WebGL2 only: no React/JSX, HTML or Desktop Flux API. Read create-shaders for the renderer contract.

initialize(ctx): ctx.compileShader({id, fragmentShader, vertexShader?}). Pass ONE object, never compileShader(id, source); the key is fragmentShader, not fragment. GLSL may be an inline string or a local const string. render(ctx): return ctx.renderPass({id, textures, uniforms?}) using the same id. Effect textures: {u_input:ctx.inputTexture}; transition textures: {u_outgoing:ctx.outgoingTexture,u_incoming:ctx.incomingTexture}, uniforms: {u_progress:ctx.progress}. GLSL ES 300 needs #version 300 es, float precision, out vec4 and void main().

Without vertexShader, the fragment input is in vec2 v_texCoord, not v_uv. A custom varying requires a matching name and type in this pass's explicit vertexShader output; another pass's vertex shader does not supply it.

Read source: inspect_asset includeCode:true. Update source, properties or declarations: edit_asset action:update with inline json. Shader controls are number, boolean, color, select, vec2, font and text; image/video asset properties belong to MG and caption code. Effects can use ctx.textMask for text alpha textures; see code. Preview retries pending fonts and export awaits them. No DOM/font fetching in authored code. Effects may declare Web special-effect protocols; transitions do not receive them. Validation precedes persistence. Verify the saved asset, placement and pixels after authoring.

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": {
      "type": "<type>",
      "code": "<code>",
      "name": "<name>"
    },
    "name": "create_shader_from_code"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesFull inline TypeScript class, without imports, exports, constructor, getMetadata or external I/O. Exactly one EffectProcessor or TransitionProcessor subclass. In initialize(ctx), call ctx.compileShader({id,fragmentShader,vertexShader?}) with ONE object; fragmentShader is an inline GLSL ES 300 string or local const string, not the key fragment or a positional source argument. Without vertexShader, declare in vec2 v_texCoord, not v_uv. Custom varying names and types must match this pass's explicit vertexShader outputs. render(ctx) returns ctx.renderPass({id,textures,uniforms?}) with the same compiled id. Effect textures: {u_input:ctx.inputTexture}; transition textures: {u_outgoing:ctx.outgoingTexture,u_incoming:ctx.incomingTexture}, uniforms include u_progress:ctx.progress. Editable values are ctx.properties. Never pass React, a path or Desktop HTML. Effects can call ctx.textMask({text,fontFamily,fontSize,fontWeight?,fontVariant?,maxWidth?,x?,y?,align?,lineHeight?}) for a host-prepared alpha texture. Coordinates use top-left output pixels; x/y center text by default.
nameYesLibrary asset display name.
typeYesProcessor kind; must match the base class in code.
projectIdNoProject for this call (full ID or unambiguous prefix). Explicit-timeline calls never change the target of later calls; legacy project selection applies otherwise.
propertiesNoEditable shader definitions. Each contains key,label,type,defaultValue; numeric controls may include min,max,step; select requires options; vec2 uses [x,y]. These defaults are persisted on the asset and overridden by applied item.propertyOverrides.
timelineIdNo
descriptionNo
chatcutSpecialEffectUsedNoOptional Web-only media-analysis declarations. Omit for ordinary MG/effect/caption work and preserve existing values on unrelated revisions. Transitions and Desktop do not support these readers. caption_v1 is private to caption-owned code.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • changedInput schema / properties / code / description
      Previous value: -"Full inline TypeScript class, without imports, exports, constructor, getMetadata or external I/O. Exactly one EffectProcessor or TransitionProcessor subclass. In initialize(ctx), call ctx.compileShader({id,fragmentShader,vertexShader?}) with ONE object; fragmentShader is an inline GLSL ES 300 string or local const string, not the key fragment or a positional source argument. render(ctx) returns ctx.renderPass({id,textures,uniforms?}) with the same compiled id. Effect textures: {u_input:ctx.inputTexture}; transition textures: {u_outgoing:ctx.outgoingTexture,u_incoming:ctx.incomingTexture}, uniforms include u_progress:ctx.progress. Editable values are ctx.properties. Never pass React, a path or Desktop HTML."New value: +"Full inline TypeScript class, without imports, exports, constructor, getMetadata or external I/O. Exactly one EffectProcessor or TransitionProcessor subclass. In initialize(ctx), call ctx.compileShader({id,fragmentShader,vertexShader?}) with ONE object; fragmentShader is an inline GLSL ES 300 string or local const string, not the key fragment or a positional source argument. Without vertexShader, declare in vec2 v_texCoord, not v_uv. Custom varying names and types must match this pass's explicit vertexShader outputs. render(ctx) returns ctx.renderPass({id,textures,uniforms?}) with the same compiled id. Effect textures: {u_input:ctx.inputTexture}; transition textures: {u_outgoing:ctx.outgoingTexture,u_incoming:ctx.incomingTexture}, uniforms include u_progress:ctx.progress. Editable values are ctx.properties. Never pass React, a path or Desktop HTML. Effects can call ctx.textMask({text,fontFamily,fontSize,fontWeight?,fontVariant?,maxWidth?,x?,y?,align?,lineHeight?}) for a host-prepared alpha texture. Coordinates use top-left output pixels; x/y center text by default."
    • changedInput schema / properties / properties / items / properties / defaultValue / anyOf
      Previous value: -[
      -  {
      -    "type": "number"
      -  },
      -  {
      -    "type": "boolean"
      -  },
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "additionalItems": false,
      -    "items": [
      -      {
      -        "type": "number"
      -      },
      -      {
      -        "type": "number"
      -      }
      -    ],
      -    "maxItems": 2,
      -    "minItems": 2,
      -    "type": "array"
      -  }
      -]New value: +[
      +  {
      +    "type": "number"
      +  },
      +  {
      +    "type": "boolean"
      +  },
      +  {
      +    "type": "string"
      +  },
      +  {
      +    "items": false,
      +    "maxItems": 2,
      +    "minItems": 2,
      +    "prefixItems": [
      +      {
      +        "type": "number"
      +      },
      +      {
      +        "type": "number"
      +      }
      +    ],
      +    "type": "array"
      +  }
      +]
  2. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Beyond the annotations, the description discloses substantial behavioral constraints: WebGL2 only, no React/JSX/HTML or Desktop Flux API, validation precedes persistence, preview retries pending fonts, export awaits them, and authored code must not fetch DOM/fonts. It also explains lifecycle contracts, texture naming, and transition limitations. This is rich context for a complex mutation tool.

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

Conciseness4/5

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

The description is long but deliberately structured around authoring rules, rendering contract, source workflow, and validation. The opening sentence front-loads the action, and most details are necessary for correct shader authoring. There is some redundancy with the schema's code description, which keeps it from being maximally concise.

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

Completeness5/5

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

For a complex shader-authoring tool with no output schema, the description covers the essential missing context: required skill reading, code lifecycle, WebGL2 restrictions, texture and uniform conventions, property types, source inspection and update workflows, validation, and post-authoring verification. It is complete enough for an agent to call and recover from mistakes without needing undocumented inference.

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

Parameters4/5

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

Schema coverage is 75%, so the baseline is 3, but the description adds meaningful semantics for the code parameter and properties, including processor subclass rules, initialize/render contracts, texture keys, uniform keys, and GLSL ES 300 requirements. It also clarifies that effects may declare Web special-effect protocols while transitions do not receive them. Some of this duplicates the schema's code description, but it still adds useful meaning.

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?

The first sentence states a specific verb and resource: 'Create a Web effect/transition library asset from inline TypeScript and editable properties.' It distinguishes the two supported asset types and names the follow-up apply tool, so an agent can identify the operation without opening the schema.

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

Usage Guidelines4/5

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

The description gives clear workflow guidance: read the create-shaders Skill first, use inspect_asset includeCode:true to read source, edit_asset action:update for revisions, and edit_item to apply the asset. It also scopes some non-use cases, such as image/video asset properties belonging to MG and caption code. It does not explicitly compare this tool to create_motion_graphic_from_code, so it falls short of full alternative routing.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.