Skip to main content
Glama

load_font_async

Load fonts asynchronously in Figma to ensure text elements display correctly without blocking the interface, specifying font family and optional style parameters.

Instructions

Load a font asynchronously in Figma

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
familyYesFont family name
styleNoFont style (e.g., 'Regular', 'Bold', 'Italic')

Implementation Reference

  • The execution handler for the 'load_font_async' MCP tool. It sends a 'load_font_async' command to Figma via websocket, processes the result, and returns a formatted text response indicating success or error.
    async ({ family, style }) => { try { const result = await sendCommandToFigma("load_font_async", { family, style: style || "Regular" }); const typedResult = result as { success: boolean, family: string, style: string, message: string }; return { content: [ { type: "text", text: typedResult.message || `Loaded font ${family} ${style || "Regular"}` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error loading font: ${error instanceof Error ? error.message : String(error)}` } ] }; } }
  • Input schema for the 'load_font_async' tool using Zod validation: requires 'family' string, optional 'style' string.
    { family: z.string().describe("Font family name"), style: z.string().optional().describe("Font style (e.g., 'Regular', 'Bold', 'Italic')"), },
  • Registration of the 'load_font_async' tool on the MCP server within the registerTextTools function, including name, description, input schema, and handler.
    server.tool( "load_font_async", "Load a font asynchronously in Figma", { family: z.string().describe("Font family name"), style: z.string().optional().describe("Font style (e.g., 'Regular', 'Bold', 'Italic')"), }, async ({ family, style }) => { try { const result = await sendCommandToFigma("load_font_async", { family, style: style || "Regular" }); const typedResult = result as { success: boolean, family: string, style: string, message: string }; return { content: [ { type: "text", text: typedResult.message || `Loaded font ${family} ${style || "Regular"}` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error loading font: ${error instanceof Error ? error.message : String(error)}` } ] }; } } );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/agenisea/cc-fig-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server