Skip to main content
Glama
design-system-mcp
by dgesteves

Get a component contract

get_component
Read-onlyIdempotent

Retrieves a component's full contract—import, props/types/defaults, cva variants, parts, tokens, docs, and examples—so agents can build matching UI. Call before using a component.

Instructions

Get the full contract of one component: import, props with types and defaults, cva variants and the classes each applies, parts (sub-components), design tokens it uses, usage guidelines and examples from its docs. Call it before using a component. Accepts "Button", "CardHeader" or "Card.Header". At a monorepo root, pass path (the file you are editing) to get the component its project uses.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "name": "<name>"
    },
    "name": "get_component"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameYesComponent name, e.g. "Button" or "CardHeader".
pathNoIn a monorepo served from its root: the file you are editing, or a project folder, relative to the root, to answer from that project. Without it, every project is listed together. Ignored in a single project. When the server was started outside your project, pass the file as an absolute path: the project is found from it.

Output Schema

NameRequiredDescriptionDefault
docsNo
nameYesHow the component is written in JSX: Button, CardHeader, Tabs.List.
propsYes
importYesThe import statement to use.
parentNo
sourceYes
tokensYesNames of the design tokens its classes use.
aliasesYes
cssVarsYes
elementNoThe native element it renders or wraps.
libraryNoThe published package it is read from, by its type declarations: "@mui/material".
packageNoAt a workspace root: the package its source belongs to, e.g. "@acme/ui".
examplesYes
inheritsYes
projectsNoAt a workspace root: the folders of the projects that use it.
variantsYes
openPropsYesPart of the props type did not resolve; extra props may be accepted.
classNamesYes
deprecatedNo
exportNameYes
importPathYes
descriptionNo
labelsChildNoA prop whose text is its child element's accessible name (MUI Tooltip's title), unless `unless` is set.
polymorphicNoA prop that renders another element or component in its place, with its props: "component".
defaultImportNoAnother module that exports it as its default: "@mui/material/Button".
subcomponentsYes
compoundVariantsYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changedv0.12.1
    • changedInput schema / properties / path / description
      Previous value: -"In a monorepo served from its root: the file you are editing, or a project folder, relative to the root, to answer from that project. Without it, every project is listed together. Ignored in a single project."New value: +"In a monorepo served from its root: the file you are editing, or a project folder, relative to the root, to answer from that project. Without it, every project is listed together. Ignored in a single project. When the server was started outside your project, pass the file as an absolute path: the project is found from it."
    • addedOutput schema / properties / defaultImport
      Added value: +{
      +  "description": "Another module that exports it as its default: \"@mui/material/Button\".",
      +  "type": "string"
      +}
    • addedOutput schema / properties / labelsChild
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "A prop whose text is its child element's accessible name (MUI Tooltip's title), unless `unless` is set.",
      +  "properties": {
      +    "prop": {
      +      "type": "string"
      +    },
      +    "unless": {
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "prop"
      +  ],
      +  "type": "object"
      +}
    • addedOutput schema / properties / library
      Added value: +{
      +  "description": "The published package it is read from, by its type declarations: \"@mui/material\".",
      +  "type": "string"
      +}
    • addedOutput schema / properties / polymorphic
      Added value: +{
      +  "description": "A prop that renders another element or component in its place, with its props: \"component\".",
      +  "type": "string"
      +}
  2. First observedv0.6.0

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare this a read-only, idempotent, non-destructive, closed-world read, so the safety profile is covered. The description adds genuinely new behavioral context: which name forms are accepted and how the monorepo root changes resolution scope. It does not mention rate limits or ambiguity resolution when a name matches multiple projects.

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?

Front-loads the payload contents, then the call-before-use directive, then name formats, then the monorepo caveat. The content list is long but each item is a distinct field an agent would want. Minor slack in restating the `path` behavior already in the schema.

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?

With an output schema present, return-shape explanation is optional, and the description still previews the contract's sections. For a 2-parameter read tool this is nearly complete; only multi-project ambiguity and error behavior when a component name is not found are unaddressed.

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?

Schema coverage is 100%, so baseline would be 3, but the description earns above that by giving concrete accepted name syntaxes ("Button", "CardHeader", "Card.Header") that the schema's example does not cover. It also summarizes the `path` semantics — project-scoped lookup, ignored in a single project — though the schema already details the absolute-path fallback.

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?

States a specific verb and resource ("Get the full contract of one component") and enumerates exactly what the contract contains: import, props with types and defaults, cva variants with classes, parts, tokens, usage guidelines and examples. This clearly separates it from list_components and search_components, which do not return a full contract.

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?

"Call it before using a component" gives explicit when-to-use guidance, and the monorepo sentence tells the agent when to add `path`. It never names list_components or search_components as alternatives for discovery, so the routing is implied rather than fully spelled out.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.