Skip to main content
Glama

get_context_diff

Highlight differences between marketing site and product app design systems by comparing colors, typography, and components side-by-side.

Instructions

Compare marketing site vs product app design systems side-by-side, highlighting differences in colors, typography, and components.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryNoCategory to compareall

Implementation Reference

  • Main handler function that compares marketing vs product design systems across colors, typography, and components. Takes a DesignSystemIndex and GetContextDiffArgs, returning a JSON diff.
    export function handler(index: DesignSystemIndex, args: GetContextDiffArgs) {
      const category = args.category ?? 'all';
      const mkt = index.resolved.marketing;
      const prod = index.resolved.product;
      const diff: Record<string, unknown> = {};
    
      if (category === 'colors' || category === 'all') {
        const mktTokens = new Set(mkt.colors.map((c) => c.token));
        const prodTokens = new Set(prod.colors.map((c) => c.token));
    
        diff.colors = {
          marketingOnly: mkt.colors.filter((c) => !prodTokens.has(c.token)).map((c) => ({ name: c.name, token: c.token, value: c.value })),
          productOnly: prod.colors.filter((c) => !mktTokens.has(c.token)).map((c) => ({ name: c.name, token: c.token, value: c.value })),
          shared: mkt.colors
            .filter((c) => prodTokens.has(c.token))
            .map((mc) => {
              const pc = prod.colors.find((c) => c.token === mc.token);
              return {
                token: mc.token,
                marketing: mc.value,
                product: pc?.value,
                differs: mc.value !== pc?.value,
              };
            }),
        };
      }
    
      if (category === 'typography' || category === 'all') {
        const mktNames = new Set(mkt.typography.map((t) => t.token ?? t.name));
        const prodNames = new Set(prod.typography.map((t) => t.token ?? t.name));
    
        diff.typography = {
          marketingOnly: mkt.typography.filter((t) => !prodNames.has(t.token ?? t.name)).map((t) => ({ name: t.name, fontSize: t.fontSize })),
          productOnly: prod.typography.filter((t) => !mktNames.has(t.token ?? t.name)).map((t) => ({ name: t.name, fontSize: t.fontSize })),
        };
      }
    
      if (category === 'components' || category === 'all') {
        const mktNames = new Set(mkt.components.map((c) => c.name));
        const prodNames = new Set(prod.components.map((c) => c.name));
    
        diff.components = {
          marketingOnly: mkt.components.filter((c) => !prodNames.has(c.name)).map((c) => ({ name: c.name, category: c.category })),
          productOnly: prod.components.filter((c) => !mktNames.has(c.name)).map((c) => ({ name: c.name, category: c.category })),
          both: mkt.components.filter((c) => prodNames.has(c.name)).map((c) => c.name),
        };
      }
    
      return [{ type: 'text' as const, text: JSON.stringify(diff, null, 2) }];
    }
  • Input schema defining the 'category' parameter with options: colors, typography, components, or all (default).
    export const INPUT_SCHEMA = {
      type: 'object' as const,
      properties: {
        category: { type: 'string', enum: ['colors', 'typography', 'components', 'all'], default: 'all', description: 'Category to compare' },
      },
    };
  • TypeScript interface GetContextDiffArgs with optional category property ('colors' | 'typography' | 'components' | 'all').
    export interface GetContextDiffArgs {
      /**
       * Which category to diff between marketing and product contexts.
       * "all" returns diffs for every category.
       */
      category?: 'colors' | 'typography' | 'components' | 'all';
    }
  • Registration of the get_context_diff tool in the CallToolRequestSchema switch-case, dispatching to contextDiff.handler.
    case contextDiff.TOOL_NAME:
      return { content: contextDiff.handler(index, args as never) };
  • Import of the contextDiff module from get-context-diff.js and inclusion in ALL_TOOLS registration array.
    import * as contextDiff from './get-context-diff.js';
    import * as validateUsage from './validate-usage.js';
    
    import { listResources, readResource } from '../resources/index.js';
    import { listPrompts, getPrompt } from '../prompts/index.js';
    
    /** All tool modules in registration order. */
    const ALL_TOOLS = [
      brandOverview,
      colors,
      typography,
      logos,
      components,
      guidelines,
      tokens,
      textures,
      css,
      searchBrand,
      contextDiff,
      validateUsage,
    ] as const;
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It describes the core behavior (comparing and highlighting differences), but it does not disclose the output format, potential side effects, permissions, or rate limits. The behavior is simple and likely read-only, but the lack of output description is a gap.

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 a single, short sentence (18 words) that conveys the entire purpose without any fluff. Every word earns its place, making it highly concise and easy to parse.

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 simplicity (one parameter, no nested objects, no output schema), the description covers the main intent well. However, it does not describe the output format (e.g., what a 'highlight' looks like). Nonetheless, the context of sibling tools and the clear purpose makes it reasonably complete.

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?

The input schema coverage is 100% for the single parameter, and the schema description covers the enum values. The tool description mentions 'colors, typography, and components,' which aligns with the enum, adding marginal context. Since schema already provides good coverage, baseline 3 is appropriate.

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 tool compares two specific design systems (marketing site vs product app) side-by-side, focusing on differences in colors, typography, and components. This specific verb-resource combination distinguishes it from sibling tools that retrieve individual elements or overviews.

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?

The description implies usage when needing a side-by-side comparison of the two design systems. It provides clear context but does not explicitly state when not to use or mention alternatives, such as using individual get_* tools for a single system. Since siblings are listed, the context is fairly clear.

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/ejwhite7/brandkit-mcp'

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