Skip to main content
Glama

list-devices

Retrieve a list of connected ESP8266/NodeMCU IoT devices from the NodeMCU MCP Service for streamlined device management and monitoring.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Primary handler for 'list-devices' tool using official MCP SDK. Registers the tool, defines empty schema, and implements logic to list devices via DeviceManager.getAllDevices()
    server.tool( "list-devices", {}, // No parameters required async () => { try { const devices = deviceManager.getAllDevices(); return { content: [{ type: "text", text: JSON.stringify({ devices: devices.map(device => ({ id: device.id, name: device.name, status: device.status, lastSeen: device.lastSeen })), count: devices.length }, null, 2) }] }; } catch (error) { console.error('Error listing devices:', error); throw new Error(`Failed to list devices: ${error.message}`); } } );
  • Handler function listDevices() implementing the core tool logic in the custom MCP server implementation
    async listDevices() { const devices = deviceManager.getAllDevices(); return { devices: devices.map(device => ({ id: device.id, name: device.name, status: device.status, lastSeen: device.lastSeen })), count: devices.length }; }
  • Schema definition for 'list-devices' tool in custom MCP server (no parameters, description provided)
    "list-devices": { description: "List all registered NodeMCU devices and their status", parameters: {} },
  • Supporting helper method getAllDevices() that returns all devices from the internal devices Map, called by both tool handlers
    getAllDevices() { return Array.from(this.devices.values()); }
  • Tool registration call in MCP SDK with name and schema
    server.tool( "list-devices", {}, // No parameters required

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/amanasmuei/nodemcu-mcp'

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