Skip to main content
Glama
michaelkrasa

Alpha ESS MCP Server

by michaelkrasa

get_charge_config

Retrieve battery charging configuration for Alpha ESS systems to view structured period definitions and status, automatically selecting single systems when needed.

Instructions

Get battery charging configuration for a specific Alpha ESS system.
Returns structured configuration with clear period definitions and status.
If no serial provided, auto-selects if only one system exists.

Args:
    serial: The serial number of the Alpha ESS system (optional)
    
Returns:
    dict: Enhanced response with structured charging configuration

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
serialNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • main.py:665-733 (handler)
    The primary handler function for the 'get_charge_config' tool. It handles serial auto-discovery, calls the Alpha ESS API via client.getChargeConfigInfo, structures the response using helpers, and returns an enhanced standardized response.
    @mcp.tool()
    async def get_charge_config(serial: Optional[str] = None) -> dict[str, Any]:
        """
        Get battery charging configuration for a specific Alpha ESS system.
        Returns structured configuration with clear period definitions and status.
        If no serial provided, auto-selects if only one system exists.
        
        Args:
            serial: The serial number of the Alpha ESS system (optional)
            
        Returns:
            dict: Enhanced response with structured charging configuration
        """
        client = None
        try:
            # Auto-discover serial if not provided
            if not serial:
                serial_info = await get_default_serial()
                if not serial_info['success'] or not serial_info['serial']:
                    return create_enhanced_response(
                        success=False,
                        message=f"Serial auto-discovery failed: {serial_info['message']}",
                        raw_data=None,
                        data_type="config",
                        metadata={"available_systems": serial_info.get('systems', [])}
                    )
                serial = serial_info['serial']
    
            app_id, app_secret = get_alpha_credentials()
            client = alphaess(app_id, app_secret)
    
            # Get charge config
            config = await client.getChargeConfigInfo(serial)
    
            # Structure the config data
            structured = structure_config_data(config, "charge")
    
            return create_enhanced_response(
                success=True,
                message=f"Successfully retrieved charge config for {serial}",
                raw_data=config,
                data_type="config",
                serial_used=serial,
                metadata={
                    "config_type": "battery_charging",
                    "total_periods": 2,
                    "units": {"soc": "%", "time": "HH:MM"}
                },
                structured_data=structured
            )
    
        except ValueError as e:
            return create_enhanced_response(
                success=False,
                message=f"Configuration error: {str(e)}",
                raw_data=None,
                data_type="config"
            )
        except Exception as e:
            return create_enhanced_response(
                success=False,
                message=f"Error retrieving charge config: {str(e)}",
                raw_data=None,
                data_type="config"
            )
        finally:
            if client:
                await client.close()
  • Dataclass schema defining the structured output format for charge configuration, used in the tool's structured_data response.
    class ChargeConfig:
        enabled: bool
        periods: List[ConfigPeriod]
        charge_limit_soc: int
        units: Dict[str, str]
  • main.py:665-665 (registration)
    FastMCP decorator registering the get_charge_config function as a tool, which also auto-generates input schema from function signature and docstring.
    @mcp.tool()
  • Helper function that transforms raw API charge config data into the structured ChargeConfig dataclass instance used by the tool.
    def structure_config_data(raw_data: Dict[str, Any], config_type: str) -> Union[ChargeConfig, DischargeConfig, Dict]:
        """Structure configuration data with better field names"""
        if config_type == "charge":
            return ChargeConfig(
                enabled=bool(raw_data.get('gridCharge', 0)),
                periods=[
                    ConfigPeriod(
                        period=1,
                        start_time=raw_data.get('timeChaf1', '00:00'),
                        end_time=raw_data.get('timeChae1', '00:00'),
                        active=raw_data.get('timeChaf1', '00:00') != '00:00' or raw_data.get('timeChae1', '00:00') != '00:00'
                    ),
                    ConfigPeriod(
                        period=2,
                        start_time=raw_data.get('timeChaf2', '00:00'),
                        end_time=raw_data.get('timeChae2', '00:00'),
                        active=raw_data.get('timeChaf2', '00:00') != '00:00' or raw_data.get('timeChae2', '00:00') != '00:00'
                    )
                ],
                charge_limit_soc=raw_data.get('batHighCap', 100),
                units={"soc": "%", "time": "HH:MM"}
            )
        elif config_type == "discharge":
            return DischargeConfig(
                enabled=bool(raw_data.get('ctrDis', 0)),
                periods=[
                    ConfigPeriod(
                        period=1,
                        start_time=raw_data.get('timeDisf1', '00:00'),
                        end_time=raw_data.get('timeDise1', '00:00'),
                        active=raw_data.get('timeDisf1', '00:00') != '00:00' or raw_data.get('timeDise1', '00:00') != '00:00'
                    ),
                    ConfigPeriod(
                        period=2,
                        start_time=raw_data.get('timeDisf2', '00:00'),
                        end_time=raw_data.get('timeDise2', '00:00'),
                        active=raw_data.get('timeDisf2', '00:00') != '00:00' or raw_data.get('timeDise2', '00:00') != '00:00'
                    )
                ],
                discharge_limit_soc=raw_data.get('batUseCap', 10),
                units={"soc": "%", "time": "HH:MM"}
            )
        return raw_data
Behavior3/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. It describes the return format ('structured configuration with clear period definitions and status') and the auto-selection behavior for missing serials, which are useful. However, it lacks details on error handling, rate limits, or authentication requirements, leaving gaps for a mutation-free but context-sensitive tool.

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 appropriately sized and front-loaded: the first sentence states the core purpose, followed by key behavioral details and parameter explanations. Every sentence adds value without redundancy, making it efficient and easy to parse.

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

Completeness4/5

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

Given the tool's low complexity (1 optional parameter) and the presence of an output schema (which handles return values), the description is largely complete. It covers purpose, usage guidelines, and parameter semantics adequately. However, it could benefit from mentioning authentication needs or error cases, slightly reducing completeness.

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 description adds significant meaning beyond the input schema, which has 0% description coverage. It explains that 'serial' is optional and clarifies its purpose ('The serial number of the Alpha ESS system') and the auto-selection logic when omitted. This compensates well for the schema's lack of documentation, though it doesn't detail format constraints like serial length or patterns.

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 tool's purpose: 'Get battery charging configuration for a specific Alpha ESS system.' It specifies the verb ('Get') and resource ('battery charging configuration'), and distinguishes it from siblings like 'get_discharge_config' and 'set_battery_charge'. However, it doesn't explicitly differentiate from 'get_alpha_ess_data' or 'get_ess_list', which might also retrieve system data, so it's not a perfect 5.

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

Usage Guidelines4/5

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

The description provides clear context for usage: 'If no serial provided, auto-selects if only one system exists.' This guides when to omit the parameter. However, it doesn't explicitly state when to use this tool versus alternatives like 'get_discharge_config' or other data retrieval tools, nor does it mention prerequisites such as authentication, so it's not a full 5.

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/michaelkrasa/alpha-ess-mcp-server'

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