Skip to main content
Glama

card_workflow

Execute multi-step Adaptive Cards pipelines for Microsoft and third-party platforms. Process includes generation, validation, optimization, templating, and transformation in a single call.

Instructions

Execute a multi-step card pipeline in a single call. Steps: generate, validate, optimize, template, transform.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stepsYesPipeline steps to execute in order
contentNoContent for generate step
dataNoData for generate/data_to_card step
hostNo
versionNo

Implementation Reference

  • The `handleCardWorkflow` function implements the logic for executing a series of card-related steps (generate, validate, optimize, template, transform).
    async function handleCardWorkflow(
      input: CardWorkflowInput,
    ): Promise<Record<string, unknown>> {
      const { steps, content, data, host = "generic", version = "1.6" } = input;
    
      // Validate step order: steps that need a card must come after generate
      const cardProducers = new Set(["generate"]);
      const cardConsumers = new Set(["validate", "optimize", "template", "transform"]);
      let hasCardProducer = false;
      for (const step of steps) {
        if (cardConsumers.has(step.tool) && !hasCardProducer) {
          throw new Error(
            `Step "${step.tool}" requires a card, but no "generate" step precedes it. ` +
            `Reorder steps so "generate" comes first.`,
          );
        }
        if (cardProducers.has(step.tool)) hasCardProducer = true;
      }
    
      let card: Record<string, unknown> | undefined;
      let validation;
      const stepsCompleted: string[] = [];
      let designNotes = "";
    
      for (const step of steps) {
        const params = step.params || {};
    
        switch (step.tool) {
          case "generate": {
            const genResult = await handleGenerateCard({
              content: (params.content as string) || content || "Create a card",
              data: (params.data || data) as Record<string, unknown> | string | undefined,
              host: (params.host as HostApp) || host as HostApp,
              intent: params.intent as any,
              version: (params.version as string) || version,
            });
            card = genResult.card;
            validation = genResult.validation;
            designNotes = genResult.designNotes;
            stepsCompleted.push("generate");
            break;
          }
          case "validate": {
            if (!card) throw new Error("No card to validate. Run 'generate' step first.");
            validation = handleValidateCard({
              card,
              host: (params.host as HostApp) || host as HostApp,
              strictMode: params.strictMode as boolean,
            });
            stepsCompleted.push("validate");
            break;
          }
          case "optimize": {
            if (!card) throw new Error("No card to optimize. Run 'generate' step first.");
            const optResult = handleOptimizeCard({
              card,
              goals: params.goals as any,
              host: (params.host as HostApp) || host as HostApp,
            });
            card = optResult.card;
            stepsCompleted.push("optimize");
            break;
          }
          case "template": {
            if (!card) throw new Error("No card to templatize. Run 'generate' step first.");
            const tplResult = handleTemplateCard({
              card,
              dataShape: params.dataShape as any,
            });
            card = tplResult.template;
            stepsCompleted.push("template");
            break;
          }
          case "transform": {
            if (!card) throw new Error("No card to transform. Run 'generate' step first.");
            const txResult = handleTransformCard({
              card,
              transform: (params.transform as any) || "apply-host-config",
              targetVersion: params.targetVersion as string,
              targetHost: (params.targetHost as HostApp) || host as HostApp,
            });
            card = txResult.card;
            stepsCompleted.push("transform");
            break;
          }
        }
      }
    
      if (!card) throw new Error("Workflow produced no card. Include a 'generate' step.");
    
      // Re-validate against the final card state (not an intermediate step)
      const lastStep = stepsCompleted[stepsCompleted.length - 1];
      if (lastStep !== "validate") {
        validation = handleValidateCard({ card, host: host as HostApp });
      }
    
      const cardId = storeCard(card, { tool: "card_workflow" });
    
      return {
        card,
        cardId,
        validation,
  • The `CardWorkflowInput` interface defines the input structure for the `card_workflow` tool, including the ordered steps to be executed.
    export interface CardWorkflowInput {
      steps: Array<{
        tool: "generate" | "validate" | "optimize" | "template" | "transform";
        params?: Record<string, unknown>;
      }>;
      content?: string;
      data?: Record<string, unknown> | string;
      host?: HostApp;
      version?: string;
    }
  • Registration of the `card_workflow` tool within the server request handler.
    case "card_workflow": {
      result = await handleCardWorkflow(parsed as unknown as CardWorkflowInput);
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions the tool executes steps in order but doesn't disclose error handling, performance characteristics, side effects, or what the output looks like. For a multi-step pipeline tool with no annotations, this is insufficient.

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?

Extremely concise and front-loaded: a single sentence clearly states the purpose and lists all steps. Every word earns its place with zero waste.

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 complex multi-step pipeline tool with 5 parameters, no annotations, and no output schema, the description is inadequate. It lacks details on behavior, error handling, output format, and usage context, leaving significant gaps for an agent.

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 60%, and the description adds minimal param semantics beyond listing step names. It doesn't explain the purpose of parameters like content, data, host, or version, nor how they interact with steps. Baseline 3 is appropriate given moderate schema coverage.

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 executes a multi-step card pipeline with specific steps listed (generate, validate, optimize, template, transform). It distinguishes from siblings by offering a bundled workflow rather than individual step tools, though it doesn't explicitly contrast with each sibling.

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?

No guidance on when to use this tool versus the individual step tools (like generate_card, validate_card, etc.). The description implies it's for executing multiple steps together, but doesn't specify scenarios where this is preferred or prerequisites.

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