Skip to main content
Glama

data_to_card

Convert structured data like JSON or CSV into optimized Adaptive Cards for Microsoft Teams, Outlook, and other platforms. Automatically selects or specifies presentation formats including tables, charts, lists, and facts.

Instructions

Convert structured data (JSON array, CSV, key-value object) into the optimal Adaptive Card presentation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYesThe data to convert — JSON object, JSON array of objects, or CSV string
presentationNoPresentation type. "auto" (default) auto-selects
titleNoTitle for the card header
hostNoTarget host app. Default: generic
templateModeNoGenerate a templated card with ${expression} data binding. Default: false

Implementation Reference

  • The handler function `handleDataToCard` is the main logic responsible for converting structured data into an Adaptive Card, utilizing LLMs for complex data or deterministic assembly for simpler cases.
    export async function handleDataToCard(
      input: DataToCardInput,
    ): Promise<GenerateCardOutput> {
      const {
        data,
        presentation = "auto",
        title,
        host = "generic",
        theme,
        templateMode = false,
      } = input;
    
      const analysis = analyzeData(data);
      let card: Record<string, unknown>;
      let designNotes: string;
    
      // Try LLM for complex data structures
      if (isLLMAvailable() && (analysis.shape === "nested-object" || analysis.shape === "unknown")) {
        try {
          const systemPrompt = buildSystemPrompt(host);
          const userPrompt = buildDataToCardPrompt({
            data,
            title,
            presentation,
          });
    
          const response = await generateWithLLM({
            systemPrompt,
            userPrompt,
            maxTokens: 4096,
          });
    
          const parsed = extractJSON(response.content);
          if (parsed) {
            card = parsed;
            designNotes = `AI-generated from ${analysis.shape} data. ${analysis.summary}. Presentation: ${presentation === "auto" ? analysis.presentation : presentation}.`;
          } else {
            throw new Error("Failed to parse LLM output");
          }
        } catch {
          // Fallback to deterministic
          card = assembleCard({
            data,
            title,
            presentation,
            host,
          });
          designNotes = `Deterministic generation from ${analysis.shape} data. ${analysis.summary}. Auto-selected: ${analysis.presentation}.`;
        }
      } else {
        // Deterministic generation
        card = assembleCard({
          data,
          title,
          presentation,
          host,
        });
        designNotes = `Generated from ${analysis.shape} data. ${analysis.summary}. Presentation: ${presentation === "auto" ? analysis.presentation : presentation}.`;
      }
    
      // Validate
      const validation = handleValidateCard({ card, host });
    
      return {
        card,
        validation,
        designNotes,
      };
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions 'optimal Adaptive Card presentation' but doesn't explain what 'optimal' means, how the conversion works, what limitations exist, or what happens with invalid data. For a tool that transforms data formats with multiple presentation options, this leaves significant behavioral 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 that immediately states the tool's core function. Every word earns its place with no redundancy or unnecessary elaboration, making it perfectly front-loaded and concise.

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?

For a tool with 5 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what the tool returns, how 'auto' presentation selection works, what makes presentations 'optimal', or any error handling. The complexity of data conversion with multiple presentation types and host apps requires more complete guidance.

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 parameters thoroughly. The description adds no additional parameter semantics beyond mentioning JSON array, CSV, and key-value object formats for the 'data' parameter. This meets the baseline for high schema coverage but doesn't provide extra value.

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's purpose with a specific verb ('convert') and resource ('structured data') into a defined output ('Adaptive Card presentation'). It distinguishes from siblings by focusing on data-to-card conversion rather than generation, optimization, validation, or templating mentioned in sibling names.

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 converting structured data to Adaptive Cards, but provides no explicit guidance on when to use this tool versus alternatives like 'generate_card', 'template_card', or 'transform_card'. It mentions 'optimal' presentation but doesn't clarify what makes it optimal or when other tools might be better suited.

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