Skip to main content
Glama

suggest_layout

Recommends optimal Adaptive Card layouts based on your content description, target platform, and interactivity needs to build effective cards.

Instructions

Recommend the best Adaptive Card layout pattern for a given description.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionYesDescribe the card you want to build
constraintsNo

Implementation Reference

  • The handler function 'handleSuggestLayout' which takes the description and constraints input, computes a scored pattern, builds a layout description, generates a rationale, and returns the best pattern along with alternatives.
    export function handleSuggestLayout(input: SuggestLayoutInput): SuggestLayoutOutput {
      const { description, constraints } = input;
    
      const scored = scorePatterns(description);
    
      if (scored.length === 0 || scored[0].score === 0) {
        // No strong match — return a generic suggestion
        return {
          suggestion: {
            pattern: "notification",
            elements: ["TextBlock", "ActionSet"],
            layout: "Simple vertical layout with a title, body text, and optional actions. Best for general-purpose content.",
            rationale:
              "No specific layout pattern strongly matched your description. The notification pattern is the most versatile starting point. Refine your description with keywords like 'table', 'form', 'dashboard', 'approval', 'list', 'profile', 'chart', or 'gallery' for more targeted suggestions.",
          },
          alternatives: buildAlternatives(scored.slice(0, 3), constraints),
        };
      }
    
      const best = scored[0];
      const pattern = best.pattern;
    
      // Check host compatibility if specified
      let hostWarning = "";
      if (constraints?.targetHost) {
        const support = getHostSupport(constraints.targetHost);
        const unsupportedInPattern = pattern.elements.filter((el) =>
          support.unsupportedElements.includes(el),
        );
        if (unsupportedInPattern.length > 0) {
          hostWarning = ` Note: ${unsupportedInPattern.join(", ")} not supported on ${constraints.targetHost}. Alternative elements will be needed.`;
        }
      }
    
      // Build layout description
      const layout = buildLayoutDescription(pattern.name, pattern.elements, pattern.dataShape);
    
      // Build rationale
      const rationale = buildRationale(pattern, description, constraints) + hostWarning;
    
      const suggestion: LayoutSuggestion = {
        pattern: pattern.name,
        elements: pattern.elements,
        layout,
        rationale,
        similarExample: pattern.example,
      };
    
      // Build alternatives from the next best matches (excluding the top pick)
      const altCandidates = scored
        .slice(1)
        .filter((s) => s.score > 0)
        .slice(0, 3);
    
      const alternatives = buildAlternatives(altCandidates, constraints);
    
      return { suggestion, alternatives };
    }
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 states the tool 'recommends' layouts, implying a read-only or advisory operation, but doesn't clarify if it's a simple suggestion, requires authentication, has rate limits, or what the output format might be. For a tool with no annotations, 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, clear sentence that efficiently conveys the core purpose without unnecessary words. It's front-loaded and wastes no space, making it easy to understand at a glance.

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 complexity (2 parameters with nested objects, no output schema, and no annotations), the description is insufficient. It doesn't explain what a 'layout pattern' entails, how recommendations are generated, or what the output looks like. With no output schema and incomplete parameter documentation, more context is needed for effective use.

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?

The description mentions 'a given description,' which aligns with the 'description' parameter in the schema, but doesn't add meaning beyond what the schema provides. With 50% schema description coverage (only 'description' parameter is documented, 'constraints' is not), the description doesn't compensate for the undocumented 'constraints' parameter or explain how constraints affect recommendations. This meets the baseline for partial 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's purpose: 'Recommend the best Adaptive Card layout pattern for a given description.' It specifies the verb ('Recommend') and resource ('Adaptive Card layout pattern'), making the intent unambiguous. However, it doesn't explicitly differentiate this from sibling tools like 'generate_card' or 'template_card', which might also involve layout recommendations, so it falls short of a perfect score.

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?

The description provides no guidance on when to use this tool versus alternatives. With sibling tools such as 'generate_card', 'template_card', and 'optimize_card', it's unclear if this is for initial layout suggestions, template-based generation, or post-creation optimization. There's no mention of prerequisites, exclusions, or specific contexts, leaving usage ambiguous.

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