Skip to main content
Glama

transform_card

Convert Adaptive Cards between versions, apply host-specific configurations, or flatten nested structures.

Instructions

Transform an Adaptive Card: upgrade/downgrade version, apply host-specific constraints, or flatten nesting.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cardYesThe Adaptive Card JSON object or cardId to transform
transformYesThe type of transformation to apply
targetVersionNoTarget version for upgrade/downgrade (e.g., "1.3", "1.5", "1.6")
targetHostNoTarget host

Implementation Reference

  • Main handler function for the transform_card tool. Accepts a card and a transform type (upgrade-version, downgrade-version, apply-host-config, or flatten) and dispatches to the appropriate internal transformation function.
    export function handleTransformCard(input: TransformCardInput): TransformCardOutput {
      const { card, transform, targetVersion, targetHost } = input;
    
      const result = JSON.parse(JSON.stringify(card)) as Record<string, unknown>;
      const changes: string[] = [];
      const warnings: string[] = [];
    
      switch (transform) {
        case "upgrade-version":
          upgradeVersion(result, targetVersion || "1.6", changes, warnings);
          break;
        case "downgrade-version":
          downgradeVersion(result, targetVersion || "1.3", changes, warnings);
          break;
        case "apply-host-config":
          applyHostConfig(result, targetHost || "teams", changes, warnings);
          break;
        case "flatten":
          flattenCard(result, changes, warnings);
          break;
      }
    
      return { card: result, changes, warnings };
    }
  • Input type interface for transform_card: card (object), transform (union type), optional targetVersion, targetHost, hostConfig.
    export interface TransformCardInput {
      card: Record<string, unknown>;
      transform: TransformType;
      targetVersion?: string;
      targetHost?: HostApp;
      hostConfig?: Record<string, unknown>;
    }
  • TransformType union type defining the four allowed transform values: upgrade-version, downgrade-version, apply-host-config, flatten.
    export type TransformType =
      | "upgrade-version"
      | "downgrade-version"
      | "apply-host-config"
      | "flatten";
  • Output type interface for transform_card: card (object), changes (string array), warnings (string array).
    export interface TransformCardOutput {
      card: Record<string, unknown>;
      changes: string[];
      warnings: string[];
    }
  • Tool registration entry in the TOOLS array. Defines name 'transform_card', description, and JSON input schema with card (required), transform (enum of 4 values, required), targetVersion (optional string), targetHost (optional enum).
    {
      name: "transform_card",
      description:
        "Transform an Adaptive Card: upgrade/downgrade version, apply host-specific constraints, or flatten nesting.",
      inputSchema: {
        type: "object" as const,
        properties: {
          card: {
            description: "The Adaptive Card JSON object or cardId to transform",
          },
          transform: {
            type: "string",
            enum: ["upgrade-version", "downgrade-version", "apply-host-config", "flatten"],
            description: "The type of transformation to apply",
          },
          targetVersion: {
            type: "string",
            description: 'Target version for upgrade/downgrade (e.g., "1.3", "1.5", "1.6")',
          },
          targetHost: { type: "string", enum: HOST_ENUM, description: "Target host" },
        },
        required: ["card", "transform"],
      },
    },
  • Server dispatch case for 'transform_card': calls handleTransformCard, stores the card, and returns result with cardId.
    case "transform_card": {
      const txResult = handleTransformCard(parsed as any);
      const cardId = storeCard(txResult.card, { tool: "transform_card" });
      result = { ...txResult, cardId };
      break;
    }
Behavior2/5

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

No annotations are provided, so the description must cover behavioral traits. It does not disclose whether transformations mutate the card, return a new card, require specific permissions, or have side effects. The term 'transform' is vague.

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?

Single sentence covers main purpose efficiently. No superfluous words. However, a more structured format (e.g., bullet points) could improve scanability, but not necessary.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema, so description should mention return values or side effects. It doesn't. Also, with 4 parameters and only 2 required, description doesn't explain when optional parameters are needed. Incomplete for a transformation tool.

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?

Input schema has 100% description coverage, so baseline is 3. The description adds a high-level list of transformations, but the schema already provides enum values for 'transform' and descriptions for 'targetVersion' and 'targetHost'. No additional meaning beyond schema.

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 transforms an Adaptive Card, listing specific operations (upgrade/downgrade version, apply host constraints, flatten nesting). This distinguishes it from sibling tools like generate_card or validate_card.

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

Usage Guidelines2/5

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

No guidance on when to use this tool vs alternatives. For instance, it doesn't clarify when to use 'transform_card' over 'optimize_card' or 'suggest_layout'. No context 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/VikrantSingh01/adaptive-cards-mcp'

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