Skip to main content
Glama

generate_card

Convert natural language descriptions or structured data into valid Adaptive Card JSON for Microsoft Teams, Outlook, and other platforms, returning a card ID for reference.

Instructions

Convert any content — natural language description, structured data, or a combination — into a valid Adaptive Card v1.6 JSON. Returns cardId for reference in subsequent tool calls.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYesNatural language description of the card to generate, or paste raw data/text.
dataNoOptional structured data (JSON object or CSV string) to incorporate into the card
hostNoTarget host app. Default: generic
themeNoTheme for styling hints
intentNoThe intent of the card — helps select the best layout pattern
versionNoTarget Adaptive Card schema version. Default: "1.6"

Implementation Reference

  • The primary handler function 'handleGenerateCard' responsible for orchestrating the generation of Adaptive Cards, including choosing between LLM-based and deterministic approaches, validating the output, and generating supporting context references.
    export async function handleGenerateCard(
      input: GenerateCardInput,
    ): Promise<GenerateCardOutput> {
      const { content, data, host = "generic", intent, version = "1.6" } = input;
    
      let card: Record<string, unknown>;
      let designNotes: string;
    
      // Try LLM generation first if available
      if (isLLMAvailable()) {
        try {
          const result = await generateCardWithLLM(input);
          card = result.card;
          designNotes = result.designNotes;
        } catch (err) {
          // Fallback to deterministic generation
          card = assembleCard({
            content,
            data: data as unknown,
            intent,
            host,
            version,
          });
          designNotes = `Deterministic generation (LLM fallback due to: ${err instanceof Error ? err.message : "unknown error"}). Pattern-matched card based on content analysis.`;
        }
      } else {
        // Deterministic generation
        card = assembleCard({
          content,
          data: data as unknown,
          intent,
          host,
          version,
        });
        designNotes =
          "Deterministic generation (no LLM API key). Card assembled from pattern matching and data analysis. Set ANTHROPIC_API_KEY or OPENAI_API_KEY for AI-powered generation.";
      }
    
      // Validate the generated card
      const validation = handleValidateCard({ card, host });
    
      // Add reference context for MCP clients
      const examples = selectExamples(content, 3);
      const references: GenerateCardOutput["references"] = {
        examples: examples.map(ex => ({
          name: ex.name,
          description: `Example: ${ex.tags.slice(0, 3).join(", ")}`,
          card: ex.content,
        })),
      };
    
      if (host && host !== "generic") {
        const hostInfo = getHostSupport(host);
        references.hostConstraints = {
          maxVersion: hostInfo.maxVersion,
          unsupportedElements: hostInfo.unsupportedElements,
          maxActions: hostInfo.maxActions,
          notes: hostInfo.notes,
        };
      }
    
      return {
        card,
        validation,
        designNotes,
        references,
      };
    }
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the return value ('cardId for reference in subsequent tool calls'), which is useful, but lacks details on error handling, rate limits, authentication needs, or side effects. The description does not contradict any 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?

The description is front-loaded with the core purpose in the first sentence, followed by a concise second sentence about the return value. Every sentence earns its place with no wasted words, making it highly efficient.

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 complexity (6 parameters, 100% schema coverage, no output schema), the description is mostly complete. It explains the tool's purpose and return value, but could benefit from more behavioral context (e.g., error cases, performance) since annotations are absent and there's no output schema.

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 implying that 'content' can be natural language or raw data, which is partially covered in the schema. Baseline 3 is appropriate when the 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 tool's purpose with specific verbs ('convert', 'generate') and resources ('Adaptive Card v1.6 JSON'), and distinguishes it from siblings by focusing on generation from mixed content rather than validation, optimization, or templating.

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 provides clear context for when to use this tool ('convert any content — natural language description, structured data, or a combination'), but does not explicitly state when not to use it or name alternatives among the sibling tools.

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