figma_get_image_fills
Extract all image resources from a specified Figma file using your personal access token to streamline asset management and integration workflows.
Instructions
Get all image resources in the specified Figma file
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"fileKey": "<fileKey>"
},
"name": "figma_get_image_fills"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fileKey | Yes | Unique identifier of the Figma file | |
| personalToken | No | Your Figma personal access token |
Implementation Reference
- src/server/figma/tools/figma.ts:79-91 (handler)Handler function for the 'figma_get_image_fills' tool. Calls api.imageFills and returns the result as JSON or error message. (Note: entire registration block is commented out)
// async (o): Promise<CallToolResult> => { // try { // const data = await api.imageFills(o) // return { // content: [{type: 'text', text: JSON.stringify(data)}], // } // } catch (error: any) { // return { // content: [{type: 'text', text: `Error: ${error.message}`}], // } // } // }, - src/server/figma/tools/figma.ts:72-92 (registration)Registration of the 'figma_get_image_fills' tool on the MCP server, including name, description, schema, and handler. Currently commented out.
// server.tool( // 'figma_get_image_fills', // 'Get all image resources in the specified Figma file', // { // fileKey: z.string().describe('Unique identifier of the Figma file'), // personalToken: z.string().optional().describe('Your Figma personal access token'), // }, // async (o): Promise<CallToolResult> => { // try { // const data = await api.imageFills(o) // return { // content: [{type: 'text', text: JSON.stringify(data)}], // } // } catch (error: any) { // return { // content: [{type: 'text', text: `Error: ${error.message}`}], // } // } // }, // ) - Zod input schema for the figma_get_image_fills tool parameters.
// { // fileKey: z.string().describe('Unique identifier of the Figma file'), // personalToken: z.string().optional().describe('Your Figma personal access token'), // }, - src/server/figma/apis/figma.ts:24-27 (helper)Core helper function in FigmaRestApi that constructs the Figma API URL for image fills and fetches the data.
async imageFills(o: GetKeyParams) { const url = this.opToUrl(`${this.figmaHost}/files/${o.fileKey}/images`, o) return this.fetch(url) } - TypeScript interface defining parameters for imageFills API call (used by the handler).
export interface GetKeyParams { fileKey: string personalToken?: string }