Skip to main content
Glama
genm
by genm

get_device_status

Retrieve the current status of a SwitchBot device to monitor its operational state and connectivity.

Instructions

デバイスのステータスを取得します

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deviceIdYesデバイスID

Implementation Reference

  • 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'],
        },
    },
    {
  • Input schema definition for the 'get_device_status' tool, requiring a 'deviceId' string.
    inputSchema: {
        type: 'object',
        properties: {
            deviceId: {
                type: 'string',
                description: 'デバイスID',
            },
        },
        required: ['deviceId'],
    },
Install Server

Other 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/genm/switchbot-mcp'

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