Skip to main content
Glama

list_ecm_folder

Retrieve the ECM folder contents for a specific Webex room by providing the room ID, enabling streamlined access to shared files and resources.

Instructions

List the ECM folder of a specified room in Webex.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
roomIdYesThe ID of the room for which to list the ECM folder.

Implementation Reference

  • Handler function that lists the ECM folder by making a GET request to Webex /room/linkedFolders endpoint with the given roomId.
    const executeFunction = async ({ roomId }) => {
    
      try {
        // Construct the URL with query parameters
        const url = new URL(getWebexUrl('/room/linkedFolders'));
        url.searchParams.append('roomId', roomId);
    
        // Set up headers for the request
        const headers = getWebexHeaders();
    
        // Perform the fetch request
        const response = await fetch(url.toString(), {
          method: 'GET',
          headers
        });
    
        // Check if the response was successful
        if (!response.ok) {
          const errorData = await response.json();
          throw new Error(errorData);
        }
    
        // Parse and return the response data
        const data = await response.json();
        return data;
      } catch (error) {
        console.error('Error listing ECM folder:', error);
        return { error: 'An error occurred while listing the ECM folder.' };
      }
    };
  • Tool schema definition including name 'list_ecm_folder', description, input parameters (roomId: string, required).
    const apiTool = {
      function: executeFunction,
      definition: {
        type: 'function',
        function: {
          name: 'list_ecm_folder',
          description: 'List the ECM folder of a specified room in Webex.',
          parameters: {
            type: 'object',
            properties: {
              roomId: {
                type: 'string',
                description: 'The ID of the room for which to list the ECM folder.'
              }
            },
            required: ['roomId']
          }
        }
      }
    };
  • tools/paths.js:20-20 (registration)
    Path to the list_ecm_folder tool file included in toolPaths array for dynamic discovery.
    'webex-public-workspace/webex-messaging/list-ecm-folder.js',
  • lib/tools.js:7-16 (registration)
    Dynamic tool discovery function that loads apiTool from each path in toolPaths, including list-ecm-folder.js.
    export async function discoverTools() {
      const toolPromises = toolPaths.map(async (file) => {
        const module = await import(`../tools/${file}`);
        return {
          ...module.apiTool,
          path: file,
        };
      });
      return Promise.all(toolPromises);
    }
  • mcpServer.js:87-138 (registration)
    MCP server registration loop that registers each discovered tool (including list_ecm_folder) by calling server.registerTool with name, schema, and wrapper handler.
    for (const tool of tools) {
      const definition = tool.definition?.function;
      if (!definition) {
        console.error(`[MCP Server] Skipping tool with invalid definition:`, tool);
        continue;
      }
    
      try {
        server.registerTool(
          definition.name,
          {
            title: definition.name.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase()),
            description: definition.description,
            // MCP SDK v1.17.4 requires inputSchema with Zod schemas for parameter validation
            inputSchema: convertJsonSchemaToZod(definition.parameters?.properties || {}, definition.parameters?.required || [])
          },
          async (args) => {
            try {
              // Debug logging to see what we actually receive
              console.error(`[DEBUG] Tool ${definition.name} called with args:`, JSON.stringify(args));
              console.error(`[DEBUG] Args type:`, typeof args);
              console.error(`[DEBUG] Args keys:`, Object.keys(args || {}));
    
              // Handle both function and handler patterns
              const toolFunction = tool.function || tool.handler;
              if (!toolFunction) {
                throw new Error(`Tool ${definition.name} has no function or handler`);
              }
    
              const result = await toolFunction(args);
              return {
                content: [{
                  type: 'text',
                  text: JSON.stringify(result, null, 2)
                }]
              };
            } catch (error) {
              console.error(`[MCP Server] Tool ${definition.name} error:`, error);
              return {
                content: [{
                  type: 'text',
                  text: `Error: ${error.message}`
                }],
                isError: true
              };
            }
          }
        );
      } catch (error) {
        console.error(`[MCP Server] Failed to register tool ${definition.name}:`, error);
      }
    }

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/Kashyap-AI-ML-Solutions/webex-messaging-mcp-server'

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