Skip to main content
Glama

Current operating environment

getBatteryInfo

Retrieve detailed battery information for the current device, including status and charge level, to monitor device health and optimize usage within the operating environment.

Instructions

获取当前设备的电池信息

Input Schema

NameRequiredDescriptionDefault

No arguments

Input Schema (JSON Schema)

{ "properties": {}, "required": [], "type": "object" }

Implementation Reference

  • Handler implementation for the getBatteryInfo tool. Fetches battery information using the systeminformation (si) library's battery() method and returns it as a JSON-formatted text response.
    case "getBatteryInfo": { const batteryInfo = await si.battery(); return { content: [{ type: "text", text: JSON.stringify(batteryInfo, null, 2) }] }; }
  • src/index.ts:190-198 (registration)
    Registration of the getBatteryInfo tool in the listTools handler (handleRequest function). Defines the tool name, description, and input schema (empty object).
    { name: "getBatteryInfo", description: "获取当前设备的电池信息", inputSchema: { type: "object", properties: {}, required: [] } },
  • Input schema definition for the getBatteryInfo tool, specifying an empty object with no properties or requirements.
    inputSchema: { type: "object", properties: {}, required: [] }

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/JackXuyi/env-mcp'

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