Looking at the additional TypeScript files you've provided, here are the improved JSDoc comments for each:
/**
* Registers effect-related styling commands for the MCP server.
*
* This module provides comprehensive effect management tools including:
* - Direct effect application with custom parameters (shadows, blurs, etc.)
* - Effect style variable application for reusable effects
* - Batch operations for efficient bulk updates
* - Support for multiple effect types (DROP_SHADOW, INNER_SHADOW, LAYER_BLUR, etc.)
*
* Registered commands:
* - `set_effect`: Applies effects directly or via style variables to nodes
* - `create_effect_style_variable`: Creates reusable effect style variables
*
* @param {McpServer} server - The MCP server instance to register tools on
* @param {FigmaClient} figmaClient - The Figma client for API communication
* @returns {void}
*
* @example
* ```
* registerEffectTools(server, figmaClient);
*
* // Apply a drop shadow effect directly
* await figmaClient.executeCommand('set_effect', {
* entries: {
* nodeId: "123:456",
* effects: {
* type: "DROP_SHADOW",
* color: { r: 0, g: 0, b: 0, a: 0.25 },
* radius: 4,
* offset: { x: 0, y: 2 }
* }
* }
* });
*
* // Apply via style variable
* await figmaClient.executeCommand('set_effect', {
* entries: { nodeId: "123:456", effectStyleId: "S:effect123" }
* });
* ```
*
* @throws {Error} When nodeId is invalid or malformed
* @throws {Error} When neither effects nor effectStyleId is provided
* @throws {Error} When effect parameters are invalid (missing required properties)
*/
export function registerEffectTools(server: McpServer, figmaClient: FigmaClient) {
/**
* Registers legacy effect-related commands on the MCP server.
*
* This module provides backward compatibility for effect styling operations.
* It focuses on applying predefined effect styles to individual nodes.
*
* **Note**: This module is complementary to `effect-tools.ts` which provides
* more comprehensive effect management capabilities including batch operations
* and direct effect application.
*
* Registered commands:
* - `apply_effect_style`: Applies predefined effect styles to individual nodes
*
* @param {McpServer} server - The MCP server instance to register the tools on
* @param {FigmaClient} figmaClient - The Figma client used to execute commands against the Figma API
* @returns {void} This function does not return a value but registers the tools asynchronously
*
* @example
* ```
* registerEffectsTools(server, figmaClient);
*
* // Apply an effect style to a node
* const result = await figmaClient.executeCommand('apply_effect_style', {
* nodeId: "123:456",
* effectStyleId: "S:effect123"
* });
* ```
*
* @throws {Error} When nodeId is invalid or not in proper Figma format
* @throws {Error} When effectStyleId is empty, too long, or references non-existent style
* @throws {Error} When the specified node doesn't support effects
*
* @see {@link registerEffectTools} - For comprehensive effect management with batch operations
*/
export function registerEffectsTools(server: McpServer, figmaClient: FigmaClient) {
/**
* Registers fill and stroke styling commands for the MCP server.
*
* This module provides unified tools for managing visual styling properties
* on Figma nodes, including fill colors, stroke colors, and stroke weights.
* Supports both single node operations and efficient batch processing.
*
* Registered commands:
* - `set_fill_and_stroke`: Sets fill/stroke colors and stroke weight on nodes
* - `get_fill_and_stroke`: Retrieves current fill/stroke properties from nodes
*
* @param {McpServer} server - The MCP server instance to register tools on
* @param {FigmaClient} figmaClient - The Figma client for API communication
* @returns {void}
*
* @example
* ```
* registerFillTools(server, figmaClient);
*
* // Set fill and stroke on a single node
* await figmaClient.executeCommand('set_fill_and_stroke', {
* nodeId: "123:456",
* fillColor: { r: 1, g: 0, b: 0, a: 1 }, // Red fill
* strokeColor: { r: 0, g: 0, b: 1, a: 1 }, // Blue stroke
* strokeWeight: 2
* });
*
* // Batch operation on multiple nodes
* await figmaClient.executeCommand('set_fill_and_stroke', {
* nodeIds: ["123:456", "789:101"],
* fillColor: { r: 0, g: 1, b: 0, a: 0.8 } // Semi-transparent green
* });
*
* // Get current styling properties
* const styles = await figmaClient.executeCommand('get_fill_and_stroke', {
* nodeId: "123:456"
* });
* ```
*
* @throws {Error} When both nodeId and nodeIds are provided (mutually exclusive)
* @throws {Error} When neither nodeId nor nodeIds is provided
* @throws {Error} When no style properties (fillColor, strokeColor, strokeWeight) are specified for set operations
* @throws {Error} When node IDs are invalid or malformed
*/
export function registerFillTools(server: McpServer, figmaClient: FigmaClient) {
/**
* Registers font management commands on the MCP server.
*
* This module provides essential font loading capabilities for Figma text operations.
* Font loading is a prerequisite for applying text styles, as fonts must be
* asynchronously loaded before they can be used in text formatting operations.
*
* **Important**: Always load fonts before applying text styles that use them,
* as Figma requires fonts to be explicitly loaded for text manipulation.
*
* Registered commands:
* - `load_font_async`: Loads a specific font family and style asynchronously
*
* @param {McpServer} server - The MCP server instance to register the tools on
* @param {FigmaClient} figmaClient - The Figma client used to execute commands against the Figma API
* @returns {void} This function does not return a value but registers the tools asynchronously
*
* @example
* ```
* registerFontTools(server, figmaClient);
*
* // Load a font before using it
* await figmaClient.executeCommand('load_font_async', {
* family: 'Roboto',
* style: 'Regular'
* });
*
* // Load multiple font styles
* await figmaClient.executeCommand('load_font_async', {
* family: 'Inter',
* style: 'Bold'
* });
*
* // Now you can safely apply text styles using these fonts
* ```
*
* @throws {Error} When font family name is invalid or not available in Figma
* @throws {Error} When font style is not available for the specified family
* @throws {Error} When font loading fails due to network or permission issues
*
* @see {@link registerTextStyleTools} - For applying loaded fonts to text nodes
*/
export function registerFontTools(server: McpServer, figmaClient: FigmaClient) {
/**
* Registers gradient-related styling commands for the MCP server.
*
* This module provides comprehensive gradient management capabilities including:
* - Creating reusable gradient style variables with custom parameters
* - Applying gradients directly to nodes with full customization
* - Applying existing gradient styles to nodes for consistency
* - Support for all gradient types (LINEAR, RADIAL, ANGULAR, DIAMOND)
* - Batch operations for efficient bulk gradient application
* - Flexible application targets (FILL, STROKE, or BOTH)
*
* Registered commands:
* - `create_gradient_style`: Creates one or more reusable gradient style variables
* - `set_gradient`: Applies gradients directly or via style variables to nodes
*
* @param {McpServer} server - The MCP server instance to register tools on
* @param {FigmaClient} figmaClient - The Figma client for API communication
* @returns {void}
*
* @example
* ```
* registerGradientTools(server, figmaClient);
*
* // Create a gradient style variable
* await figmaClient.executeCommand('create_gradient_style', {
* gradients: {
* name: "Primary Gradient",
* gradientType: "LINEAR",
* stops: [
* { position: 0, color: [1][1] }, // Red at start
* { position: 1, color: [1][1] } // Blue at end
* ]
* }
* });
*
* // Apply gradient directly to a node
* await figmaClient.executeCommand('set_gradient', {
* entries: {
* nodeId: "123:456",
* gradientType: "RADIAL",
* stops: [
* { position: 0, color: [1][1][1][1] },
* { position: 1, color: [0, 0, 0, 0.5] }
* ],
* applyTo: "FILL"
* }
* });
*
* // Apply existing gradient style
* await figmaClient.executeCommand('set_gradient', {
* entries: {
* nodeId: "789:101",
* gradientStyleId: "S:gradient123",
* applyTo: "STROKE"
* }
* });
*
* // Batch gradient application
* await figmaClient.executeCommand('set_gradient', {
* entries: [
* { nodeId: "123:456", gradientStyleId: "S:gradient123", applyTo: "FILL" },
* { nodeId: "789:101", gradientStyleId: "S:gradient456", applyTo: "BOTH" }
* ]
* });
* ```
*
* @throws {Error} When gradient parameters are invalid (insufficient stops, invalid colors, etc.)
* @throws {Error} When node IDs are malformed or reference non-existent nodes
* @throws {Error} When gradient style IDs are invalid or reference non-existent styles
* @throws {Error} When color values are outside the valid range (0-1)
* @throws {Error} When stop positions are outside the valid range (0-1)
* @throws {Error} When neither direct gradient parameters nor style ID is provided
*
* @see {@link registerFillTools} - For solid color fills and strokes
* @see {@link registerEffectTools} - For visual effects that can complement gradients
*/
export function registerGradientTools(server: McpServer, figmaClient: FigmaClient) {
/**
* Main registration module for all styling-related MCP commands.
*
* This module serves as the central orchestrator for registering all styling tools
* with the MCP server. It provides a unified entry point for enabling comprehensive
* styling capabilities across the Figma MCP integration.
*
* **Registered tool categories:**
* - **Fill & Stroke Tools**: Solid colors, stroke weights, and basic styling
* - **Gradient Tools**: Linear, radial, angular, and diamond gradients with style variables
* - **Effect Tools**: Shadows, blurs, and other visual effects with batch support
* - **Legacy Effects Tools**: Backward compatibility for effect style application
* - **Style Tools**: General styling utilities and node style management
* - **Text Style Tools**: Typography styling, text formatting, and text-specific effects
* - **Font Tools**: Font loading and management for text operations
*
* **Architecture**: This module follows a modular registration pattern where each
* tool category is implemented in its own module and registered independently,
* allowing for granular control and maintainability.
*
* @param {McpServer} server - The MCP server instance to register all styling tools on
* @param {FigmaClient} figmaClient - The Figma client for API communication across all tools
* @returns {void}
*
* @example
* ```
* import { registerStyleCommands } from './styling';
* import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
* import { FigmaClient } from '../../../clients/figma-client';
*
* const server = new McpServer();
* const figmaClient = new FigmaClient();
*
* // Register all styling commands at once
* registerStyleCommands(server, figmaClient);
*
* // Now all styling commands are available:
* // - set_fill_and_stroke, get_fill_and_stroke
* // - create_gradient_style, set_gradient
* // - set_effect, apply_effect_style
* // - load_font_async
* // - text styling commands
* // - general style utilities
* ```
*
* @see {@link registerFillTools} - For fill and stroke color management
* @see {@link registerGradientTools} - For gradient creation and application
* @see {@link registerEffectTools} - For comprehensive effect management
* @see {@link registerEffectsTools} - For legacy effect style application
* @see {@link registerStyleTools} - For general styling utilities
* @see {@link registerTextStyleTools} - For typography and text formatting
* @see {@link registerFontTools} - For font loading and management
*
* @since 1.0.0
*/
export function registerStyleCommands(server: McpServer, figmaClient: FigmaClient): void {
Comprehensive Module Descriptions: Each function now has detailed descriptions explaining its specific role and how it fits into the larger styling ecosystem.
Clear Command Listings: Explicitly documented which commands each module registers for easy reference.
Practical Examples: Added realistic code examples showing common usage patterns for each module.
Error Documentation: Comprehensive @throws
documentation covering all potential error conditions.
Cross-References: Added @see
tags linking related modules and complementary functionality.
Architecture Notes: Explained the relationship between modules (e.g., effects-tools.ts vs effect-tools.ts).
Usage Context: Provided context about when and why to use each module's capabilities.
Batch Operation Examples: Showed both single and batch operation examples where applicable.
Parameter Validation: Documented validation rules and constraints for inputs.
Performance Considerations: Highlighted batch operations and efficiency considerations.
These improvements provide comprehensive documentation that will enhance developer experience, improve code maintainability, and provide better IntelliSense support in IDEs.
Citations: [1] https://ppl-ai-file-upload.s3.amazonaws.com/web/direct-files/attachments/60313916/b3cdf830-1f68-427e-b670-2f21008ce1bc/effect-tools.ts [2] https://ppl-ai-file-upload.s3.amazonaws.com/web/direct-files/attachments/60313916/f5cf1591-cab7-4ac2-86cb-74563c723643/effects-tools.ts [3] https://ppl-ai-file-upload.s3.amazonaws.com/web/direct-files/attachments/60313916/4dc2d82b-3910-4480-9f20-5d51747b33b7/fill-tools.ts [4] https://ppl-ai-file-upload.s3.amazonaws.com/web/direct-files/attachments/60313916/f9e2e27a-b7c9-49ab-a639-7acca9e9545a/font-tools.ts [5] https://ppl-ai-file-upload.s3.amazonaws.com/web/direct-files/attachments/60313916/e2920ad5-0090-42d3-ba39-dfe883c0d659/gradient-tools.ts [6] https://ppl-ai-file-upload.s3.amazonaws.com/web/direct-files/attachments/60313916/a7e79fb1-57a0-4795-bdd2-2b8095a32d00/index.ts [7] https://deliciousreverie.co.uk/posts/types-via-jsdoc-or-typescript/ [8] https://github.com/SoftwareBrothers/better-docs [9] https://dev.to/artxe2/how-to-set-up-jsdoc-for-npm-packages-1jm1 [10] https://www.ciccarello.me/blog/2024/02/17/trying-out-typescript-in-jsdoc-comments/ [11] https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html [12] https://www.reddit.com/r/vuejs/comments/st2zkt/jsdoc_or_typescript/ [13] https://dev.to/samuel-braun/boost-your-javascript-with-jsdoc-typing-3hb3 [14] jsdoc/jsdoc#1645 [15] https://blog.chainsafe.io/documenting-typescript-finding-the-right-tools-for-your-project/ [16] https://www.pullrequest.com/blog/leveraging-jsdoc-for-better-code-documentation-in-javascript/
Answer from Perplexity: pplx.ai/share
Here are the improved JSDoc comments for these TypeScript schema files:
Color Schema
Effect Schema
Fill Schema
Font Schema
Gradient Schema
Stroke Schema
Style Schema
Text Style Schema
The improved JSDoc comments now include:
@typedef
syntaxCitations:
[1] https://ppl-ai-file-upload.s3.amazonaws.com/web/direct-files/attachments/60313916/c6beb071-87f3-45db-81e7-1276635c48ff/color-schema.ts
[2] https://ppl-ai-file-upload.s3.amazonaws.com/web/direct-files/attachments/60313916/0a46303d-745f-4d9a-ae96-a99254b3d7a6/effect-schema.ts
[3] https://ppl-ai-file-upload.s3.amazonaws.com/web/direct-files/attachments/60313916/347930ab-faee-48d6-bf1d-3ea02f559860/fill-schema.ts
[4] https://ppl-ai-file-upload.s3.amazonaws.com/web/direct-files/attachments/60313916/f98803d8-dc11-40d0-915e-459def9b766a/font-schema.ts
[5] https://ppl-ai-file-upload.s3.amazonaws.com/web/direct-files/attachments/60313916/554a2dfc-3847-4324-b3e9-5164622e1d5b/gradient-schema.ts
[6] https://ppl-ai-file-upload.s3.amazonaws.com/web/direct-files/attachments/60313916/b46e6a79-f62c-4f6b-88dd-e9e7f821e867/stroke-schema.ts
[7] https://ppl-ai-file-upload.s3.amazonaws.com/web/direct-files/attachments/60313916/37cacbcc-dfc5-4ace-a8cf-3cee1fde9061/style-schema.ts
[8] https://ppl-ai-file-upload.s3.amazonaws.com/web/direct-files/attachments/60313916/474cb2b3-00e5-4fb2-81b8-58af32570a1d/text-style-schema.ts
Answer from Perplexity: pplx.ai/share