Skip to main content
Glama

get-component-docs

Retrieve detailed documentation for Ant Design components, including API properties and usage examples, to help developers implement UI elements correctly.

Instructions

获取 Ant Design 特定组件的详细文档 适用场景:

  1. 用户询问如何使用特定组件

  2. 用户需要查看该组件的 api 属性

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
componentNameYes

Implementation Reference

  • The core handler function that retrieves component documentation using the helper function and formats it into the MCP response format with text content.
        async ({ componentName }) => {
          const documentation = await getComponentDocumentation(componentName);
          return {
            content: [
              {
                type: "text",
                text: `${componentName} 组件的文档:
    ${documentation}
    如有版本说明需要提醒用户需要使用某个版本及以上的版本`,
              },
            ],
          };
        },
  • Zod schema defining the input parameter: componentName as a string.
    { componentName: z.string() },
  • The registration function that sets up the 'get-component-docs' tool on the MCP server, including name, description, schema, and handler.
    /** 获取组件文档 */
    const registryTool = (server: McpServer) => {
      server.tool(
        "get-component-docs",
        `获取 Ant Design 特定组件的详细文档
    适用场景:
    1. 用户询问如何使用特定组件
    2. 用户需要查看该组件的 api 属性`,
        { componentName: z.string() },
        async ({ componentName }) => {
          const documentation = await getComponentDocumentation(componentName);
          return {
            content: [
              {
                type: "text",
                text: `${componentName} 组件的文档:
    ${documentation}
    如有版本说明需要提醒用户需要使用某个版本及以上的版本`,
              },
            ],
          };
        },
      );
    }
    
    export default registryTool;
  • Aggregates and invokes registration for all tools, including get-component-docs via its imported registry function.
    export default function registryTools(server: McpServer) {
      [getComponentDocs, listComponentExamples, getComponentChangelog, listComponents].forEach((registryFn) => {
        registryFn(server)
      })
    }
  • Helper function that loads and caches the documentation for a specific component from the extracted data files.
    export const getComponentDocumentation = async (componentName: string) => {
      const component = await findComponentByName(componentName);
    
      if (!component) {
        return ` "${componentName}" 组件文档不存在`;
      }
    
      const docPath = join(EXTRACTED_COMPONENTS_DATA_PATH, component.dirName, DOC_FILE_NAME);
    
      try {
        const cacheComponentDoc = componentCache.get('componentsDoc') || {}
        if (cacheComponentDoc?.[component.name]) {
          return cacheComponentDoc[component.name]
        }
    
        if (existsSync(docPath)) {
          const docResult = await readFile(docPath, "utf-8");
    
          cacheComponentDoc[component.name] = docResult
          componentCache.set('componentsDoc', cacheComponentDoc)
    
          return docResult
        }
    
        return `${component.name} 组件文档不存在`;
      } catch (error) {
        console.error(`获取 ${component.name} 组件文档错误: ${(error as Error).message}`);
        return `获取 ${component.name} 组件文档错误: ${(error as Error).message}`;
      }
    };
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. The description only states what the tool does (get documentation) but doesn't disclose any behavioral traits such as whether it requires authentication, has rate limits, returns structured data vs. raw text, or handles errors. For a tool with zero annotation coverage, this is a significant gap in transparency.

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 and front-loaded: it starts with the main purpose, followed by usage scenarios in a bullet-like format. Every sentence earns its place by providing essential information. However, it could be slightly more structured (e.g., separating scenarios with clearer formatting) for a perfect 5.

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 the tool's complexity (simple lookup with 1 parameter), no annotations, no output schema, and low schema coverage, the description is minimally adequate. It covers the purpose and usage scenarios but lacks details on parameters, behavior, and output. It's complete enough for basic understanding but has clear gaps that could hinder effective use.

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

Parameters2/5

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

The schema has 1 parameter with 0% description coverage, meaning the parameter 'componentName' is undocumented in the schema. The description doesn't add any meaning beyond what the schema provides—it doesn't explain what 'componentName' should be (e.g., valid component names, format, case sensitivity). With low schema coverage (<50%), the description fails to compensate, leaving the parameter semantics unclear.

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

Purpose4/5

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

The description clearly states the tool's purpose: '获取 Ant Design 特定组件的详细文档' (Get detailed documentation for specific Ant Design components). It specifies the verb ('获取' - get) and resource ('Ant Design 特定组件的详细文档' - detailed documentation for specific Ant Design components). However, it doesn't explicitly differentiate from sibling tools like 'list-components' or 'get-component-changelog', which would require a 5.

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 provides clear usage scenarios: '适用场景:1. 用户询问如何使用特定组件 2. 用户需要查看该组件的 api 属性' (Applicable scenarios: 1. When users ask how to use a specific component 2. When users need to view the component's API properties). This gives good context for when to use the tool. However, it doesn't explicitly mention when NOT to use it or name alternatives like 'list-component-examples' for examples instead of documentation, which would be needed for a 5.

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

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