Skip to main content
Glama
petalframework

petal-components-mcp

Official

list_components

List every component in the petal_components library to see what's available before composing HEEx markup.

Instructions

List every component available in petal_components (the Shadcn-style Phoenix LiveView component library). Use this first to see what's available before composing HEEx markup.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/mcp.ts:27-57 (registration)
    Tool registration for 'list_components' as part of the ListToolsRequestSchema handler. Defines the tool name, description, and empty input schema.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: [
        {
          name: "list_components",
          description:
            "List every component available in petal_components (the Shadcn-style Phoenix LiveView component library). Use this first to see what's available before composing HEEx markup.",
          inputSchema: {
            type: "object",
            properties: {},
            additionalProperties: false,
          },
        },
        {
          name: "get_component",
          description:
            "Get the full schema for a single petal_components component — attrs, slots, defaults, allowed values, and a HEEx usage example. Call this any time you're about to write a Phoenix LiveView component reference like <.pc_button> or <.input>, to ensure the attrs and slots match the real library.",
          inputSchema: {
            type: "object",
            properties: {
              name: {
                type: "string",
                description:
                  "Component function name (e.g. 'button', 'modal', 'input'). Get the full list via list_components.",
              },
            },
            required: ["name"],
            additionalProperties: false,
          },
        },
      ],
    }));
  • Handler for the 'list_components' tool. Calls listComponents() from schemas.ts and formats the output text with component count, names, modules, and summaries.
    if (name === "list_components") {
      const components = listComponents();
      const text = [
        `petal_components v${schemas.version} — ${components.length} components`,
        "",
        ...components.map((c) => `- \`${c.name}\` (${c.module}) — ${c.summary}`),
        "",
        "Call `get_component` with a name to get the full schema and usage example.",
      ].join("\n");
    
      return {
        content: [{ type: "text", text }],
      };
    }
  • The listComponents() helper function that iterates over schemas.components and extracts name, module, and summary for each component.
    export function listComponents() {
      return schemas.components.map((c) => ({
        name: c.name,
        module: c.module,
        summary: summarize(c),
      }));
    }
  • Type definitions (Component, SchemaFile) that define the shape of component data returned by listComponents.
    export type Component = {
      name: string;
      module: string;
      kind: string;
      attrs: ComponentAttr[];
      slots: ComponentSlot[];
    };
    
    export type SchemaFile = {
      version: string;
      generated_at: string;
      components: Component[];
    };
  • The summarize() helper function called by listComponents() to generate a human-readable summary string for each component.
    function summarize(c: Component): string {
      const attrCount = c.attrs.length;
      const slotCount = c.slots.length;
      const required = c.attrs.filter((a) => a.required).map((a) => a.name);
      const requiredSlots = c.slots.filter((s) => s.required).map((s) => s.name);
    
      const parts = [`${attrCount} attrs`, `${slotCount} slots`];
      if (required.length) parts.push(`required attrs: ${required.join(", ")}`);
      if (requiredSlots.length) parts.push(`required slots: ${requiredSlots.join(", ")}`);
    
      return parts.join(" · ");
    }
Behavior3/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. It discloses the scope ('every component') but does not mention output format, ordering, or other behavioral traits. Adequate for a simple list operation.

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?

Two sentences with no waste. First sentence states the action and resource, second provides usage guidance. Front-loaded and efficient.

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

Completeness5/5

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

Given zero parameters, no output schema, and no annotations, the description provides essential purpose and usage context. Complete for a simple list tool.

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?

Input schema has zero parameters, so baseline is 4. Description adds no parameter information, but none is needed as there are none to describe.

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 it lists every component in a specific library (petal_components), providing a distinct purpose from the sibling tool get_component, which presumably retrieves details for a single component.

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?

Explicitly says 'Use this first to see what's available before composing HEEx markup,' giving clear guidance on when to use it. Lacks explicit exclusion, but the sibling context implies differentiation.

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/petalframework/petal-components-mcp'

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