fibaro_get_devices
Retrieve all connected smart devices from Fibaro Home Center 3 to manage and control them efficiently through the HC3 MCP Server.
Instructions
Get all devices from Fibaro HC3
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:338-353 (handler)Handler for the fibaro_get_devices tool. Checks connection, fetches all devices via FibaroClient.getDevices(), and returns a formatted text list of devices.case 'fibaro_get_devices': { if (!this.fibaroClient) { throw new Error('Not connected to Fibaro HC3. Please check your configuration and restart the MCP server.'); } const devices = await this.fibaroClient.getDevices(); return { content: [ { type: 'text', text: `Found ${devices.length} devices:\n\n${devices .map(d => `ID: ${d.id} - ${d.name} (${d.type}) - Room: ${d.roomID}`) .join('\n')}`, }, ], }; }
- src/index.ts:112-119 (registration)Registration of the fibaro_get_devices tool in the listTools response, including name, description, and input schema.{ name: 'fibaro_get_devices', description: 'Get all devices from Fibaro HC3', inputSchema: { type: 'object', properties: {}, }, },
- src/fibaro-client.ts:12-20 (schema)Type definition (schema) for Device objects returned by the tool.export interface Device { id: number; name: string; type: string; roomID: number; enabled: boolean; visible: boolean; properties: Record<string, any>; }
- src/fibaro-client.ts:69-76 (helper)Core helper method in FibaroClient that implements the API call to fetch devices from Fibaro HC3 (/api/devices). Called by the tool handler.async getDevices(): Promise<Device[]> { try { const response = await this.client.get('/api/devices'); return response.data; } catch (error) { throw new Error(`Failed to get devices: ${error}`); } }