Skip to main content
Glama

get_pico_info

Retrieve information from Pico development boards to enable AI-driven IoT control through MQTT integration, allowing natural language commands and real-time device management.

Instructions

获取Pico开发板信息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Executes the 'get_pico_info' tool by preparing the 'INFO' message to be sent over MQTT to retrieve Pico device information.
    elif name == "get_pico_info":
        message = "INFO"
  • Registers and lists all available tools including 'get_pico_info' dynamically from the configuration, defining their schemas.
    @server.list_tools()
    async def handle_list_tools() -> List[types.Tool]:
        """List available tools."""
        tools = []
        for tool_name, tool_config in config.tools.items():
            tools.append(
                types.Tool(
                    name=tool_config.name,
                    description=tool_config.description,
                    inputSchema={
                        "type": "object",
                        "properties": {
                            param["name"]: {
                                "type": param["type"],
                                "description": param["description"],
                                **({"enum": param["enum"]} if "enum" in param else {})
                            }
                            for param in tool_config.parameters
                        },
                        "required": [
                            param["name"]
                            for param in tool_config.parameters
                            if param.get("required", False)
                        ]
                    }
                )
            )
        return tools
  • Dynamically generates the input schema for 'get_pico_info' (likely empty parameters) from the loaded configuration.
    @server.list_tools()
    async def handle_list_tools() -> List[types.Tool]:
        """List available tools."""
        tools = []
        for tool_name, tool_config in config.tools.items():
            tools.append(
                types.Tool(
                    name=tool_config.name,
                    description=tool_config.description,
                    inputSchema={
                        "type": "object",
                        "properties": {
                            param["name"]: {
                                "type": param["type"],
                                "description": param["description"],
                                **({"enum": param["enum"]} if "enum" in param else {})
                            }
                            for param in tool_config.parameters
                        },
                        "required": [
                            param["name"]
                            for param in tool_config.parameters
                            if param.get("required", False)
                        ]
                    }
                )
            )
        return tools
  • The main @server.call_tool() handler that dispatches to the specific logic for 'get_pico_info' and sends MQTT message.
    @server.call_tool()
    async def handle_call_tool(name: str, arguments: Dict[str, Any] | None) -> List[types.TextContent | types.ImageContent]:
        """Handle tool execution requests."""
        try:
            logger.info(f"Tool call received - Name: {name}, Arguments: {arguments}")
            
            # 检查工具是否存在
            if name not in config.tools:
                return [types.TextContent(
                    type="text",
                    text=f"Error: Tool {name} not found"
                )]
                
            tool_config = config.tools[name]
            
            # 验证参数
            if arguments is None:
                arguments = {}
                
            # 检查必需参数
            for param in tool_config.parameters:
                if param.get('required', False) and param['name'] not in arguments:
                    return [types.TextContent(
                        type="text",
                        text=f"Error: Missing required parameter {param['name']}"
                    )]
                    
                # 验证枚举值
                if 'enum' in param and param['name'] in arguments:
                    if arguments[param['name']] not in param['enum']:
                        return [types.TextContent(
                            type="text",
                            text=f"Error: Invalid value for {param['name']}"
                        )]
            
            # 准备消息
            message = None
            if name == "set_pwm":
                frequency = arguments.get("frequency", 0)
                if not (0 <= frequency <= 100):
                    return [types.TextContent(
                        type="text",
                        text="Error: Frequency must be between 0 and 100"
                    )]
                message = f"PWM {frequency}"
                
            elif name == "get_pico_info":
                message = "INFO"
                
            elif name == "led_control":
                state = arguments.get("state", "").lower()
                if state not in ["on", "off"]:
                    return [types.TextContent(
                        type="text",
                        text="Error: State must be 'on' or 'off'"
                    )]
                message = f"LED {state}"
                
            else:
                return [types.TextContent(
                    type="text",
                    text=f"Error: Unknown tool {name}"
                )]
            
            # 发送消息并等待响应
            mqtt_connection = MQTTConnection(config)
            response = await mqtt_connection.connect_and_send(
                topic=tool_config.mqtt_topic,
                message=message,
                response_topic=tool_config.response_topic
            )
            
            return [types.TextContent(
                type="text",
                text=response if response else f"{config.mqtt_response_start_string} {message} OK"
            )]
            
        except Exception as e:
            logger.error(f"Error handling tool call: {e}")
            return [types.TextContent(
                type="text",
                text=f"Error: {str(e)}"
            )]
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. '获取' (get) implies a read operation, but the description doesn't specify whether this requires authentication, has rate limits, returns structured data, or has any side effects. For a tool with zero annotation coverage, this is inadequate behavioral transparency.

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

Conciseness4/5

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

The description is a single Chinese phrase that directly states the tool's purpose. There's no wasted language or unnecessary elaboration. However, it could be more front-loaded with additional context, but for a simple tool, this is appropriately concise.

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 no annotations, no output schema, and a simple parameterless design, the description is incomplete. It doesn't explain what information is returned (hardware specs, status, configuration?), format of response, or any behavioral constraints. For even a simple tool, more context would help the agent understand what to expect.

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. The description doesn't need to explain parameters since none exist. A baseline of 4 is appropriate for parameterless tools where the schema fully documents the absence of inputs.

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

Purpose3/5

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

The description '获取Pico开发板信息' (Get Pico development board information) states a clear verb ('获取' - get) and resource ('Pico开发板信息' - Pico development board information). However, it doesn't distinguish from sibling tools like 'led_control' or 'set_pwm' - those are clearly different operations, but this description doesn't clarify what specific information is retrieved versus other possible information tools.

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. It doesn't mention prerequisites, timing considerations, or relationships to sibling tools. The agent must infer usage purely from the tool name and description without any explicit context.

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/mcp2everything/mcp2mqtt'

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