Skip to main content
Glama

diagnoseConfig

Analyze Semiotic chart configurations to identify issues like empty data, bad dimensions, or missing accessors, and generate actionable fixes in a diagnostic report.

Instructions

Diagnose a Semiotic chart configuration for common problems (empty data, bad dimensions, missing accessors, wrong data shape, etc). Returns a human-readable diagnostic report with actionable fixes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
componentYesChart component name, e.g. 'LineChart'
propsNoChart props object, e.g. { data: [...], xAccessor: 'x' }.

Implementation Reference

  • MCP tool handler for 'diagnoseConfig' that validates component props and reports diagnostic findings.
    async function diagnoseConfigHandler(args: { component?: string; props?: Record<string, any> }): Promise<ToolResult> {
      const component = args.component
      const props: Record<string, any> = args.props ?? {}
    
      if (!component) {
        return {
          content: [{ type: "text" as const, text: "Missing 'component' field. Provide { component: 'LineChart', props: { ... } }." }],
          isError: true,
        }
      }
    
      const result = diagnoseConfig(component, props)
      if (result.ok) {
        const warnings = result.diagnoses.filter((d: any) => d.severity === "warning")
        const msg = warnings.length > 0
          ? `Configuration looks good with ${warnings.length} warning(s):\n${warnings.map((w: any) => `⚠ [${w.code}] ${w.message}\n  Fix: ${w.fix}`).join("\n")}`
          : `✓ Configuration looks good — no issues detected.`
        return { content: [{ type: "text" as const, text: msg }] }
      }
    
      const lines = result.diagnoses.map((d: any) => {
        const icon = d.severity === "error" ? "✗" : "⚠"
        const fixLine = d.fix ? `\n  Fix: ${d.fix}` : ""
        return `${icon} [${d.code}] ${d.message}${fixLine}`
      })
      return {
        content: [{ type: "text" as const, text: lines.join("\n") }],
        isError: true,
      }
    }
  • Core implementation of 'diagnoseConfig' which orchestrates various diagnostic checks for Semiotic chart configurations.
    export function diagnoseConfig(
      componentName: string,
      props: Record<string, any>
    ): DiagnosisResult {
      const diagnoses: Diagnosis[] = []
    
      // Run validateProps first
      const validation = validateProps(componentName, props)
      for (const err of validation.errors) {
        diagnoses.push({
          severity: "error",
          code: "VALIDATION",
          message: err,
          fix: "", // validateProps errors already contain guidance
        })
      }
    
      // If component is unknown, skip further checks
      if (!VALIDATION_MAP[componentName]) {
        return { ok: diagnoses.length === 0, diagnoses }
      }
    
      // Run anti-pattern checks
      checkEmptyData(componentName, props, diagnoses)
      checkBadDimensions(componentName, props, diagnoses)
      checkAccessorFieldMissing(componentName, props, diagnoses)
      checkHierarchyDataAsArray(componentName, props, diagnoses)
      checkNetworkMissingEdges(componentName, props, diagnoses)
      checkDateWithoutFormat(componentName, props, diagnoses)
      checkLinkedChartsWithoutSelection(componentName, props, diagnoses)
      checkNonZeroBaseline(componentName, props, diagnoses)
      checkDataGaps(componentName, props, diagnoses)
      checkMarginOverflow(componentName, props, diagnoses)
      checkDegenerateExtent(componentName, props, diagnoses)
      checkBarPaddingInvisible(componentName, props, diagnoses)
      checkBottomMarginWithLegend(componentName, props, diagnoses)
      checkLegendMarginTight(componentName, props, diagnoses)
      checkHeatmapStringAccessor(componentName, props, diagnoses)
    
      return {
        ok: diagnoses.every(d => d.severity === "warning"),
        diagnoses,
      }
    }
  • Registration of the 'diagnoseConfig' MCP tool within the McpServer instance.
    srv.tool(
      "diagnoseConfig",
      "Diagnose a Semiotic chart configuration for common problems (empty data, bad dimensions, missing accessors, wrong data shape, etc). Returns a human-readable diagnostic report with actionable fixes.",
      {
        component: z.string().describe("Chart component name, e.g. 'LineChart'"),
        props: z.record(z.string(), z.unknown()).optional().describe("Chart props object, e.g. { data: [...], xAccessor: 'x' }."),
      },
      diagnoseConfigHandler
    )
Behavior4/5

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

With no annotations provided, the description carries the full burden. It discloses key behavioral traits: it performs diagnosis (analysis without mutation), returns a human-readable diagnostic report (output format), and provides actionable fixes (practical guidance). However, it doesn't mention error handling, performance, or authentication needs, leaving some gaps.

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?

The description is front-loaded with the core purpose, followed by specific problem examples and output details in a single, efficient sentence. Every part adds value without redundancy, making it highly concise and well-structured.

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 the tool's complexity (diagnosing configurations with nested objects) and no output schema, the description adequately covers the purpose, behavior, and output format. However, it could be more complete by specifying error cases or limitations, though it compensates well with clear problem examples and actionable output.

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 schema already documents both parameters thoroughly. The description adds no additional parameter semantics beyond what's in the schema (e.g., examples of 'component' and 'props'), resulting in a baseline score of 3 where the schema does the heavy lifting.

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 specific action ('diagnose') and resource ('Semiotic chart configuration'), listing concrete problem types like 'empty data, bad dimensions, missing accessors, wrong data shape'. It distinguishes from siblings like 'renderChart' (visualization) and 'suggestChart' (recommendation) by focusing on validation and debugging.

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

Usage Guidelines3/5

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

The description implies usage when a chart configuration might have issues, but doesn't explicitly state when to use this tool versus alternatives like 'getSchema' (for schema inspection) or 'reportIssue' (for reporting problems). It provides some context through the problem examples but lacks explicit guidance on prerequisites or exclusions.

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

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