Get Block Metadata
get-blocks-metadataRetrieve metadata for all FlyonUI blocks. Provides block details, properties, and structure for component discovery and integration in your UI projects.
Instructions
Fetch the metadata of a block from a given URL. Use this tool to retrieve the block metadata. This will provide the metadata of all the FlyonUI blocks available for use.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:109-139 (registration)Registration of the 'get-blocks-metadata' tool. It defines the tool name, description, and the async handler function that fetches block metadata from the FlyonUI API endpoint `/instructions?path=block_metadata.json`.
// A tool to get the metadata of a block from a given URL. server.registerTool( "get-blocks-metadata", { title: "Get Block Metadata", description: "Fetch the metadata of a block from a given URL. Use this tool to retrieve the block metadata. This will provide the metadata of all the FlyonUI blocks available for use.", }, async () => { try { const url = `/instructions?path=block_metadata.json`; const response = await apiClient.get(url); if (response.status !== 200) { throw new Error(`Failed to fetch block metadata: ${response.status}`); } return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), } ], }; } catch (error) { console.error("Error fetching block metadata:", error); throw new Error("Failed to fetch block metadata"); } } ); - src/index.ts:116-138 (handler)The handler function for 'get-blocks-metadata'. It fetches block metadata JSON from the FlyonUI MCP API and returns it as text content.
async () => { try { const url = `/instructions?path=block_metadata.json`; const response = await apiClient.get(url); if (response.status !== 200) { throw new Error(`Failed to fetch block metadata: ${response.status}`); } return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), } ], }; } catch (error) { console.error("Error fetching block metadata:", error); throw new Error("Failed to fetch block metadata"); } } - src/utils/http-client.ts:1-66 (helper)HTTP client utility used by the tool handler to make GET requests to the FlyonUI API at https://flyonui.com/api/mcp.
import { config } from "./config.js"; const API_KEY = config.apiKey || process.env.API_KEY; export const BASE_URL = "https://flyonui.com/api/mcp"; type HttpMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH"; interface HttpClient { get<T>( endpoint: string, options?: RequestInit ): Promise<{ status: number; data: T }>; post<T>( endpoint: string, data?: unknown, options?: RequestInit ): Promise<{ status: number; data: T }>; put<T>( endpoint: string, data?: unknown, options?: RequestInit ): Promise<{ status: number; data: T }>; delete<T>( endpoint: string, data?: unknown, options?: RequestInit ): Promise<{ status: number; data: T }>; patch<T>( endpoint: string, data?: unknown, options?: RequestInit ): Promise<{ status: number; data: T }>; } const createMethod = (method: HttpMethod) => { return async <T>( endpoint: string, data?: unknown, options: RequestInit = {} ) => { const headers: HeadersInit = { "Content-Type": "application/json", ...(API_KEY ? { "x-license-key": API_KEY } : {}), ...options.headers, }; const response = await fetch(`${BASE_URL}${endpoint}`, { ...options, method, headers, ...(data ? { body: JSON.stringify(data) } : {}), }); return { status: response.status, data: (await response.json()) as T }; }; }; export const apiClient: HttpClient = { get: createMethod("GET"), post: createMethod("POST"), put: createMethod("PUT"), delete: createMethod("DELETE"), patch: createMethod("PATCH"), }; - src/index.ts:112-115 (schema)Schema/title description for the tool. This tool has no input parameters; it has a title 'Get Block Metadata' and a description explaining it fetches metadata of all available FlyonUI blocks.
{ title: "Get Block Metadata", description: "Fetch the metadata of a block from a given URL. Use this tool to retrieve the block metadata. This will provide the metadata of all the FlyonUI blocks available for use.", },