Skip to main content
Glama

getComponentList

Retrieve a complete list of components available in your Storybook configuration.

Instructions

Get a list of all components from the configured Storybook

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Private method on StorybookMCPServer that orchestrates getComponentList: fetches Storybook data from configured URL, then delegates to version-specific implementations (V3 or V5). Returns formatted list of component names.
    private async getComponentList() {
      try {
        const response = await fetch(this.storybookUrl);
        if (!response.ok) {
          throw new Error(`Failed to fetch Storybook data: ${response.statusText}`);
        }
    
        const data = (await response.json()) as StorybookDataV3 | StorybookDataV5;
    
        const components = data.v === 3 ? getComponentListV3(data) : getComponentListV5(data);
    
        return {
          content: [
            {
              type: 'text',
              text: `Available components:\n${components.join('\n')}`,
            },
          ],
        };
      } catch (error) {
        throw new Error(
          `Failed to get component list: ${error instanceof Error ? error.message : String(error)}`,
        );
      }
    }
  • V3-specific implementation: extracts component names from storybook data using the 'kind' property, filters out docs-only pages, deduplicates, and returns sorted list.
    export const getComponentList = (storybookData: StorybookData) => {
      if (!storybookData || storybookData.v !== 3 || !storybookData.stories) {
        return [];
      }
    
      const componentSet = new Set<string>();
      const stories = storybookData.stories;
    
      for (const key in stories) {
        if (Object.prototype.hasOwnProperty.call(stories, key)) {
          const story = stories[key];
          // filter out docs pages
          if (story.parameters && !story.parameters.docsOnly) {
  • V5-specific implementation: extracts component titles from storybook entries filtered by 'docs' type, deduplicates, and returns sorted list.
    export const getComponentList = (data: StorybookData) => {
      if (!data || data.v !== 5 || !data.entries) {
        return [];
      }
    
      const entries = data.entries;
    
      // extract component names, filter only docs type entries
      const components = Object.values(entries)
        .filter((entry) => entry.type === 'docs')
        .map((entry) => entry.title)
        .filter((title: string) => title)
        .sort();
    
      // remove duplicates
      const uniqueComponents = [...new Set(components)];
      return uniqueComponents;
    };
  • src/server.ts:145-151 (registration)
    Tool registration within ListToolsRequestSchema handler - defines name 'getComponentList', description, and input schema (empty object, no parameters).
      name: 'getComponentList',
      description: 'Get a list of all components from the configured Storybook',
      inputSchema: {
        type: 'object',
        properties: {},
      },
    },
  • Zod schema definition for getComponentList input validation - an empty object schema since no parameters are required.
    const GetComponentListSchema = z.object({});
Behavior2/5

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

No annotations exist, and the description does not disclose any behavioral traits such as side effects, permissions, or constraints. It only states the basic action.

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

Conciseness5/5

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

A single, front-loaded sentence with no extraneous words. Efficient and clear.

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

Completeness4/5

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

Given zero parameters and no output schema, the description is reasonably complete for a simple list tool, though it could mention the output format or read-only nature.

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

Parameters4/5

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

The schema has zero parameters and 100% coverage, so the description adds no param info. Baseline for 0 params is 4, and the description is consistent.

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?

The description clearly states the verb 'Get', resource 'list of all components', and source 'configured Storybook', distinguishing it from sibling 'getComponentsProps' which likely focuses on props.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus the sibling 'getComponentsProps' or any other context. The description is purely functional without usage hints.

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/mcpland/storybook-mcp'

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