get_device_status
Retrieve the current status of a SwitchBot device to monitor its operational state and connectivity.
Instructions
デバイスのステータスを取得します
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| deviceId | Yes | デバイスID |
Implementation Reference
- src/index.ts:147-168 (handler)The handler function for the 'get_device_status' tool. It validates the deviceId parameter, makes an API call to SwitchBot's /devices/{deviceId}/status endpoint using the configured axios instance, and returns the response body as JSON text.case 'get_device_status': { const args = request.params.arguments; if (!args || typeof args.deviceId !== 'string') { throw new McpError( ErrorCode.InvalidParams, 'デバイスIDが必要です' ); } const response = await this.axiosInstance.get( `/devices/${args.deviceId}/status` ); return { content: [ { type: 'text', text: JSON.stringify(response.data.body, null, 2), }, ], }; }
- src/index.ts:96-110 (registration)Registration of the 'get_device_status' tool in the ListToolsRequestSchema handler's tools array, specifying name, description, and input schema.{ name: 'get_device_status', description: 'デバイスのステータスを取得します', inputSchema: { type: 'object', properties: { deviceId: { type: 'string', description: 'デバイスID', }, }, required: ['deviceId'], }, }, {
- src/index.ts:99-108 (schema)Input schema definition for the 'get_device_status' tool, requiring a 'deviceId' string.inputSchema: { type: 'object', properties: { deviceId: { type: 'string', description: 'デバイスID', }, }, required: ['deviceId'], },