Skip to main content
Glama

list-components

Retrieve a list of available Ant Design UI components using the MCP server, enabling developers to select and integrate components into their projects effectively.

Instructions

当用户请求一个新的用户界面(UI)使用 Ant Design 组件时使用此工具。 此工具仅返回可用的组件列表。 调用此工具后,你必须编辑或添加文件,以便将代码片段集成到代码库中

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'list-components' tool. It loads the components list using loadComponentsList and formats it as a text response.
    调用此工具后,你必须编辑或添加文件,以便将代码片段集成到代码库中`, async () => { const components = await loadComponentsList(); return { content: [ { type: "text", text: `以下是可用的组件:${JSON.stringify(components.map(({ dirName, ...restProps }) => restProps))}`, }, ], }; });
  • Registers the 'list-components' tool on the MCP server, including name, description, and handler.
    const registryTool = (server: McpServer) => { server.tool( "list-components", `当用户请求一个新的用户界面(UI)使用 Ant Design 组件时使用此工具。 此工具仅返回可用的组件列表。 调用此工具后,你必须编辑或添加文件,以便将代码片段集成到代码库中`, async () => { const components = await loadComponentsList(); return { content: [ { type: "text", text: `以下是可用的组件:${JSON.stringify(components.map(({ dirName, ...restProps }) => restProps))}`, }, ], }; }); }
  • Central registration function that calls the individual tool registry functions, including listComponents.
    export default function registryTools(server: McpServer) { [getComponentDocs, listComponentExamples, getComponentChangelog, listComponents].forEach((registryFn) => { registryFn(server) }) }
  • Utility function to load the list of available components from cache or JSON file, used by the tool handler.
    export async function loadComponentsList() { try { const cacheComponentList = componentCache.get('componentsList') if (cacheComponentList) { return cacheComponentList } const componentList = await readFile(EXTRACTED_COMPONENTS_LIST_PATH, "utf-8"); const componentListJson = JSON.parse(componentList) as ComponentData[] componentCache.set('componentsList', componentListJson) return componentListJson } catch (error) { console.error(`加载组件列表错误: ${(error as Error).message}`); return []; }

Other Tools

Related 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/zhixiaoqiang/antd-components-mcp'

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