Skip to main content
Glama

set_mesh_material_id_in_region

DestructiveIdempotent

Stamp a MaterialID onto every triangle in a local region of a dynamic mesh, useful after booleans fuse pieces when polygroups cannot address them separately.

Instructions

Stamp a MaterialID onto every triangle inside a region, via the engine's SelectMeshElements* family + SetMaterialIDForMeshSelection. Use this when polygroups are not usable — after a boolean, appended pieces are fused and set_polygroup_material_id cannot address them separately. Coordinates are LOCAL to the dynamic mesh, not world. Preview any region with select_mesh_triangles before painting: a region that selects 0 triangles still returns success.

Returns: { actor_name, material_id, region, triangles_selected: int, max_material_id_after: int, distinct_material_ids_after: int, applied: bool }

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
centerNoLocal [x,y,z] centre. Used by box/sphere, and as the plane origin.
extentNoLocal [x,y,z] HALF-size in cm. Required by region='box'.
invertNoInvert the spatial selection (default false).
normalNo[x,y,z] direction. Plane normal for region='plane', facing direction for 'normal_angle'. Default [0,0,1].
radiusNoRadius in cm. Required by region='sphere'.
regionNo'all' (default) | 'box' | 'sphere' | 'plane' | 'normal_angle' | 'material_id' | 'polygroup' | 'connected_component' (one physical PIECE, by the island index that get_mesh_components_detail reports).
actor_nameYesLabel or name of the target DynamicMeshActor.
material_idNoMaterialID to write (>= 0).
polygroup_idNoPolygroup to select when region='polygroup'.
max_angle_degNoMax angle from normal in degrees for region='normal_angle' (default 15).
component_indexNoIsland index when region='connected_component'. Get it from get_mesh_components_detail, which reports each piece's size and bounding box.
polygroup_layerNoOptional extended polygroup layer index for region='polygroup'.
source_material_idNoThe MaterialID to SELECT when region='material_id'. Separate from material_id, which is the one being written, so 'repaint 1 as 2' is expressible.
min_triangle_pointsNoHow many of a triangle's 3 points must be inside for it to count, 1-3 (default 3 = fully contained). Only used by the spatial regions.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.1.0

TDQS

A4.6/5.0
Behavior5/5

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

Goes well beyond the annotations (destructive=true, idempotent=true): it warns that coordinates are LOCAL to the dynamic mesh rather than world, and that a region selecting 0 triangles still returns success — a silent no-op trap. The implementation note (SelectMeshElements* + SetMaterialIDForMeshSelection) also signals this is a real selection + write pipeline.

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?

Front-loaded with the core action, then usage, then constraints, then return shape — well ordered with no filler. The engine-function-name sentence is marginally more detail than an agent strictly needs, keeping it just below a 5.

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 14-parameter destructive mutation with no output schema, the description supplies the missing pieces: failure semantics, coordinate space, sibling routing, and an inline Returns shape. Nothing needed to invoke it correctly is absent.

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 coverage is 100%, so all 14 parameters are already documented in the schema. The description reinforces that coordinates are local and that the region drives selection, but adds no per-parameter syntax or format detail beyond what the schema provides, so baseline 3 applies.

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 precise verb+resource: stamp a MaterialID onto every triangle inside a region. Explicitly names the sibling set_polygroup_material_id as the tool it does not replace, so an agent can distinguish the two without opening either schema.

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

Usage Guidelines5/5

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

Gives an explicit when-to-use condition ('after a boolean, appended pieces are fused and set_polygroup_material_id cannot address them separately') and a recommended pre-flight step (preview with select_mesh_triangles). Both the alternative and the selection criteria are named.

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