Skip to main content
Glama

getSchema

Retrieve prop schemas for Semiotic chart components to understand required parameters and enable static SVG rendering through renderChart.

Instructions

Return the prop schema for a Semiotic chart component. Pass { component: '' } to get its props, or omit component to list all available components. Components marked [renderable] can be passed to renderChart for static SVG output.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
componentNoComponent name, e.g. 'LineChart'. Omit to list all.

Implementation Reference

  • The handler function `getSchemaHandler` that implements the logic for the "getSchema" tool, including listing available components and returning specific component schemas.
    async function getSchemaHandler(args: { component?: string }): Promise<ToolResult> {
      const component = args.component
    
      if (!component) {
        const all = Object.keys(schemaByComponent).sort()
        const renderable = new Set(Object.keys(COMPONENT_REGISTRY))
        const list = all.map(name => renderable.has(name) ? `${name} [renderable]` : name)
        return {
          content: [{ type: "text" as const, text: `Available components (${all.length}):\n${list.join(", ")}\n\nComponents marked [renderable] can be rendered to SVG via renderChart. Others (Realtime*) require a browser environment.\n\nPass { component: '<name>' } to get the prop schema for a specific component.` }],
        }
      }
    
      const entry = schemaByComponent[component]
      if (!entry) {
        const available = Object.keys(schemaByComponent).sort()
        return {
          content: [{ type: "text" as const, text: `Unknown component "${component}". Available: ${available.join(", ")}` }],
          isError: true,
        }
      }
    
      const renderableNote = COMPONENT_REGISTRY[component] ? "This component can be rendered to SVG via renderChart." : "This component requires a browser environment and cannot be rendered via renderChart."
      return {
        content: [{ type: "text" as const, text: `${renderableNote}\n\n${JSON.stringify(entry, null, 2)}` }],
      }
    }
  • The registration of the "getSchema" tool within the McpServer instance, defining its description, schema, and handler.
    srv.tool(
      "getSchema",
      `Return the prop schema for a Semiotic chart component. Pass { component: '<name>' } to get its props, or omit component to list all available components. Components marked [renderable] can be passed to renderChart for static SVG output.`,
      { component: z.string().optional().describe("Component name, e.g. 'LineChart'. Omit to list all.") },
      getSchemaHandler
    )

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/nteract/semiotic'

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