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);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool 'ONLY returns the text snippet' and that after calling, 'you must edit or add files to integrate the snippet into the codebase', which provides some behavioral context about the output and required follow-up actions. However, it doesn't cover important aspects like whether this is a read-only operation, potential rate limits, authentication needs, or error conditions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized with three sentences that each serve a purpose: when to use the tool, what it returns, and what to do after calling it. It's front-loaded with the primary use case. There's minimal waste, though the phrasing could be slightly more polished.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 2 parameters with 100% schema coverage but no annotations and no output schema, the description provides adequate but incomplete context. It explains the tool's purpose and post-call requirements but doesn't describe the return format (beyond 'text snippet'), error handling, or how the tool interacts with the buouui.com API. For a tool with no output schema, more detail about the return value would be helpful.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters thoroughly. The description doesn't add any additional meaning about the parameters beyond what's in the schema - it doesn't explain how 'message' and 'searchQuery' relate to each other or provide usage examples. This meets the baseline of 3 when schema coverage is high.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool fetches UI component text snippets from buouui.com, which is a clear purpose. However, it doesn't distinguish this from sibling tools like 'list-ui' or 'create-image' - it mentions 'get inspiration' which could overlap with 'list-ui', and 'previews' which might relate to 'create-image', but no explicit differentiation is provided.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states 'Use this tool when the user wants to see component, get inspiration, or /buou or /ui fetch data and previews from buouui.com', providing clear context for when to use it. However, it doesn't mention when NOT to use it or explicitly compare it to alternatives like 'list-ui' or 'create-image'.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install 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