On this page
Role drawing MCP tools for semantic painting: agents paint ramp-role shade indices into role-kind layers, with 255 reserved as the transparent sentinel.
#server.src.pixelweaver.mcp_role_tools
#server.src.pixelweaver.mcp_role_tools
Role (semantic painting) drawing tools for the MCP registry.
Role-kind layers store one ramp-role byte per pixel. Agents paint "shades" (role indices into the layer's palette class ramp) rather than RGBA colors. Each tool here dispatches the frontend command of the same name; the role parameters are shade indices within the layer's class ramp (0..len-1).
Sentinel policy: the transparent sentinel (255) is NEVER a legal shade parameter -- erase_roles is the one way to write transparency.
#register_role_tools
def register_role_tools(registry: MCPCommandRegistry) -> NoneRegister all role-kind (shade) drawing MCP tools.
#_resolve_canvas_layer
def _resolve_canvas_layer(registry: MCPCommandRegistry, args: dict[str, Any], tool: str) -> tuple[Any, Any, dict[str, Any]] | dict[str, Any]Resolve (canvas, layer_dict) by canvas_name + layer_id, or an error dict.
#_class_ramp
def _class_ramp(manifest: dict[str, Any] | None, class_id: str) -> list[str] | dict[str, Any]Return a class's ramp (palette slice), or a structured error dict.
#_register_promote_demote
def _register_promote_demote(registry: MCPCommandRegistry) -> NoneRegister promote_layer_to_role and demote_layer_to_rgba.