Skip to main content
Glama

Component Code

Show in Component Code

component_code_show
Read-only

Shows a React component in the chat in Component Code: a live preview beside the code that uses it. Each string, number and boolean in the code becomes a control the reader can change. Use it when someone asks to show a component in Component Code, or to see, preview or try one.

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": {
      "source": "<source>",
      "code": "<code>"
    },
    "name": "component_code_show"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesHow the component is used, in JSX: elements, props and text only, with no hooks, calls or conditions. It is shown as code and rendered as the preview. Each string, number and boolean in it becomes a control.
fileNoThe file named in the code's tab, such as `Card.tsx`.
sourceYesThe component's module in TSX. It may import only from 'react'. Its exports, the default one by its function's name, are what `code` can name. For each value the reader can change by using the component, such as `checked`, `open` or `value`, take a matching `onCheckedChange`, `onOpenChange` or `onValueChange` prop and call it with the new value. Component Code passes it, so the change shows in the code. Keep state of its own only for when the prop is missing.
controlsNoHow a prop is changed, by its name or by `Element.prop`: a list of options, `{ min, max, step }` for a number, or `false` to keep it as written.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.9/5.0
Behavior4/5

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

Annotations declare readOnlyHint=true and openWorldHint=false, and the description goes beyond that by explaining that the preview renders live alongside the code and that each string, number and boolean literal becomes an interactive control. It also discloses the react-only import constraint and the prop-driven state handoff, which are real behavioral rules an agent could otherwise only discover by failing.

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?

Two sentences, both front-loaded: the first establishes what the tool produces, the second when to invoke it. Slightly awkward phrasing ('in the chat in Component Code') adds a little friction but nothing is padding.

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?

For a four-parameter tool with nested objects and no output schema, the description plus the unusually thorough schema cover what the agent needs. The only real gap is orienting the agent against the sibling component_code_show_html, which the definition never mentions.

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

Parameters3/5

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

Schema description coverage is 100%, so the baseline is 3. The description's line about literals becoming controls restates what the `code` parameter description already says, and it adds nothing about `source`, `file` or `controls` beyond the schema, so it neither compensates nor detracts.

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?

States a specific verb and resource ('Shows a React component in the chat in Component Code') and describes the output shape: a live preview beside the code that uses it. It doesn't distinguish itself from the sibling component_code_show_html, so an agent must infer that split from names alone.

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?

Gives a clear triggering condition: use it when someone asks to show a component in Component Code, or to see, preview or try one. There are no exclusions or named alternatives, and nothing tells the agent when to prefer the HTML variant instead.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources