get-block-content
Retrieve code block content from authenticated URLs using this tool. Designed for developers to fetch block data efficiently within the FlyonUI MCP Server environment.
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
| Name | Required | Description | Default |
|---|---|---|---|
| endpoint | Yes | ||
| type | Yes |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"endpoint": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"endpoint",
"type"
],
"type": "object"
}
Implementation Reference
- src/index.ts:176-206 (registration)Registration of the 'get-block-content' tool, including schema, description, and inline 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/index.ts:183-205 (handler)The handler function that executes the tool logic: constructs URL with endpoint and type, fetches data using apiClient, returns formatted JSON text content or throws error.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:178-182 (schema)Tool metadata including title, description, and input schema defining 'endpoint' and 'type' parameters using Zod.{ 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() } },