set_glass_effects
Configure Liquid Glass visual properties (specular, blur, shadow, translucency) on a selected layer group in a .icon bundle, with control over blend mode and lighting.
Instructions
Configure Liquid Glass effects (specular, blur, shadow, translucency) on a layer group in an existing .icon bundle.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bundle_path | Yes | Path to .icon bundle | |
| group_index | No | Group index to modify (0-based) | |
| specular | No | Enable/disable specular highlights | |
| blur_material | No | Blur amount (0-1, null to disable) | |
| shadow_kind | No | Shadow type | |
| shadow_opacity | No | Shadow opacity | |
| translucency_enabled | No | Enable translucency | |
| translucency_value | No | Translucency amount | |
| opacity | No | Group opacity | |
| blend_mode | No | Blend mode | |
| lighting | No | Lighting mode |
Implementation Reference
- src/lib/ops-glass.ts:101-139 (handler)Core handler function for set_glass_effects. Reads the .icon manifest, applies specular, blur-material, shadow, translucency, opacity, blend-mode, and lighting to a group, then saves the manifest.
export async function setGlassEffects(params: SetGlassParams): Promise<McpResult> { try { const { manifest } = await readIconBundle(params.bundle_path); if (manifest.groups.length === 0) { return err('Error: No groups in this icon bundle'); } const group = manifest.groups[Math.min(params.group_index, manifest.groups.length - 1)]; if (params.specular !== undefined) group.specular = params.specular; if (params.blur_material !== undefined) group['blur-material'] = params.blur_material; if (params.shadow_kind !== undefined || params.shadow_opacity !== undefined) { group.shadow = { kind: params.shadow_kind ?? group.shadow?.kind ?? 'layer-color', opacity: params.shadow_opacity ?? group.shadow?.opacity ?? 0.5, }; } if (params.translucency_enabled !== undefined || params.translucency_value !== undefined) { group.translucency = { enabled: params.translucency_enabled ?? group.translucency?.enabled ?? false, value: params.translucency_value ?? group.translucency?.value ?? 0.4, }; } if (params.opacity !== undefined) group.opacity = params.opacity; if (params.blend_mode) group['blend-mode'] = toBlendMode(params.blend_mode); if (params.lighting) group.lighting = params.lighting; await saveManifest(params.bundle_path, manifest); return ok(`Updated glass effects on group ${params.group_index} in ${params.bundle_path}`); } catch (error: unknown) { const msg = error instanceof Error ? error.message : 'Unknown error'; return err(`Error: ${msg}`); } } - src/lib/ops-glass.ts:26-38 (schema)Parameter interface SetGlassParams defining all input fields: bundle_path, group_index, specular, blur_material, shadow_kind, shadow_opacity, translucency_enabled, translucency_value, opacity, blend_mode, lighting.
export interface SetGlassParams { bundle_path: string; group_index: number; specular?: boolean; blur_material?: number | null; shadow_kind?: 'neutral' | 'layer-color' | 'none'; shadow_opacity?: number; translucency_enabled?: boolean; translucency_value?: number; opacity?: number; blend_mode?: string; lighting?: 'combined' | 'individual'; } - src/server.ts:107-129 (registration)MCP tool registration for 'set_glass_effects' with Zod schema validation for all parameters, delegating to setGlassEffects handler.
// ── Tool: set_glass_effects ── server.tool( 'set_glass_effects', 'Configure Liquid Glass effects (specular, blur, shadow, translucency) on a layer group in an existing .icon bundle.', { bundle_path: z.string().describe('Path to .icon bundle'), group_index: z.number().default(0).describe('Group index to modify (0-based)'), specular: z.optional(z.boolean()).describe('Enable/disable specular highlights'), blur_material: z.optional(z.number().min(0).max(1).nullable()).describe('Blur amount (0-1, null to disable)'), shadow_kind: z.optional(z.enum(['neutral', 'layer-color', 'none'])).describe('Shadow type'), shadow_opacity: z.optional(z.number().min(0).max(1)).describe('Shadow opacity'), translucency_enabled: z.optional(z.boolean()).describe('Enable translucency'), translucency_value: z.optional(z.number().min(0).max(1)).describe('Translucency amount'), opacity: z.optional(z.number().min(0).max(1)).describe('Group opacity'), blend_mode: z.optional(z.enum([ 'normal', 'multiply', 'screen', 'overlay', 'darken', 'lighten', 'color-dodge', 'color-burn', 'soft-light', 'hard-light', 'difference', 'exclusion', 'plus-darker', 'plus-lighter', ])).describe('Blend mode'), lighting: z.optional(z.enum(['combined', 'individual'])).describe('Lighting mode'), }, async (params) => setGlassEffects(params), ); - src/cli.ts:148-180 (registration)CLI command registration for 'glass' which wraps setGlassEffects, parsing options from command-line arguments.
// ── glass ── program .command('glass') .description('Set glass effects on a group') .argument('<bundle_path>', 'Path to the .icon bundle') .option('--group-index <n>', 'Group index', toInt, 0) .option('--specular', 'Enable specular highlight') .option('--no-specular', 'Disable specular highlight') .option('--blur-material <n>', 'Blur material value', toFloat) .option('--shadow-kind <kind>', 'Shadow kind (neutral, layer-color, none)') .option('--shadow-opacity <n>', 'Shadow opacity', toFloat) .option('--translucency-enabled', 'Enable translucency') .option('--no-translucency-enabled', 'Disable translucency') .option('--translucency-value <n>', 'Translucency value', toFloat) .option('--opacity <n>', 'Layer opacity', toFloat) .option('--blend-mode <mode>', 'Blend mode') .option('--lighting <type>', 'Lighting type (combined or individual)') .action(async (bundle_path, opts) => { await run(() => setGlassEffects({ bundle_path, group_index: opts.groupIndex, specular: opts.specular, blur_material: opts.blurMaterial, shadow_kind: opts.shadowKind, shadow_opacity: opts.shadowOpacity, translucency_enabled: opts.translucencyEnabled, translucency_value: opts.translucencyValue, opacity: opts.opacity, blend_mode: opts.blendMode, lighting: opts.lighting, }), - src/types.ts:9-28 (helper)BlendMode type definition and toBlendMode helper used by setGlassEffects to validate and convert blend mode strings.
export type BlendMode = | 'normal' | 'multiply' | 'screen' | 'overlay' | 'darken' | 'lighten' | 'color-dodge' | 'color-burn' | 'soft-light' | 'hard-light' | 'difference' | 'exclusion' | 'plus-darker' | 'plus-lighter'; const VALID_BLEND_MODES: ReadonlySet<string> = new Set<BlendMode>([ 'normal', 'multiply', 'screen', 'overlay', 'darken', 'lighten', 'color-dodge', 'color-burn', 'soft-light', 'hard-light', 'difference', 'exclusion', 'plus-darker', 'plus-lighter', ]); /** Validate a string as a BlendMode, returning 'normal' if invalid. */ export function toBlendMode(value: string | undefined): BlendMode { if (value && VALID_BLEND_MODES.has(value)) { return value as BlendMode; } return 'normal'; }