get-block-content
Fetch code block content from authenticated URLs to retrieve UI component implementations for development workflows.
Instructions
Fetch the content of a block from a given URL. Use this tool to retrieve the code block content from the authenticated URL.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| endpoint | Yes | ||
| type | Yes |
Implementation Reference
- src/index.ts:183-205 (handler)The handler function for the 'get-block-content' tool. It constructs a URL by appending the 'type' query parameter to the endpoint, fetches the data using apiClient.get, and returns the response content formatted as MCP text content.async ({ endpoint, type }) => { try { const url = endpoint + "?type=" + type; const response = await apiClient.get(url); if (response.status !== 200) { throw new Error(`Failed to fetch block data: ${response.status}`); } return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), } ], }; } catch (error) { console.error("Error fetching block data:", error); throw new Error("Failed to fetch block data"); } }
- src/index.ts:181-181 (schema)Input schema defining required parameters 'endpoint' (string) and 'type' (string) using Zod.inputSchema: { endpoint: z.string(), type: z.string() }
- src/index.ts:176-206 (registration)Registers the 'get-block-content' tool with the MCP server, providing name, metadata (title, description, inputSchema), and the handler function.server.registerTool( "get-block-content", { title: "Get Block Data", description: "Fetch the content of a block from a given URL. Use this tool to retrieve the code block content from the authenticated URL.", inputSchema: { endpoint: z.string(), type: z.string() } }, async ({ endpoint, type }) => { try { const url = endpoint + "?type=" + type; const response = await apiClient.get(url); if (response.status !== 200) { throw new Error(`Failed to fetch block data: ${response.status}`); } return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), } ], }; } catch (error) { console.error("Error fetching block data:", error); throw new Error("Failed to fetch block data"); } } );
- src/utils/http-client.ts:60-66 (helper)Definition of the apiClient used in the handler. It provides HTTP methods including 'get' which performs authenticated fetch requests to the FlyonUI API base URL.export const apiClient: HttpClient = { get: createMethod("GET"), post: createMethod("POST"), put: createMethod("PUT"), delete: createMethod("DELETE"), patch: createMethod("PATCH"), };