Skip to main content
Glama
Benniu

emqx-mcp-server

by Benniu

get_mqtt_client

Retrieve detailed information about a specific MQTT client using its client ID for monitoring and management purposes.

Instructions

Get detailed information about a specific MQTT client by client ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
requestYes

Implementation Reference

  • The MCP tool handler function for get_mqtt_client: extracts clientid from request, validates it, calls EMQXClient.get_client_info(clientid) and returns the result.
    @mcp.tool(name="get_mqtt_client", 
              description="Get detailed information about a specific MQTT client by client ID")
    async def get_client_info(request):
        """Handle get client info request
        
        Args:
            request: MCP request containing client identifier
                - clientid: Client ID (required) - The unique identifier of the client to retrieve
    
        Returns:
            MCPResponse: Response object with detailed client information
        """
        self.logger.info("Handling get client info request")
        
        # Extract required client ID parameter
        clientid = request.get("clientid")
        if not clientid:
            self.logger.error("Client ID is required but was not provided")
            return {"error": "Client ID is required"}
        
        # Get client information from EMQX
        result = await self.emqx_client.get_client_info(clientid)
        
        self.logger.info(f"Client info for '{clientid}' retrieved successfully")
        return result 
  • Core helper method that performs the HTTP GET request to the EMQX API (/clients/{clientid}) to retrieve detailed client information, handles auth and errors.
    async def get_client_info(self, clientid: str):
        """
        Get detailed information about a specific MQTT client by client ID.
        
        Uses the EMQX HTTP API to retrieve detailed information about a specific
        client identified by its client ID.
        
        Args:
            clientid (str): The unique identifier of the client to retrieve
            
        Returns:
            dict: Response from the EMQX API containing client data or error information
        """
        url = f"{self.api_url}/clients/{clientid}"
        
        self.logger.info(f"Retrieving information for client ID: {clientid}")
        
        async with httpx.AsyncClient() as client:
            try:
                response = await client.get(
                    url,
                    headers=self._get_auth_header(),
                    timeout=30
                )
                response.raise_for_status()
                return self._handle_response(response)
            except Exception as e:
                self.logger.error(f"Error retrieving client info for {clientid}: {str(e)}")
                return {"error": str(e)}
  • Registers the EMQXClientTools instance (which defines and registers the get_mqtt_client tool via @mcp.tool decorator) with the FastMCP server.
    # Register client tools
    emqx_client_tools = EMQXClientTools(self.logger)
    emqx_client_tools.register_tools(self.mcp)
    self.logger.info("EMQX client tools registered")
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states this is a read operation ('Get detailed information'), which implies it's non-destructive, but doesn't disclose behavioral traits like authentication needs, rate limits, error conditions, or what 'detailed information' includes (e.g., connection status, subscriptions). This is a significant gap for a tool with no annotation coverage.

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?

The description is a single, efficient sentence that gets straight to the point with no wasted words. It's appropriately sized and front-loaded, making it easy to parse quickly.

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

Completeness2/5

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

Given the complexity (a read operation with 1 parameter), lack of annotations, and no output schema, the description is incomplete. It doesn't explain what 'detailed information' returns, error handling, or parameter details, leaving the agent with insufficient context to use the tool effectively.

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

Parameters2/5

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

The schema has 1 parameter ('request') with 0% description coverage, and the description doesn't add any parameter-specific information. It mentions 'by client ID', which hints that the parameter might be a client ID, but doesn't clarify the parameter name, format, or constraints, failing to compensate for the low schema coverage.

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

Purpose4/5

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

The description clearly states the verb ('Get detailed information') and resource ('about a specific MQTT client by client ID'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'list_mqtt_clients' (which likely lists multiple clients vs. getting details for one), so it misses the highest score.

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

Usage Guidelines2/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 like 'list_mqtt_clients' or 'kick_mqtt_client'. It mentions 'by client ID' but doesn't specify prerequisites or contexts, leaving the agent to infer usage from the name alone.

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/Benniu/emqx-mcp-server'

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