Skip to main content
Glama

figma_get_images

Extract images from Figma nodes by specifying file key, node IDs, format, scale, and other parameters. Supports formats like PNG, JPG, SVG, and PDF for efficient design asset retrieval.

Instructions

Get images of Figma nodes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileKeyYesUnique identifier of the Figma file
formatNoImage format, e.g., png, jpg, svg
idsYesNode IDs to get images for, comma separated
personalTokenNoYour Figma personal access token
scaleNoImage scale factor
svg_include_idNoWhether SVG includes ID
svg_simplify_strokeNoWhether to simplify SVG strokes
use_absolute_boundsNoWhether to use absolute bounds
versionNoSpecify the version to return

Implementation Reference

  • Handler function that executes the tool logic by calling api.images(o) and formatting the response as text content or error.
    async (o): Promise<CallToolResult> => { try { const data = await api.images(o) return { content: [{type: 'text', text: JSON.stringify(data)}], } } catch (error: any) { return { content: [{type: 'text', text: `Error: ${error.message}`}], } } },
  • Registration of the figma_get_images tool on the MCP server, specifying name, description, input schema, and handler function.
    'figma_get_images', 'Get images of Figma nodes', { fileKey: z.string().describe('Unique identifier of the Figma file'), ids: z.string().describe('Node IDs to get images for, comma separated'), format: z.enum(['jpg', 'png', 'svg', 'pdf']).optional().describe('Image format, e.g., png, jpg, svg'), scale: z.number().optional().describe('Image scale factor'), svg_include_id: z.boolean().optional().describe('Whether SVG includes ID'), svg_simplify_stroke: z.boolean().optional().describe('Whether to simplify SVG strokes'), use_absolute_bounds: z.boolean().optional().describe('Whether to use absolute bounds'), version: z.string().optional().describe('Specify the version to return'), personalToken: z .string() .optional() .describe('Your Figma personal access token, The parameters are not required when the tool is called.'), }, async (o): Promise<CallToolResult> => { try { const data = await api.images(o) return { content: [{type: 'text', text: JSON.stringify(data)}], } } catch (error: any) { return { content: [{type: 'text', text: `Error: ${error.message}`}], } } }, )
  • Zod input validation schema for the tool parameters.
    { fileKey: z.string().describe('Unique identifier of the Figma file'), ids: z.string().describe('Node IDs to get images for, comma separated'), format: z.enum(['jpg', 'png', 'svg', 'pdf']).optional().describe('Image format, e.g., png, jpg, svg'), scale: z.number().optional().describe('Image scale factor'), svg_include_id: z.boolean().optional().describe('Whether SVG includes ID'), svg_simplify_stroke: z.boolean().optional().describe('Whether to simplify SVG strokes'), use_absolute_bounds: z.boolean().optional().describe('Whether to use absolute bounds'), version: z.string().optional().describe('Specify the version to return'), personalToken: z .string() .optional() .describe('Your Figma personal access token, The parameters are not required when the tool is called.'), },
  • Helper function implementing the Figma API call for retrieving images by constructing the endpoint URL and fetching the data.
    async images(o: GetImagesParams) { const url = this.opToUrl(`${this.figmaHost}/images/${o.fileKey}`, o) return this.fetch(url) }
  • TypeScript type definition for input parameters matching the tool schema.
    export interface GetImagesParams { fileKey: string ids: string scale?: number format?: 'jpg' | 'png' | 'svg' | 'pdf' svg_include_id?: boolean svg_simplify_stroke?: boolean use_absolute_bounds?: boolean version?: string personalToken?: string }

Other Tools

Related Tools

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/f2c-ai/f2c-mcp'

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