Skip to main content
Glama
danroblewis

G1 UART MCP Server

by danroblewis

disconnect_g1_device

Disconnect from a connected G1 Bluetooth device to close the BLE connection, stop the heartbeat mechanism, and free up resources.

Instructions

Disconnect from the current G1 device.

Returns:
    Dict[str, Any]: JSON response with disconnection status including:
        - result: "success" or "error"
        - disconnected: Boolean indicating disconnection state
        - device_name: Name of previously connected device (if successful)
        - error: Error message if disconnection failed
    
Note:
    This closes the BLE connection to the currently connected device,
    cleans up resources, stops the heartbeat mechanism, and resets connection state.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function decorated with @server.tool(), implementing the disconnect_g1_device tool. It handles disconnection logic using the global ble_manager instance.
    @server.tool()
    async def disconnect_g1_device() -> Dict[str, Any]:
        """Disconnect from the current G1 device.
        
        Returns:
            Dict[str, Any]: JSON response with disconnection status including:
                - result: "success" or "error"
                - disconnected: Boolean indicating disconnection state
                - device_name: Name of previously connected device (if successful)
                - error: Error message if disconnection failed
            
        Note:
            This closes the BLE connection to the currently connected device,
            cleans up resources, stops the heartbeat mechanism, and resets connection state.
        """
        if not ble_manager.is_connected:
            return {
                "result": "error",
                "disconnected": False,
                "error": "Not connected to any device"
            }
    
        device_name = ble_manager.target_device.name if ble_manager.target_device else "Unknown"
    
        try:        
            await ble_manager.disconnect()
            return {
                "result": "success",
                "disconnected": True,
                "device_name": device_name
            }
        except Exception as e:
            logger.error(f"Disconnection failed: {e}")
            return {
                "result": "error",
                "disconnected": False,
                "error": f"Disconnection failed: {str(e)}"
            }
Behavior5/5

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

With no annotations provided, the description carries full burden and delivers comprehensive behavioral disclosure. It details the multi-step process: closes BLE connection, cleans up resources, stops heartbeat mechanism, and resets connection state. This goes far beyond just stating the action.

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

Conciseness5/5

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

Perfectly structured with clear sections: purpose statement, returns documentation, and behavioral notes. Every sentence adds value - no redundancy or wasted words. The information is front-loaded with the core action first.

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

Completeness5/5

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

For a zero-parameter tool with no annotations but with output schema, the description provides complete context. It explains the action, detailed behavioral consequences, and documents the return structure, making the output schema documentation redundant but helpful for reinforcement.

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

Parameters4/5

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

The tool has 0 parameters with 100% schema description coverage, so the baseline would be 4. The description appropriately doesn't discuss parameters since none exist, maintaining focus on the tool's purpose and behavior.

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

Purpose5/5

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

The description clearly states the specific action ('Disconnect from') and target resource ('the current G1 device'), distinguishing it from siblings like connect_g1_device and get_g1_connection_status. It goes beyond the tool name by specifying it's about BLE connection termination.

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

Usage Guidelines5/5

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

Explicitly states when to use ('Disconnect from the current G1 device') and implies when not to use (when no device is connected). The sibling tools provide clear alternatives for other operations like connecting, checking status, scanning, or sending messages.

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/danroblewis/g1_uart_mcp'

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