Skip to main content
Glama

template_create

Create reusable task templates with variable placeholders to standardize workflows in project management systems.

Instructions

Create a reusable task template. Templates define a set of tasks that can be instantiated into any epic. Use {variable} placeholders for dynamic values.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesTemplate name (must be unique)
descriptionNoTemplate description
tasksYesTask definitions. Use {variable} for placeholders.

Implementation Reference

  • The handler function `handleTemplateCreate` performs the insertion of a new template into the database.
    function handleTemplateCreate(args: Record<string, unknown>) {
      const db = getDb();
      const name = args.name as string;
      const description = (args.description as string) ?? null;
      const tasks = args.tasks as Array<Record<string, unknown>>;
    
      const templateData = JSON.stringify(tasks);
    
      const template = db
        .prepare('INSERT INTO templates (name, description, template_data) VALUES (?, ?, ?) RETURNING *')
        .get(name, description, templateData);
    
      const row = template as Record<string, unknown>;
      logActivity(db, 'template', row.id as number, 'created', null, null, null,
        `Template '${name}' created with ${tasks.length} task(s)`);
    
      return { ...row, tasks };
    }
  • Input schema definition for the `template_create` tool.
    {
      name: 'template_create',
      description:
        'Create a reusable task template. Templates define a set of tasks that can be instantiated into any epic. Use {variable} placeholders for dynamic values.',
      annotations: { title: 'Create Template', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
      inputSchema: {
        type: 'object',
        properties: {
          name: { type: 'string', description: 'Template name (must be unique)' },
          description: { type: 'string', description: 'Template description' },
          tasks: {
            type: 'array',
            description: 'Task definitions. Use {variable} for placeholders.',
            items: {
              type: 'object',
              properties: {
                title: { type: 'string', description: 'Task title (supports {variable} placeholders)' },
                description: { type: 'string', description: 'Task description (supports {variable} placeholders)' },
                priority: { type: 'string', enum: ['low', 'medium', 'high', 'critical'], default: 'medium' },
                estimated_hours: { type: 'number' },
                tags: { type: 'array', items: { type: 'string' } },
              },
              required: ['title'],
            },
          },
        },
        required: ['name', 'tasks'],
      },
    },
  • Registration of the `template_create` handler in the `handlers` object.
    export const handlers: Record<string, ToolHandler> = {
      template_create: handleTemplateCreate,
      template_list: handleTemplateList,
      template_apply: handleTemplateApply,
      template_delete: handleTemplateDelete,
    };

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/spranab/saga-mcp'

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