Skip to main content
Glama

fetch-ui

Fetch UI component code snippets from buouui.com for inspiration or integration. Returns text snippets to add to your codebase after editing.

Instructions

"Use this tool when the user wants to see component, get inspiration, or /buou or /ui fetch data and previews from buouui.com. This tool ONLY returns the text snippet for that UI component. After calling this tool, you must edit or add files to integrate the snippet into the codebase."

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageYesFull users message
searchQueryYesSearch query for buouui.com(library for searching UI components) to find a UI component that matches the user's message. Must be a two-four words max or phrase

Implementation Reference

  • The async execute method of the FetchUiTool class that implements the core logic of the 'fetch-ui' tool. It sends a POST request to '/api/fetch' with the message and searchQuery, returns the JSON stringified response, or handles errors appropriately.
    async execute({ message, searchQuery }: z.infer<typeof this.schema>) { try { const { data } = await twentyFirstClient.post<FetchUiResponse>( "/api/fetch", { message, searchQuery, } ); return { content: [ { type: "text" as const, text: JSON.stringify(data), }, ], }; } catch (error) { console.error("Error executing tool:", error); // 返回更详细的错误信息 return { content: [ { type: "text" as const, text: `Error: ${ error instanceof Error ? error.message : "Failed to generate UI component" }. Please try again.`, }, ], }; }
  • Zod schema defining the input parameters for the 'fetch-ui' tool: 'message' (full user message) and 'searchQuery' (short phrase for UI component search).
    schema = z.object({ message: z.string().describe("Full users message"), searchQuery: z .string() .describe( "Search query for buouui.com(library for searching UI components) to find a UI component that matches the user's message. Must be a two-four words max or phrase" ), });
  • src/index.ts:13-13 (registration)
    Registration of a new FetchUiTool instance with the MCP server using its register method.
    new FetchUiTool().register(server);

Other Tools

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/buoooou/mcp-ui-gen'

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