Skip to main content
Glama

get_conflicts

Audit disagreements between design sources like Figma and codebase. Returns conflict count, pending/resolved status, and suggested fixes.

Instructions

Get conflicts between design sources. Read-only, no side effects. Returns JSON with conflict count, actionable count, and a list of conflicts with type, name, resolution status, and suggested fixes. Pass type: 'all' | 'token' | 'component'. Pass status: 'all' | 'pending' | 'resolved'. Use this to audit disagreements between sources (e.g. Figma vs codebase). For resolved design values, use get_token or get_component instead.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeYes
statusYes

Implementation Reference

  • The actual handler function for the 'get_conflicts' MCP tool. Filters contract.conflicts by type ('all' | 'token' | 'component') and status ('all' | 'pending' | 'resolved'), then returns JSON with count, actionableCount, pendingDecisionCount, and the list of conflicts with their suggestedFix and sources.
    async (args) => {
      if (!this.contract) return this.noContract()
      const type = args.type || "all"
      const status = args.status || "pending"
      let conflicts = this.contract.conflicts
      if (type !== "all") conflicts = conflicts.filter((c) => c.type === type)
      if (status !== "all")
        conflicts = conflicts.filter((c) =>
          status === "pending" ? c.resolution === "pending" : c.resolution !== "pending"
        )
      const actionableCount = conflicts.filter((c) => c.actionable === true).length
      const pendingDecisionCount = conflicts.filter((c) => c.actionable === false).length
      return this.json({
        count: conflicts.length,
        actionableCount,
        pendingDecisionCount,
        conflicts: conflicts.map((c) => ({
          type: c.type,
          name: c.name,
          resolution: c.resolution,
          actionable: c.actionable ?? false,
          suggestedFix: c.suggestedFix,
          sources: c.sources
        }))
      })
    }
  • Registration of the 'get_conflicts' tool on the MCP server via this.server.registerTool(), including the inputSchema (type and status as z.string()) and the description.
    this.server.registerTool(
      "get_conflicts",
      {
        description:
          "Get conflicts between design sources. Read-only, no side effects. Returns JSON with conflict count, actionable count, and a list of conflicts with type, name, resolution status, and suggested fixes. Pass type: 'all' | 'token' | 'component'. Pass status: 'all' | 'pending' | 'resolved'. Use this to audit disagreements between sources (e.g. Figma vs codebase). For resolved design values, use get_token or get_component instead.",
        inputSchema: {
          type: z.string(),
          status: z.string()
        }
      },
      async (args) => {
        if (!this.contract) return this.noContract()
        const type = args.type || "all"
        const status = args.status || "pending"
        let conflicts = this.contract.conflicts
        if (type !== "all") conflicts = conflicts.filter((c) => c.type === type)
        if (status !== "all")
          conflicts = conflicts.filter((c) =>
            status === "pending" ? c.resolution === "pending" : c.resolution !== "pending"
          )
        const actionableCount = conflicts.filter((c) => c.actionable === true).length
        const pendingDecisionCount = conflicts.filter((c) => c.actionable === false).length
        return this.json({
          count: conflicts.length,
          actionableCount,
          pendingDecisionCount,
          conflicts: conflicts.map((c) => ({
            type: c.type,
            name: c.name,
            resolution: c.resolution,
            actionable: c.actionable ?? false,
            suggestedFix: c.suggestedFix,
            sources: c.sources
          }))
        })
      }
    )
  • The Conflict TypeScript interface that defines the shape of conflict objects used by get_conflicts and created during contract building.
    export interface Conflict {
      type: "token" | "component"
      name: string
      sources: Array<{
        source: SourceProvenance
        value: string
      }>
      resolved?: string
      resolution?: "auto" | "manual" | "pending"
      suggestedFix?: string
      actionable?: boolean
    }
  • The buildFixMessage helper method in ContractBuilder that generates suggestedFix strings and determines if a conflict is actionable — these messages are stored in the conflict objects returned by get_conflicts.
      private buildFixMessage(
        conflictType: "token" | "component",
        name: string,
        sources: Array<{ source: { adapter: string }; value: string }>
      ): { suggestedFix: string; actionable: boolean } {
        const sot = this.config.governance.sourceOfTruth
        const winner = sources.find((s) => s.source.adapter === sot)
        const losers = sources.filter((s) => s.source.adapter !== sot)
    
        if (conflictType === "token") {
          if (winner) {
            return {
              suggestedFix:
                `Token '${name}' conflicts across sources. ` +
                `'${sot}' is the source of truth (value: '${winner.value}'). ` +
                `Update ${losers.map((s) => `'${s.source.adapter}'`).join(", ")} to match, ` +
                `or change \`governance.sourceOfTruth\` in primitiv.config.js.`,
              actionable: true
            }
          }
          return {
            suggestedFix:
              `Token '${name}' conflicts across sources (${sources.map((s) => `${s.source.adapter}: '${s.value}'`).join(", ")}). ` +
              `No source of truth is configured for these sources. ` +
              `Set \`governance.sourceOfTruth\` in primitiv.config.js to resolve.`,
            actionable: false
          }
        }
    
        if (winner) {
          return {
            suggestedFix:
              `Component '${name}' is defined in multiple sources. ` +
              `'${sot}' is the source of truth (path: '${winner.value}'). ` +
              `Remove the duplicate from ${losers.map((s) => `'${s.source.adapter}'`).join(", ")}, ` +
              `or change \`governance.sourceOfTruth\` in primitiv.config.js.`,
            actionable: true
          }
        }
        return {
          suggestedFix:
            `Component '${name}' is defined in multiple sources (${sources.map((s) => `${s.source.adapter}: '${s.value}'`).join(", ")}). ` +
            `Set \`governance.sourceOfTruth\` in primitiv.config.js to resolve.`,
          actionable: false
        }
      }
    }
Behavior5/5

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

States 'Read-only, no side effects' explicitly. Describes return JSON structure, covering behavioral aspects fully in the absence of annotations.

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?

Efficient, front-loaded sentences covering purpose, safety, return, parameters, and usage guidance with no unnecessary words.

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?

Complete given no annotations or output schema: covers purpose, safety, return structure, parameter options, and sibling differentiation.

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

Parameters5/5

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

Schema has 0% description coverage but description adds full meaning: specifies allowed values for type ('all'|'token'|'component') and status ('all'|'pending'|'resolved'), and explains their role in filtering conflicts.

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?

Description clearly states 'Get conflicts between design sources' with specific verb and resource. It distinguishes from siblings by directing to use get_token or get_component for resolved values.

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

Usage Guidelines5/5

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

Explicitly says when to use the tool (audit disagreements between sources) and when not ('For resolved design values, use get_token or get_component instead'). Also specifies valid parameter values.

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/AI-by-design/primitiv'

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