Skip to main content
Glama
martin-1103
by martin-1103

get_folder_details

Retrieve comprehensive information about a specific folder using its unique identifier to access metadata and structural details for API management workflows.

Instructions

Get detailed information about a specific folder

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
folderIdYesFolder ID to get details for

Implementation Reference

  • The core handler function that executes the get_folder_details tool. It validates the folderId input, fetches details using FolderService, formats the response as formatted text, and handles errors.
    export async function handleGetFolderDetails(args: any): Promise<McpToolResponse> {
      try {
        const { folderId } = args;
    
        if (!folderId) {
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify({
                  success: false,
                  error: 'Folder ID is required'
                }, null, 2)
              }
            ]
          };
        }
    
        const instances = await getInstances();
    
        // Create folder service
        const folderService = new FolderService(
          instances.backendClient.getBaseUrl(),
          instances.backendClient.getToken()
        );
    
        // Get folder details
        const response = await folderService.getFolderDetails(folderId);
    
        if (!response.success) {
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify({
                  success: false,
                  error: response.error || 'Failed to get folder details'
                }, null, 2)
              }
            ]
          };
        }
    
        const folder = response.data;
    
        // Format response
        let folderText = `📁 Folder Details:\n\n`;
        folderText += `Name: ${folder.name}\n`;
        folderText += `ID: ${folder.id}\n`;
    
        if (folder.description) {
          folderText += `Description: ${folder.description}\n`;
        }
    
        if (folder.project_id) {
          folderText += `Project ID: ${folder.project_id}\n`;
        }
    
        if (folder.folder_id) {
          folderText += `Parent Folder ID: ${folder.folder_id}\n`;
        }
    
        if (folder.endpoint_count !== undefined) {
          folderText += `Endpoint Count: ${folder.endpoint_count}\n`;
        }
    
        if (folder.created_at) {
          folderText += `Created: ${new Date(folder.created_at).toLocaleString()}\n`;
        }
    
        if (folder.updated_at) {
          folderText += `Updated: ${new Date(folder.updated_at).toLocaleString()}\n`;
        }
    
        return {
          content: [
            {
              type: 'text',
              text: folderText
            }
          ]
        };
    
      } catch (error: any) {
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                success: false,
                error: error.message || 'Unknown error occurred while getting folder details'
              }, null, 2)
            }
          ]
        };
      }
    }
  • The MCP tool schema definition for get_folder_details, specifying input validation (requires folderId string) and linking to the handler.
    export const getFolderDetailsTool: McpTool = {
      name: 'get_folder_details',
      description: 'Get detailed information about a specific folder',
      inputSchema: {
        type: 'object',
        properties: {
          folderId: {
            type: 'string',
            description: 'Folder ID to get details for'
          }
        },
        required: ['folderId']
      },
      handler: handleGetFolderDetails
    };
  • Registration of the get_folder_details handler in the main tool handlers factory (createFolderToolHandlers), using dynamic import for lazy loading.
    'get_folder_details': async (args: any) => {
      const { handleGetFolderDetails } = await import('./folders/handlers/folderHandlers.js');
      return handleGetFolderDetails(args);
    }
  • Registration of getFolderDetailsTool within the folderTools array, which is exported and included in the main ALL_TOOLS list.
    export const folderTools = [
      listFoldersTool,
      createFolderTool,
      updateFolderTool,
      deleteFolderTool,
      getFolderDetailsTool

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/martin-1103/mcp2'

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