Skip to main content
Glama
genm
by genm

control_device

Control SwitchBot smart devices by sending commands like turnOn or turnOff to manage home automation through the MCP server.

Instructions

デバイスを制御します

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deviceIdYesデバイスID
commandYesコマンド(turnOn, turnOff)

Implementation Reference

  • Handler for the 'control_device' tool. Validates deviceId and command arguments, issues a POST request to the SwitchBot API endpoint `/devices/${deviceId}/commands` with the specified command, and returns the JSON response.
    case 'control_device': {
        const args = request.params.arguments;
        if (!args || typeof args.deviceId !== 'string' || typeof args.command !== 'string') {
            throw new McpError(
                ErrorCode.InvalidParams,
                'デバイスIDとコマンドが必要です'
            );
        }
    
        const response = await this.axiosInstance.post(
            `/devices/${args.deviceId}/commands`,
            {
                command: args.command,
                parameter: 'default',
                commandType: 'command',
            }
        );
    
        return {
            content: [
                {
                    type: 'text',
                    text: JSON.stringify(response.data, null, 2),
                },
            ],
        };
    }
  • src/index.ts:110-128 (registration)
    Registration of the 'control_device' tool in the server's tools list, including name, description, and input schema definition.
    {
        name: 'control_device',
        description: 'デバイスを制御します',
        inputSchema: {
            type: 'object',
            properties: {
                deviceId: {
                    type: 'string',
                    description: 'デバイスID',
                },
                command: {
                    type: 'string',
                    description: 'コマンド(turnOn, turnOff)',
                    enum: ['turnOn', 'turnOff'],
                },
            },
            required: ['deviceId', 'command'],
        },
    },
  • Input schema for the 'control_device' tool, defining required deviceId (string) and command (string enum: turnOn/turnOff).
    inputSchema: {
        type: 'object',
        properties: {
            deviceId: {
                type: 'string',
                description: 'デバイスID',
            },
            command: {
                type: 'string',
                description: 'コマンド(turnOn, turnOff)',
                enum: ['turnOn', 'turnOff'],
            },
        },
        required: ['deviceId', 'command'],
    },
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. 'デバイスを制御します' only states the action without revealing any behavioral traits: it doesn't indicate whether this is a read or write operation (though 'control' implies mutation), what permissions are required, whether changes are reversible, what side effects occur, or what the response looks like. For a device control tool with zero annotation coverage, this is completely inadequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

While the description is technically concise (a single phrase), this represents under-specification rather than effective brevity. The single sentence 'デバイスを制御します' doesn't earn its place by providing meaningful information beyond what's already implied by the tool name. True conciseness balances brevity with information density, which this description fails to achieve.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given this is a device control tool (implying mutation) with no annotations, no output schema, and a minimal description, the description is completely inadequate. The agent needs to understand what 'control' means operationally, what happens when commands are executed, what the response contains, and how this differs from sibling tools. The current description provides none of this essential context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with both parameters ('deviceId' and 'command') fully documented in the schema. The description adds no additional meaning about parameters beyond what the schema already provides. According to the scoring rules, when schema coverage is high (>80%), the baseline score is 3 even with no parameter information in the description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'デバイスを制御します' (controls devices) is a tautology that essentially restates the tool name 'control_device' in Japanese. It doesn't specify what kind of control is performed or differentiate this tool from its siblings 'get_device_status' and 'list_devices'. While it indicates the general domain (device control), it lacks specificity about the verb and resource scope.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. There's no mention of when to use 'control_device' instead of 'get_device_status' or 'list_devices', nor any context about prerequisites, appropriate scenarios, or exclusions. The agent receives no usage direction beyond the tool name itself.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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