Skip to main content
Glama

generate_and_validate

Generate Adaptive Cards from natural language descriptions and validate them for compatibility with Microsoft Teams, Outlook, and other platforms in one step.

Instructions

Generate an Adaptive Card and immediately validate + optionally optimize it in a single call. Reduces tool-call overhead for common workflows.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYesNatural language description of the card to generate
dataNoOptional structured data to incorporate
hostNoTarget host app
intentNoCard intent
versionNoTarget version. Default: 1.6
optimizeGoalsNoIf provided, also optimize the card after generation

Implementation Reference

  • The core handler function for the 'generate_and_validate' tool, orchestrating card generation, validation, optimization, and version transformation.
    async function handleGenerateAndValidate(
      input: GenerateAndValidateInput,
    ): Promise<Record<string, unknown>> {
      const { content, data, host = "generic", intent, version = "1.6", optimizeGoals } = input;
    
      // Step 1: Generate
      const genResult = await handleGenerateCard({
        content,
        data,
        host: host as HostApp,
        intent: intent as any,
        version,
      });
    
      let card = genResult.card;
      let validation = genResult.validation;
      let designNotes = genResult.designNotes;
      const stepsCompleted = ["generate", "validate"];
    
      // Step 2: Optimize if requested
      if (optimizeGoals && optimizeGoals.length > 0) {
        const optResult = handleOptimizeCard({
          card,
          goals: optimizeGoals,
          host: host as HostApp,
        });
        card = optResult.card;
        designNotes += ` | Optimized for: ${optimizeGoals.join(", ")}`;
        stepsCompleted.push("optimize");
      }
    
      // Step 3: Auto-downgrade version if host requires it
      if (host !== "generic") {
        const hostInfo = getHostSupport(host as HostApp);
        const cardVersion = String(card.version || "1.6");
        if (hostInfo && cardVersion > hostInfo.maxVersion) {
          const txResult = handleTransformCard({
            card,
            transform: "downgrade-version",
            targetVersion: hostInfo.maxVersion,
          });
          card = txResult.card;
          stepsCompleted.push("transform");
        }
      }
    
      // Re-validate after all modifications
      validation = handleValidateCard({ card, host: host as HostApp });
    
      const cardId = storeCard(card, { tool: "generate_and_validate" });
  • Registration of the 'generate_and_validate' tool definition in the server.
    name: "generate_and_validate",
    description:
      "Generate an Adaptive Card and immediately validate + optionally optimize it in a single call. Reduces tool-call overhead for common workflows.",
  • Type definition for the input schema of the 'generate_and_validate' tool.
    export interface GenerateAndValidateInput {
      content: string;
      data?: Record<string, unknown> | string;
      host?: HostApp;
      intent?: CardIntent;
      version?: string;

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