Skip to main content
Glama

frame

Draw a decorative box around text with selectable border styles, padding, alignment, and an optional title. Supports single, double, rounded, bold, and ASCII borders.

Instructions

Draw a box/frame around text. Styles: single, double, rounded, bold, ascii.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesText to frame (supports multi-line)
styleNoBorder stylesingle
paddingNoInner padding (spaces)
alignNoText alignmentleft
titleNoOptional title in the top border

Implementation Reference

  • The core handler function 'frame' that takes text and options (style, padding, align, title) and renders a bordered box around the text. It builds the top border (with optional title), pads and aligns each line, and outputs the bottom border.
    export function frame(text: string, options: FrameOptions = {}): string {
      const { style = 'single', padding = 1, align = 'left', title } = options;
      const b = BORDERS[style];
      const lines = text.split('\n');
      const contentWidth = Math.max(
        ...lines.map((l) => l.length),
        title ? title.length + 2 : 0,
      );
      const innerWidth = contentWidth + padding * 2;
    
      const hBar = b.h.repeat(innerWidth);
      const topBar = title
        ? b.h + ` ${title} ` + b.h.repeat(Math.max(0, innerWidth - title.length - 3))
        : hBar;
    
      const out: string[] = [];
      out.push(b.tl + topBar + b.tr);
    
      for (const line of lines) {
        const padded = pad(line, contentWidth, align);
        out.push(b.v + ' '.repeat(padding) + padded + ' '.repeat(padding) + b.v);
      }
    
      out.push(b.bl + hBar + b.br);
      return out.join('\n');
    }
  • The FrameOptions interface defining the input schema for the frame function: style (5 border styles), padding, alignment, and optional title.
    export interface FrameOptions {
      style?: FrameStyle;
      padding?: number;
      align?: Alignment;
      title?: string;
    }
  • Type definitions: FrameStyle union type and FRAME_STYLES array listing the 5 border styles (single, double, rounded, bold, ascii).
    export type FrameStyle = 'single' | 'double' | 'rounded' | 'bold' | 'ascii';
    
    const BORDERS: Record<FrameStyle, { tl: string; tr: string; bl: string; br: string; h: string; v: string }> = {
      single:  { tl: '┌', tr: '┐', bl: '└', br: '┘', h: '─', v: '│' },
      double:  { tl: '╔', tr: '╗', bl: '╚', br: '╝', h: '═', v: '║' },
      rounded: { tl: '╭', tr: '╮', bl: '╰', br: '╯', h: '─', v: '│' },
      bold:    { tl: '┏', tr: '┓', bl: '┗', br: '┛', h: '━', v: '┃' },
      ascii:   { tl: '+', tr: '+', bl: '+', br: '+', h: '-', v: '|' },
    };
    
    export const FRAME_STYLES: FrameStyle[] = ['single', 'double', 'rounded', 'bold', 'ascii'];
    
    export type Alignment = 'left' | 'center' | 'right';
  • src/mcp.ts:162-176 (registration)
    Tool registration in MCP server via server.tool('frame', ...) with Zod schema validation for text, style, padding, align, and title parameters. The handler calls the imported 'frame' function from frame.ts.
    server.tool(
      'frame',
      `Draw a box/frame around text. Styles: ${FRAME_STYLES.join(', ')}.`,
      {
        text: z.string().max(2000).describe('Text to frame (supports multi-line)'),
        style: z.enum(FRAME_STYLES as [string, ...string[]]).default('single').describe('Border style'),
        padding: z.number().min(0).max(10).default(1).describe('Inner padding (spaces)'),
        align: z.enum(['left', 'center', 'right']).default('left').describe('Text alignment'),
        title: z.string().max(50).optional().describe('Optional title in the top border'),
      },
      async ({ text, style, padding, align, title }) => {
        const result = frame(text, { style: style as any, padding, align: align as any, title });
        return { content: [{ type: 'text', text: result }] };
      }
    );
  • Helper function 'pad' used internally to handle left/center/right text alignment within the frame's content area.
    function pad(text: string, width: number, align: Alignment): string {
      const gap = width - text.length;
      if (gap <= 0) return text;
      if (align === 'center') {
        const left = Math.floor(gap / 2);
        return ' '.repeat(left) + text + ' '.repeat(gap - left);
      }
      if (align === 'right') return ' '.repeat(gap) + text;
      return text + ' '.repeat(gap);
    }
Behavior2/5

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

No annotations are provided, and the description only states the basic action without disclosing side effects, performance characteristics, or limitations beyond what the schema already indicates.

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, front-loaded sentence that efficiently conveys the core functionality without any wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

While the tool is simple and the schema covers parameters well, there is no output schema and the description does not describe the return format or any additional behavior, leaving some ambiguity for the 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 100%, so the schema already explains each parameter. The description adds minimal value by listing styles again, but does not provide additional detail beyond the schema.

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?

Description clearly states 'Draw a box/frame around text' which is a specific verb+resource, and lists available styles, distinguishing it from sibling tools like 'banner' or 'chart'.

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 alternatives, nor when not to use it. Implied by the description but no explicit context or exclusions provided.

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/rxolve/artscii'

If you have feedback or need assistance with the MCP directory API, please join our Discord server