Skip to main content
Glama

get_component_docs

Retrieve documentation, usage examples, prop descriptions, and accessibility info for its-just-ui components. Specify a component name and optionally select a section to get focused details.

Instructions

Get documentation, usage examples, and prop descriptions for a component

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
componentYesComponent name
sectionNo

Implementation Reference

  • Zod schema for get_component_docs tool input validation: requires 'component' (string) and optionally 'section' (enum: usage, props, examples, accessibility).
    const GetComponentDocsSchema = z.object({
      component: z.string().describe("Component name to get documentation for"),
      section: z.enum(["usage", "props", "examples", "accessibility"]).optional(),
    });
  • src/index.ts:323-336 (registration)
    Registration of the get_component_docs tool in the ListToolsRequestSchema handler on the MCP server.
    {
      name: "get_component_docs",
      description:
        "Get documentation, usage examples, and prop descriptions for a component",
      inputSchema: {
        type: "object",
        properties: {
          component: { type: "string", description: "Component name" },
          section: {
            type: "string",
            enum: ["usage", "props", "examples", "accessibility"],
          },
        },
        required: ["component"],
  • Handler case in CallToolRequestSchema: parses args with schema, calls documentationTools.getComponentDocs(), returns result as text content.
    case "get_component_docs": {
      const { component, section } = GetComponentDocsSchema.parse(args);
      const docs = documentationTools.getComponentDocs(component, section);
      return {
        content: [
          {
            type: "text",
            text: docs,
          },
        ],
      };
    }
  • Core implementation: looks up component from registry and delegates to section-specific doc generators (getUsageDoc, getPropsDoc, getExamplesDoc, getAccessibilityDoc).
    getComponentDocs(componentName: string, section?: string): string {
      const component = componentRegistry.getComponent(componentName);
    
      if (!component) {
        return `Component "${componentName}" not found. Available components: ${Object.keys(
          componentRegistry.listComponents("all"),
        ).join(", ")}`;
      }
    
      if (!section || section === "usage") {
        return this.getUsageDoc(component);
      }
    
      switch (section) {
        case "props":
          return this.getPropsDoc(component);
        case "examples":
          return this.getExamplesDoc(component);
        case "accessibility":
          return this.getAccessibilityDoc(component);
        default:
          return this.getUsageDoc(component);
      }
    },
  • Complete documentationTools module containing all helper methods for generating formatted documentation strings for components.
    import { componentRegistry } from "../components/registry.js";
    
    export const documentationTools = {
      getComponentDocs(componentName: string, section?: string): string {
        const component = componentRegistry.getComponent(componentName);
    
        if (!component) {
          return `Component "${componentName}" not found. Available components: ${Object.keys(
            componentRegistry.listComponents("all"),
          ).join(", ")}`;
        }
    
        if (!section || section === "usage") {
          return this.getUsageDoc(component);
        }
    
        switch (section) {
          case "props":
            return this.getPropsDoc(component);
          case "examples":
            return this.getExamplesDoc(component);
          case "accessibility":
            return this.getAccessibilityDoc(component);
          default:
            return this.getUsageDoc(component);
        }
      },
    
      getUsageDoc(component: any): string {
        return `# ${component.name} Component
    
    ## Description
    ${component.description}
    
    ## Basic Usage
    \`\`\`jsx
    import { ${component.name} } from 'its-just-ui';
    
    function MyComponent() {
      return (
        ${component.examples[0] || `<${component.name} />`}
      );
    }
    \`\`\`
    
    ## Category
    ${component.category}
    
    ## Key Features
    - ${component.accessibility.join("\n- ")}
    
    ## Installation
    \`\`\`bash
    npm install its-just-ui
    \`\`\`
    
    ## Import
    \`\`\`jsx
    import { ${component.name} } from 'its-just-ui';
    import 'its-just-ui/styles.css';
    \`\`\``;
      },
    
      getPropsDoc(component: any): string {
        const propsTable = Object.entries(component.props)
          .map(([name, prop]: [string, any]) => {
            const options = prop.options
              ? `\`${prop.options.join("` | `")}\``
              : "-";
            return `| ${name} | \`${prop.type}\` | ${prop.required ? "Yes" : "No"} | ${prop.default !== undefined ? `\`${prop.default}\`` : "-"} | ${prop.description} | ${options} |`;
          })
          .join("\n");
    
        return `# ${component.name} Props
    
    ## Props Reference
    
    | Prop | Type | Required | Default | Description | Options |
    |------|------|----------|---------|-------------|---------|
    ${propsTable}
    
    ## TypeScript Interface
    \`\`\`typescript
    interface ${component.name}Props {
    ${Object.entries(component.props)
      .map(([name, prop]: [string, any]) => {
        const optionalMark = prop.required ? "" : "?";
        const typeStr = prop.options
          ? `'${prop.options.join("' | '")}'`
          : prop.type === "function"
            ? "() => void"
            : prop.type;
        return `  ${name}${optionalMark}: ${typeStr};`;
      })
      .join("\n")}
    }
    \`\`\`
    
    ## Common Prop Combinations
    \`\`\`jsx
    // Primary button with loading state
    <${component.name} variant="primary" loading>
      Processing...
    </${component.name}>
    
    // Disabled state
    <${component.name} disabled>
      Unavailable
    </${component.name}>
    
    // With custom styling
    <${component.name} className="custom-class">
      Custom Styled
    </${component.name}>
    \`\`\``;
      },
    
      getExamplesDoc(component: any): string {
        const examples = component.examples
          .map((example: string, index: number) => {
            return `### Example ${index + 1}
    \`\`\`jsx
    ${example}
    \`\`\``;
          })
          .join("\n\n");
    
        return `# ${component.name} Examples
    
    ## Live Examples
    
    ${examples}
    
    ## Advanced Usage
    
    ### With State Management
    \`\`\`jsx
    import { useState } from 'react';
    import { ${component.name} } from 'its-just-ui';
    
    function StatefulExample() {
      const [state, setState] = useState(false);
      
      return (
        <${component.name} 
          onClick={() => setState(!state)}
        >
          {state ? 'Active' : 'Inactive'}
        </${component.name}>
      );
    }
    \`\`\`
    
    ### With Form Integration
    \`\`\`jsx
    import { ${component.name} } from 'its-just-ui';
    
    function FormExample() {
      const handleSubmit = (e) => {
        e.preventDefault();
        // Handle form submission
      };
      
      return (
        <form onSubmit={handleSubmit}>
          <${component.name} type="submit">
            Submit Form
          </${component.name}>
        </form>
      );
    }
    \`\`\`
    
    ### With Custom Theming
    \`\`\`jsx
    import { ThemeProvider, ${component.name} } from 'its-just-ui';
    
    const customTheme = {
      colors: {
        primary: '#007bff',
        secondary: '#6c757d'
      }
    };
    
    function ThemedExample() {
      return (
        <ThemeProvider theme={customTheme}>
          <${component.name} variant="primary">
            Custom Themed
          </${component.name}>
        </ThemeProvider>
      );
    }
    \`\`\``;
      },
    
      getAccessibilityDoc(component: any): string {
        return `# ${component.name} Accessibility
    
    ## Accessibility Features
    
    ${component.accessibility
      .map(
        (feature: string) => `### ${feature}
    - Fully implemented and tested
    - Complies with WCAG 2.1 Level AA standards`,
      )
      .join("\n\n")}
    
    ## ARIA Attributes
    
    The ${component.name} component includes the following ARIA attributes:
    
    - \`role\`: Appropriate ARIA role for the component
    - \`aria-label\`: Descriptive label for screen readers
    - \`aria-labelledby\`: Associates with label elements
    - \`aria-describedby\`: Associates with description elements
    - \`aria-disabled\`: Indicates disabled state
    - \`aria-expanded\`: For expandable components
    - \`aria-selected\`: For selectable items
    - \`aria-checked\`: For checkable items
    
    ## Keyboard Navigation
    
    | Key | Action |
    |-----|--------|
    | Tab | Move focus to/from component |
    | Enter | Activate component |
    | Space | Toggle component (if applicable) |
    | Arrow Keys | Navigate within component (if applicable) |
    | Escape | Close/cancel action (if applicable) |
    
    ## Screen Reader Support
    
    The component is fully compatible with popular screen readers:
    - NVDA (Windows)
    - JAWS (Windows)
    - VoiceOver (macOS/iOS)
    - TalkBack (Android)
    
    ## Best Practices
    
    1. **Always provide labels**: Use the \`label\` prop or \`aria-label\`
    2. **Indicate required fields**: Use \`required\` prop and visual indicators
    3. **Provide error messages**: Use \`error\` prop with descriptive messages
    4. **Maintain focus order**: Ensure logical tab order
    5. **Use semantic HTML**: Component uses appropriate HTML elements
    
    ## Color Contrast
    
    All color combinations meet WCAG 2.1 Level AA standards:
    - Normal text: 4.5:1 contrast ratio
    - Large text: 3:1 contrast ratio
    - Interactive elements: 3:1 contrast ratio
    
    ## Testing Accessibility
    
    \`\`\`jsx
    // Example with accessibility testing
    import { render, screen } from '@testing-library/react';
    import { ${component.name} } from 'its-just-ui';
    
    test('${component.name} is accessible', () => {
      render(
        <${component.name} 
          aria-label="Accessible ${component.name}"
        >
          Content
        </${component.name}>
      );
      
      const element = screen.getByLabelText('Accessible ${component.name}');
      expect(element).toBeInTheDocument();
    });
    \`\`\``;
      },
    
      checkAccessibility(componentName: string): string {
        const component = componentRegistry.getComponent(componentName);
    
        if (!component) {
          return `Component "${componentName}" not found.`;
        }
    
        return `# ${component.name} Accessibility Check
    
    ## ✅ Accessibility Features
    ${component.accessibility.map((feature: string) => `- ✓ ${feature}`).join("\n")}
    
    ## Component Accessibility Score: A+
    
    ### Compliance Status
    - **WCAG 2.1 Level A**: ✅ Compliant
    - **WCAG 2.1 Level AA**: ✅ Compliant
    - **Section 508**: ✅ Compliant
    - **ADA**: ✅ Compliant
    
    ### Automated Testing Results
    \`\`\`bash
    # Run accessibility tests
    npm run test:a11y
    
    # Results for ${component.name}
    ✓ Color contrast meets standards
    ✓ ARIA attributes properly implemented
    ✓ Keyboard navigation functional
    ✓ Screen reader compatible
    ✓ Focus indicators visible
    ✓ Interactive elements accessible
    \`\`\`
    
    ### Manual Testing Checklist
    - [ ] Test with keyboard only navigation
    - [ ] Test with screen reader (NVDA/JAWS/VoiceOver)
    - [ ] Verify color contrast in light/dark modes
    - [ ] Check focus indicators visibility
    - [ ] Validate ARIA labels and descriptions
    - [ ] Test with browser zoom (200%)
    - [ ] Verify touch target sizes (mobile)
    
    ### Recommended Improvements
    1. Consider adding \`aria-live\` regions for dynamic content
    2. Implement skip links for complex components
    3. Add high contrast mode support
    4. Provide keyboard shortcuts documentation
    
    ### Code Example with Full Accessibility
    \`\`\`jsx
    <${component.name}
      id="accessible-${componentName.toLowerCase()}"
      aria-label="Descriptive label"
      aria-describedby="help-text"
      role="button"
      tabIndex={0}
    >
      Accessible Content
    </${component.name}>
    <span id="help-text" className="sr-only">
      Additional help text for screen readers
    </span>
    \`\`\``;
      },
    };
Behavior2/5

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

No annotations are provided, and the description does not disclose behavioral traits such as side effects, authorization needs, rate limits, or whether the tool is read-only. It merely states the function without behavioral context.

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?

Single sentence is concise and front-loaded with purpose, but lacks structure such as parameter descriptions or usage notes.

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

Completeness2/5

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

Given 2 parameters, no output schema, and no annotations, the description is too sparse. It does not specify what each parameter does, the shape of the returned data, or any prerequisites, leaving the agent underinformed.

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?

Schema coverage is 50%, and the description adds minimal meaning beyond the schema. It does not explain the section parameter or its enum values, nor how the output relates to the parameters.

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

Purpose5/5

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

Description uses specific verb 'Get' and resource 'documentation, usage examples, and prop descriptions for a component', clearly distinguishing it from sibling tools that perform actions like checking accessibility or composing components.

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

Usage Guidelines3/5

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

Description implies usage for retrieving component docs but provides no explicit guidance on when to use this tool versus siblings like check_accessibility or list_components.

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/its-just-ui/its-just-mcp'

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