Skip to main content
Glama

export_multiple_images

Export multiple Figma design elements as images in one batch operation. Specify file ID, node IDs, format (PNG, JPG, SVG, PDF), and scale to download multiple images simultaneously.

Instructions

批量导出多个节点的图片

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileIdYesFigma文件ID
nodeIdsYes节点ID列表
formatNo图片格式,默认为pngpng
scaleNo图片缩放比例,默认为1

Implementation Reference

  • src/index.ts:94-125 (registration)
    Registration of the 'export_multiple_images' tool in the ListTools response, including name, description, and input schema.
    {
      name: 'export_multiple_images',
      description: '批量导出多个节点的图片',
      inputSchema: {
        type: 'object',
        properties: {
          fileId: {
            type: 'string',
            description: 'Figma文件ID',
          },
          nodeIds: {
            type: 'array',
            items: { type: 'string' },
            description: '节点ID列表',
          },
          format: {
            type: 'string',
            enum: ['png', 'jpg', 'svg', 'pdf'],
            description: '图片格式,默认为png',
            default: 'png',
          },
          scale: {
            type: 'number',
            description: '图片缩放比例,默认为1',
            default: 1,
            minimum: 0.01,
            maximum: 4,
          },
        },
        required: ['fileId', 'nodeIds'],
      },
    },
  • The primary MCP tool handler that destructures input arguments, invokes the image extractor for multiple images, and formats the JSON response.
    private async handleExportMultipleImages(args: any) {
      const { fileId, nodeIds, format = 'png', scale = 1 } = args;
    
      const options: ImageExportOptions = { format, scale };
      const results = await this.imageExtractor.getMultipleImages(fileId, nodeIds, options);
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              success: true,
              data: {
                images: results,
                totalCount: results.length,
              },
            }, null, 2),
          },
        ],
      };
    }
  • src/index.ts:203-204 (registration)
    Dispatcher case in the CallToolRequestSchema handler that routes to the specific tool handler.
    case 'export_multiple_images':
      return await this.handleExportMultipleImages(args);
  • Helper function implementing the batch image export logic: fetches node names, exports images via FigmaService, and constructs result objects.
    async getMultipleImages(
      fileId: string,
      nodeIds: string[],
      options: ImageExportOptions = {}
    ): Promise<ImageResult[]> {
      try {
        if (nodeIds.length === 0) {
          return [];
        }
    
        // 获取所有节点信息
        const nodeInfoPromises = nodeIds.map(nodeId => 
          this.figmaService.getNode(fileId, nodeId)
        );
        const nodeInfos = await Promise.all(nodeInfoPromises);
    
        // 导出所有图片
        const images = await this.figmaService.exportImage(fileId, nodeIds, options);
    
        const results: ImageResult[] = [];
        for (let i = 0; i < nodeIds.length; i++) {
          const nodeId = nodeIds[i];
          const nodeInfo = nodeInfos[i];
          const imageUrl = images[nodeId];
    
          if (imageUrl && nodeInfo) {
            results.push({
              url: imageUrl,
              nodeId,
              nodeName: nodeInfo.name,
              format: options.format || 'png',
              scale: options.scale || 1,
            });
          }
        }
    
        return results;
      } catch (error) {
        throw new Error(`批量获取图片失败: ${error instanceof Error ? error.message : '未知错误'}`);
      }
    }
  • Type definitions for ImageExportOptions (input options) and ImageResult (output format) used by the tool.
    export interface ImageExportOptions {
      format?: 'jpg' | 'png' | 'svg' | 'pdf';
      scale?: number;
      version?: string;
    }
    
    export interface ImageResult {
      url: string;
      nodeId: string;
      nodeName: string;
      format: string;
      scale: number;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool exports images but doesn't describe what 'export' entails (e.g., file generation, download links, permissions required, rate limits, or side effects). For a tool that likely creates outputs, this lack of detail is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence in Chinese that directly states the tool's function without any fluff or redundancy. It's appropriately sized and front-loaded, making it easy to parse quickly. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (export operation with multiple parameters), lack of annotations, and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., image URLs, file paths, error handling) or behavioral aspects like permissions or side effects. For a tool with potential side effects, this leaves critical gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all four parameters (fileId, nodeIds, format, scale). The description adds no additional parameter semantics beyond what's in the schema. This meets the baseline of 3 since the schema does the heavy lifting, but the description doesn't compensate or enhance understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('批量导出' - batch export) and resource ('多个节点的图片' - multiple node images), which is specific and unambiguous. However, it doesn't differentiate from sibling tools like 'get_node_images' or 'get_node_svg', which might have overlapping functionality. The purpose is clear but lacks sibling distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'get_node_images' or 'get_node_svg'. There's no mention of prerequisites, context, or exclusions. The agent must infer usage from the name and parameters alone, which is insufficient for optimal tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/Echoxiawan/figma-mcp-full-server'

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