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;
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'validate + optionally optimize' but doesn't detail what validation entails (e.g., schema checks, error handling) or optimization specifics (e.g., how goals affect output). For a tool with 6 parameters and no annotations, this leaves significant gaps in understanding its behavior and constraints.

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 highly concise and front-loaded: two sentences that directly state the tool's purpose and benefit. Every word earns its place, with no redundancy or unnecessary details, making it easy to understand quickly.

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 (6 parameters, no output schema, no annotations), the description is incomplete. It doesn't explain what the tool returns (e.g., validated/optimized card JSON, errors), how validation or optimization work, or any behavioral traits like error handling or performance. For a multi-function tool, this leaves too much unspecified.

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 minimal value beyond the schema, only implying that 'content' is for generation and 'optimizeGoals' triggers optimization. It doesn't provide additional meaning or usage context for parameters beyond what's in the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/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: 'Generate an Adaptive Card and immediately validate + optionally optimize it in a single call.' It specifies the verb (generate, validate, optimize) and resource (Adaptive Card). However, it doesn't explicitly differentiate from sibling tools like 'generate_card', 'validate_card', or 'optimize_card', which offer similar functionality separately.

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: 'Reduces tool-call overhead for common workflows.' This implies it should be used when combining generation, validation, and optimization into one step for efficiency. It doesn't explicitly state when not to use it or name alternatives, but the context is sufficient for informed usage.

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