Skip to main content
Glama

create_folder

Create a new folder in a Jira project for organizing test cases, plans, or cycles within Zephyr Scale Cloud.

Instructions

Create a new folder in a project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName of the folder to create
projectKeyYesJira project key where the folder will be created
parentFolderIdNoOptional parent folder ID to create a subfolder
folderTypeNoFolder type (default: TEST_CASE)TEST_CASE

Implementation Reference

  • Main handler function for the 'create_folder' MCP tool. Validates inputs, calls ZephyrClient.createFolder, and returns formatted response.
    async function createFolder(args) {
      try {
        const { name, projectKey, parentFolderId, folderType } = args;
    
        if (!name) {
          throw new Error('folder name is required');
        }
    
        if (!projectKey) {
          throw new Error('projectKey is required');
        }
    
        if (!config.projectKeyPattern.test(projectKey)) {
          throw new Error('Invalid projectKey format. Must match pattern: [A-Z][A-Z_0-9]+');
        }
    
        // Validate folderType against allowed enum values
        const validFolderTypes = ['TEST_CASE', 'TEST_PLAN', 'TEST_CYCLE'];
        const selectedFolderType = folderType || 'TEST_CASE';
    
        if (!validFolderTypes.includes(selectedFolderType)) {
          throw new Error(`folderType must be one of: ${validFolderTypes.join(', ')}`);
        }
    
        const folderData = {
          name,
          projectKey,
          folderType: selectedFolderType
        };
    
        if (parentFolderId) {
          if (!config.folderIdPattern.test(parentFolderId)) {
            throw new Error('Invalid parentFolderId format. Must be a numeric ID.');
          }
          folderData.parentId = parseInt(parentFolderId);
        }
    
        const result = await client.createFolder(folderData);
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                message: 'Folder created successfully',
                folder: result
              }, null, 2)
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: formatError(error, 'creating folder')
            }
          ],
          isError: true
        };
      }
    }
  • Registration object for 'create_folder' tool in folderTools array, including name, description, inputSchema, and handler reference. This array is spread into allTools in index.js for MCP server.
    {
      name: 'create_folder',
      description: 'Create a new folder in a project',
      inputSchema: {
        type: 'object',
        properties: {
          name: {
            type: 'string',
            description: 'Name of the folder to create',
            minLength: 1,
            maxLength: 255
          },
          projectKey: {
            type: 'string',
            description: 'Jira project key where the folder will be created',
            pattern: config.projectKeyPattern.source
          },
          parentFolderId: {
            type: 'string',
            description: 'Optional parent folder ID to create a subfolder',
            pattern: config.folderIdPattern.source
          },
          folderType: {
            type: 'string',
            description: 'Folder type (default: TEST_CASE)',
            enum: ['TEST_CASE', 'TEST_PLAN', 'TEST_CYCLE'],
            default: 'TEST_CASE'
          }
        },
        required: ['name', 'projectKey']
      },
      handler: createFolder
    }
  • Input schema for 'create_folder' tool defining parameters with types, descriptions, constraints (patterns, enums, required).
    inputSchema: {
      type: 'object',
      properties: {
        name: {
          type: 'string',
          description: 'Name of the folder to create',
          minLength: 1,
          maxLength: 255
        },
        projectKey: {
          type: 'string',
          description: 'Jira project key where the folder will be created',
          pattern: config.projectKeyPattern.source
        },
        parentFolderId: {
          type: 'string',
          description: 'Optional parent folder ID to create a subfolder',
          pattern: config.folderIdPattern.source
        },
        folderType: {
          type: 'string',
          description: 'Folder type (default: TEST_CASE)',
          enum: ['TEST_CASE', 'TEST_PLAN', 'TEST_CYCLE'],
          default: 'TEST_CASE'
        }
      },
      required: ['name', 'projectKey']
    },
  • ZephyrClient helper method implementing the API call to create a folder via POST /folders.
    async createFolder(folderData) {
      return this.request('POST', '/folders', folderData);
    }

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/donyfs/mcp-zephyr'

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