toggle_fx
Enable or disable all Liquid Glass effects (specular, shadow, blur, translucency) on every group in an .icon bundle with a single command.
Instructions
Enable or disable all Liquid Glass effects (specular, shadow, blur, translucency) on every group in the .icon bundle at once.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bundle_path | Yes | Path to .icon bundle | |
| enabled | Yes | true to enable all FX, false to disable |
Implementation Reference
- src/lib/ops-glass.ts:386-413 (handler)The main handler function for toggle_fx. Iterates over all groups in the icon bundle manifest and enables or disables specular, shadow, and translucency effects based on the `enabled` parameter. blur-material is intentionally left untouched.
export async function toggleFx(params: ToggleFxParams): Promise<McpResult> { try { const { manifest } = await readIconBundle(params.bundle_path); for (const group of manifest.groups) { if (params.enabled) { group.specular = true; if (!group.shadow || group.shadow.kind === 'none') { group.shadow = { kind: 'layer-color', opacity: 0.5 }; } } else { group.specular = false; group.shadow = { kind: 'none', opacity: 0 }; if (group.translucency) { group.translucency.enabled = false; } } // blur-material intentionally NOT touched } await saveManifest(params.bundle_path, manifest); return ok(`${params.enabled ? 'Enabled' : 'Disabled'} all FX on ${manifest.groups.length} group(s) 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:80-83 (schema)Input parameter interface for toggleFx. Accepts `bundle_path` (string) and `enabled` (boolean).
export interface ToggleFxParams { bundle_path: string; enabled: boolean; } - src/server.ts:223-232 (registration)Registration of the 'toggle_fx' tool on the MCP server with Zod schema validation for bundle_path (string) and enabled (boolean). Delegates to the toggleFx handler.
// ── Tool: toggle_fx ── server.tool( 'toggle_fx', 'Enable or disable all Liquid Glass effects (specular, shadow, blur, translucency) on every group in the .icon bundle at once.', { bundle_path: z.string().describe('Path to .icon bundle'), enabled: z.boolean().describe('true to enable all FX, false to disable'), }, async (params) => toggleFx(params), ); - src/lib/ops-glass.ts:89-91 (helper)Helper function `ok` used to return a successful McpResult with a text message.
function ok(text: string): McpResult { return { content: [{ type: 'text', text }] }; } - src/lib/ops-glass.ts:93-95 (helper)Helper function `err` used to return an error McpResult with a text message.
function err(text: string): McpResult { return { content: [{ type: 'text', text }], isError: true }; }