Skip to main content
Glama

template_card

Convert static Adaptive Cards into templates with data binding expressions to create dynamic, reusable card components for Microsoft Teams, Outlook, and Copilot.

Instructions

Convert a static Adaptive Card into an Adaptive Card Template with ${expression} data binding.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cardNoA static Adaptive Card or cardId to convert into a template
dataShapeNoOptional data shape hint
descriptionNoIf no card is provided, describe the card to generate as a template

Implementation Reference

  • The handleTemplateCard function is the primary handler for the 'template_card' tool. It takes a static Adaptive Card or a description, converts it into an Adaptive Card Template, generates sample data, and creates a binding guide.
    export function handleTemplateCard(input: TemplateCardInput): TemplateCardOutput {
      const { card, dataShape, description } = input;
    
      let sourceCard: Record<string, unknown>;
    
      if (card) {
        sourceCard = JSON.parse(JSON.stringify(card));
      } else if (description) {
        // Generate a card from the description, then templatize it
        sourceCard = assembleCard({
          content: description,
          version: "1.6",
        });
      } else {
        throw new Error("Either 'card' or 'description' must be provided");
      }
    
      const expressions: ExpressionEntry[] = [];
      const sampleData: Record<string, unknown> = {};
      const repeatedDataSamples: Record<string, unknown[]> = {};
    
      // Templatize the card
      const template = templatizeNode(sourceCard, "$", expressions, sampleData, repeatedDataSamples, dataShape);
    
      // Merge repeated data samples into sampleData
      for (const [key, samples] of Object.entries(repeatedDataSamples)) {
        sampleData[key] = samples;
      }
    
      // Build binding guide
      const bindingGuide = buildBindingGuide(expressions, sampleData);
    
      return {
        template: template as Record<string, unknown>,
        sampleData,
        expressions,
        bindingGuide,
      };
    }
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral disclosure. It mentions the conversion process and data binding but doesn't describe what happens during conversion (e.g., validation, error handling), whether it's idempotent, performance characteristics, or what the output looks like. For a tool that transforms content, this leaves significant 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 a single, efficient sentence with zero wasted words. It's front-loaded with the core purpose and includes the essential technical detail about data binding. Every element earns its place without redundancy or unnecessary elaboration.

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?

Given the tool's complexity (conversion with data binding), lack of annotations, and no output schema, the description is insufficient. It doesn't explain what a successful conversion produces, error conditions, or how the template differs from the original card. For a transformation tool with three parameters, this leaves too much undefined for reliable agent use.

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 all three parameters thoroughly. The description adds no parameter-specific information beyond what's in the schema—it doesn't explain how 'card' vs 'description' parameters interact, what 'dataShape' does, or provide examples of ${expression} usage. Baseline 3 is appropriate when 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 ('Convert') and resource ('static Adaptive Card into an Adaptive Card Template'), including the key mechanism ('${expression} data binding'). It distinguishes from siblings like 'generate_card' or 'transform_card' by focusing specifically on template conversion with data binding expressions.

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?

The description provides no guidance on when to use this tool versus alternatives like 'generate_card' or 'transform_card'. It doesn't mention prerequisites, constraints, or typical scenarios where template conversion is needed versus other card operations available in the sibling tools list.

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