Skip to main content
Glama

mat_add_expression

Add a material expression node to an Unreal Engine Material asset, specifying type and optional parameters for texture, constants, or parameters.

Instructions

Add a material expression (node) to a Material asset.

Common expression_type values: Texture — TextureSample (provide texture_path in params) Multiply — Multiply two inputs Add — Add two inputs Lerp — Linear interpolation Constant — Single float constant (provide value in params) Constant3 — RGB vector constant (provide r,g,b in params) Constant4 — RGBA vector constant (provide r,g,b,a in params) Param_Scalar — Scalar parameter (provide param_name in params) Param_Vector — Vector parameter (provide param_name in params) Param_Texture — Texture parameter (provide param_name in params) Fresnel — Fresnel effect CheapContrast — Cheap contrast adjustment Desaturation — Desaturation OneMinus — 1 - input VertexColor — Vertex color input WorldPosition — World position

expression_params (JSON object): texture_path: str — For TextureSample/Param_Texture param_name: str — For Param_* expressions value: float — For Constant r,g,b,a: float — For Constant3/Constant4

Args: material_path: Full asset path (e.g. '/Game/Materials/M_Rock') expression_type: Expression class short name (see above) position_x: Canvas X position. Default 0. position_y: Canvas Y position. Default 0. expression_params: JSON object of expression-specific params.

Returns: JSON StructuredResult. outputs.expression_index — Index for use in mat_connect_expressions outputs.expression_name — Object name of the created expression

KB: see knowledge_base/01_BLUEPRINT_FUNDAMENTALS.md#overview Example: mat_add_expression(material_path="/Game/MCP_Test/M_Example", expression_type="Example")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
position_xNo
position_yNo
material_pathYes
expression_typeYes
expression_paramsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations provided, the description carries the behavioral disclosure burden. It clearly states that the operation creates a node on a Material asset and explicitly documents the outputs (expression_index and expression_name). It does not discuss side effects such as whether compilation or saving is required afterward, but the core mutation and return contract are disclosed.

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?

The description is well-organized with clear sections (expression types, params, returns, example), and the long list of expression types is genuinely useful. However, the example uses expression_type='Example', which is not in the provided list of valid values and could mislead an agent. The KB link to Blueprint Fundamentals also appears tangential for a material-expression tool, adding slight noise.

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

Completeness3/5

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

For a complex 5-parameter tool with no annotations, the description covers most essential domain knowledge: valid expression types, required parameter keys, defaults, and return values. But the Param_Texture mapping conflict and the unexplained mismatch between the schema's expression_params type (anyOf string/null) and the description's 'JSON object' wording leave gaps that could cause incorrect invocation.

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 description coverage is 0%, so the description must compensate, and it does with rich parameter guidance: defaults for position_x/position_y, material_path format, and per-expression parameter requirements. However, there is an internal inconsistency: Param_Texture is listed as needing param_name, but expression_params later lists texture_path as also applying to Param_Texture. This ambiguity prevents a perfect score.

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 description opens with a specific verb and resource: 'Add a material expression (node) to a Material asset.' This clearly distinguishes it from sibling tools like mat_connect_expressions, mat_compile, and mat_validate_material, and the listed expression types further pin down what the tool does.

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 context for when to use this tool: when adding an expression node to a material. It also hints at the workflow by stating that the returned expression_index is 'for use in mat_connect_expressions,' which helps an agent sequence calls correctly. It does not explicitly enumerate exclusions or contrast with mat_create_material, but the intended usage is clear.

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

Deploy Server

Other Tools