Skip to main content
Glama

list_teams

Retrieve a list of teams for the authenticated user in Webex, with optional control over the number of teams returned using the max parameter.

Instructions

List teams for the authenticated user in Webex.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
maxNoThe maximum number of teams to return.

Implementation Reference

  • The main handler function executeFunction that lists teams by making a GET request to the Webex /teams API endpoint with optional max parameter.
    const executeFunction = async ({ max = 100 }) => {
    
      try {
        // Construct the URL with query parameters
        const url = new URL(getWebexUrl('/teams'));
        url.searchParams.append('max', max.toString());
    
        // 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(JSON.stringify(errorData));
        }
    
        // Parse and return the response data
        const data = await response.json();
        return data;
      } catch (error) {
        console.error('Error listing teams:', error);
        return { error: 'An error occurred while listing teams.' };
      }
    };
  • The apiTool export containing the schema definition (parameters) and reference to the handler function for the list_teams tool.
    const apiTool = {
      function: executeFunction,
      definition: {
        type: 'function',
        function: {
          name: 'list_teams',
          description: 'List teams for the authenticated user in Webex.',
          parameters: {
            type: 'object',
            properties: {
              max: {
                type: 'integer',
                description: 'The maximum number of teams to return.'
              }
            },
            required: []
          }
        }
      }
    };
  • mcpServer.js:87-138 (registration)
    The registration loop in createMcpServer that iterates over discovered tools and calls server.registerTool for each, using the tool name from the schema.
    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);
      }
    }
  • lib/tools.js:7-16 (registration)
    The discoverTools function that loads all tool modules dynamically from toolPaths and returns an array of apiTool objects for registration.
    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);
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but only states it lists teams without disclosing behavioral traits like pagination, rate limits, authentication requirements, or response format. This leaves significant gaps for a tool that likely returns a list of data.

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

Conciseness5/5

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

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is appropriately sized and front-loaded, making it easy to parse quickly.

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 no annotations, no output schema, and a simple parameter, the description is incomplete. It lacks details on behavioral aspects like response structure, error handling, or usage context, which are essential for effective tool invocation by an AI agent.

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 input schema fully documents the 'max' parameter. The description adds no additional parameter semantics beyond what the schema provides, resulting in a baseline score of 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('List') and resource ('teams for the authenticated user in Webex'), making the purpose evident. However, it does not differentiate from sibling tools like 'list_team_memberships' or 'get_team_details', which could cause confusion in selection.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives such as 'list_team_memberships' or 'get_team_details'. The description lacks context about prerequisites or exclusions, leaving the agent to infer usage based on tool names alone.

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

Related 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/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