Skip to main content
Glama

create_badge

Create custom digital badge templates with branding and optional fields for issuing certificates to recipients.

Instructions

Create a new badge template with optional custom fields and branding. This badge can then be issued to recipients.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesBadge name (e.g., "Web Development Certificate")
descriptionYesBadge description (e.g., "Awarded for completing the full-stack web development course")
issuing_organization_nameYesName of the issuing organization (e.g., "Tech Academy")
idempotency_keyYesUnique key to prevent duplicate badge creation (e.g., "badge_webdev_2024_001")
nicknameNoOptional badge nickname or short name
left_panel_descriptionNoAdditional description for the left panel of the certificate
organization_idNoExisting organization ID (optional, will create new organization if not provided)
commentNoAdditional comments or notes about the badge
expire_dateNoBadge expiration date in YYYY-MM-DD format (optional)
badge_logo_pathNoPath to badge logo file (jpeg,png,jpg,gif,svg, max 2MB)
custom_fieldsNoCustom fields for this badge (e.g., completion date, score, instructor)

Implementation Reference

  • Core handler function that implements the badge creation logic: sends POST to '/badge/create' API endpoint, handles optional file upload for badge logo using FormData, or plain JSON payload.
    async createBadge(data: z.infer<typeof CreateBadgeSchema>): Promise<CreatedBadge> {
      const { badge_logo_path, ...badgeData } = data;
      
      if (badge_logo_path) {
        // Handle file upload
        const formData = new FormData();
        
        // Add file
        try {
          const fileBuffer = readFileSync(badge_logo_path);
          const fileName = badge_logo_path.split('/').pop() || 'badge_logo.png';
          formData.append('badge_logo', fileBuffer, {
            filename: fileName,
          });
        } catch (error) {
          throw new Error(`Failed to read badge logo file: ${error}`);
        }
        
        // Add other fields
        Object.entries(badgeData).forEach(([key, value]) => {
          if (value !== undefined) {
            if (key === 'custom_fields') {
              formData.append(key, JSON.stringify(value));
            } else {
              formData.append(key, String(value));
            }
          }
        });
    
        const response = await this.client.post('/badge/create', formData, {
          headers: {
            ...formData.getHeaders(),
          },
        });
        return response.data;
      } else {
        // JSON request without file
        const response = await this.client.post('/badge/create', badgeData);
        return response.data;
      }
    }
  • src/index.ts:313-388 (registration)
    MCP tool registration defining the 'create_badge' tool with name, description, and detailed JSON schema for input validation.
    {
      name: 'create_badge',
      description: 'Create a new badge template with optional custom fields and branding. This badge can then be issued to recipients.',
      inputSchema: {
        type: 'object',
        properties: {
          name: {
            type: 'string',
            description: 'Badge name (e.g., "Web Development Certificate")',
          },
          description: {
            type: 'string',
            description: 'Badge description (e.g., "Awarded for completing the full-stack web development course")',
          },
          issuing_organization_name: {
            type: 'string',
            description: 'Name of the issuing organization (e.g., "Tech Academy")',
          },
          idempotency_key: {
            type: 'string',
            description: 'Unique key to prevent duplicate badge creation (e.g., "badge_webdev_2024_001")',
          },
          nickname: {
            type: 'string',
            description: 'Optional badge nickname or short name',
          },
          left_panel_description: {
            type: 'string',
            description: 'Additional description for the left panel of the certificate',
          },
          organization_id: {
            type: 'string',
            description: 'Existing organization ID (optional, will create new organization if not provided)',
          },
          comment: {
            type: 'string',
            description: 'Additional comments or notes about the badge',
          },
          expire_date: {
            type: 'string',
            pattern: '^\\d{4}-\\d{2}-\\d{2}$',
            description: 'Badge expiration date in YYYY-MM-DD format (optional)',
          },
          badge_logo_path: {
            type: 'string',
            description: 'Path to badge logo file (jpeg,png,jpg,gif,svg, max 2MB)',
          },
          custom_fields: {
            type: 'array',
            description: 'Custom fields for this badge (e.g., completion date, score, instructor)',
            items: {
              type: 'object',
              properties: {
                name: {
                  type: 'string',
                  description: 'Field name (e.g., "Completion Date")',
                },
                type: {
                  type: 'string',
                  enum: ['text', 'email', 'number', 'date'],
                  description: 'Field type',
                  default: 'text',
                },
                required: {
                  type: 'boolean',
                  description: 'Whether this field is required when issuing the badge',
                  default: false,
                },
              },
              required: ['name'],
            },
          },
        },
        required: ['name', 'description', 'issuing_organization_name', 'idempotency_key'],
      },
    },
  • Zod validation schema used internally for parsing and validating arguments before calling the createBadge handler.
    const CreateBadgeSchema = z.object({
      name: z.string().describe('Badge name'),
      description: z.string().describe('Badge description'),
      issuing_organization_name: z.string().describe('Name of the issuing organization'),
      idempotency_key: z.string().describe('Unique key to prevent duplicate badge creation'),
      nickname: z.string().optional().describe('Optional badge nickname'),
      left_panel_description: z.string().optional().describe('Additional description for left panel'),
      organization_id: z.string().optional().describe('Existing organization ID'),
      comment: z.string().optional().describe('Additional comments'),
      expire_date: z.string().optional().describe('Badge expiration date (YYYY-MM-DD)'),
      badge_logo_path: z.string().optional().describe('Path to badge logo file'),
      custom_fields: z.array(z.object({
        name: z.string().describe('Field name'),
        type: z.enum(['text', 'email', 'number', 'date']).default('text').describe('Field type'),
        required: z.boolean().default(false).describe('Whether field is required'),
      })).optional().describe('Custom fields for this badge'),
    });
  • MCP server request handler switch case for 'create_badge': parses args with schema, invokes apiClient.createBadge, and returns formatted response content.
    case 'create_badge': {
      const validatedArgs = CreateBadgeSchema.parse(args);
      const result = await apiClient.createBadge(validatedArgs);
      
      if (result.success) {
        return {
          content: [
            {
              type: 'text',
              text: `✨ Badge Created Successfully!\n\n🏷️ Badge Name: ${validatedArgs.name}\n🆔 Badge ID: ${result.badgeId}\n🏢 Organization ID: ${result.organizationId}\n\nYou can now issue this badge to recipients using the badge ID.\n\n${JSON.stringify(result, null, 2)}`,
            },
          ],
        };
      }
      
      return {
        content: [
          {
            type: 'text',
            text: `🎨 Badge Creation Result:\n\n${JSON.stringify(result, null, 2)}`,
          },
        ],
      };
    }
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. It mentions the tool creates a badge template with optional fields, but lacks critical behavioral details such as required permissions, whether creation is idempotent (hinted by idempotency_key but not explained), rate limits, or what happens on failure. The description does not contradict annotations since none exist.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose in the first sentence, and the second sentence adds useful context about subsequent issuance. It is appropriately sized with two sentences and no redundant information, though it could be slightly more structured for clarity.

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 (11 parameters, no annotations, no output schema), the description is incomplete. It lacks details on behavioral traits like permissions or error handling, does not explain the return value or what happens after creation, and relies heavily on the schema for parameter documentation without compensating for missing contextual information.

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 11 parameters thoroughly. The description adds minimal value by mentioning 'optional custom fields and branding,' which loosely maps to custom_fields and badge_logo_path, but does not provide additional syntax, format, or usage details beyond what the schema provides.

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?

The description clearly states the action ('Create a new badge template') and the resource ('badge'), specifying it includes optional custom fields and branding. It distinguishes from siblings by focusing on template creation rather than retrieval (get_all_badges), issuance (issue_badge), or validation (validate_key).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage by mentioning the badge can be issued to recipients afterward, which suggests a workflow context. However, it does not explicitly state when to use this tool versus alternatives like issue_badge or get_all_badges, nor does it mention prerequisites or exclusions.

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/issuebadge/mcp-server'

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