Skip to main content
Glama
ogbm77

Cisco CX Cloud MCP Server

by ogbm77

get_network_elements

Retrieve network device inventory and details for a specific customer to manage hardware assets and monitor network infrastructure.

Instructions

Get network elements inventory for a specific customer. Returns network devices and their details.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
customerIdYesThe customer ID

Implementation Reference

  • The handler function for the 'get_network_elements' tool. It extracts the customerId from arguments, validates it, calls the API endpoint '/inventory/network-elements' using makeApiCall, and returns the JSON response as text content.
    case "get_network_elements": {
      const customerId = args?.customerId as string;
      if (!customerId) {
        throw new Error("customerId is required");
      }
      const data = await makeApiCall("/inventory/network-elements", customerId);
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(data, null, 2),
          },
        ],
      };
    }
  • The tool definition including name, description, and input schema for 'get_network_elements'. Specifies that customerId is a required string input.
    {
      name: "get_network_elements",
      description: "Get network elements inventory for a specific customer. Returns network devices and their details.",
      inputSchema: {
        type: "object",
        properties: {
          customerId: {
            type: "string",
            description: "The customer ID",
          },
        },
        required: ["customerId"],
      },
  • src/index.ts:223-228 (registration)
    Registration of all tools via the ListToolsRequestSchema handler, which returns the tools array containing 'get_network_elements'.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      logger.debug('ListTools request received');
      return {
        tools,
      };
    });
  • Shared helper function makeApiCall used by the get_network_elements handler to make authenticated GET requests to the Cisco CX Cloud API.
    async function makeApiCall(endpoint: string, customerId?: string): Promise<any> {
      const token = await authClient.getAccessToken();
    
      let url = `${CX_CLOUD_BASE_URL}${endpoint}`;
      if (customerId) {
        url += `${endpoint.includes('?') ? '&' : '?'}customerId=${customerId}`;
      }
    
      logger.debug(`Making API call to: ${url}`);
    
      try {
        logger.apiRequest('GET', url, {
          Authorization: 'Bearer ***',
        });
    
        const startTime = Date.now();
        const response = await axios.get(url, {
          headers: {
            Authorization: `Bearer ${token}`,
          },
        });
        const duration = Date.now() - startTime;
    
        logger.apiResponse('GET', url, response.status, response.data);
        logger.debug(`API call completed in ${duration}ms`);
    
        return response.data;
      } catch (error) {
        logger.apiError('GET', url, error);
        if (axios.isAxiosError(error)) {
          throw new Error(
            `API call failed: ${error.response?.status} - ${error.response?.data?.message || error.message}`
          );
        }
        throw 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/ogbm77/cisco-cx-cloud-mcp'

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