Skip to main content
Glama
context.js1.33 kB
/** * figma_get_context tool * Returns current document context including connection status, file info, and selection */ export const contextTool = { name: 'figma_get_context', description: 'Get the current Figma document context including file info, current page, and selection. Use this to understand what document is open and what the user has selected.', inputSchema: { type: 'object', properties: {}, required: [] } }; export async function handleGetContext(bridge) { if (!bridge.isConnected()) { return { content: [{ type: 'text', text: JSON.stringify({ connected: false, message: 'Figma plugin is not connected. Please open Figma and run the Claude Bridge plugin.' }, null, 2) }] }; } try { const result = await bridge.sendCommand('get_context', {}); return { content: [{ type: 'text', text: JSON.stringify({ connected: true, ...result }, null, 2) }] }; } catch (error) { return { content: [{ type: 'text', text: JSON.stringify({ connected: true, error: { code: error.code || 'UNKNOWN_ERROR', message: error.message } }, null, 2) }], isError: true }; } }

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/magic-spells/figma-mcp-bridge'

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