Skip to main content
Glama
al-one

MCP Server for notify to weixin / telegram / bark / lark

Send to HomeAssistant Mobile APP

ha_send_mobile

Send notifications to Home Assistant Mobile App with custom messages, titles, and optional extended data like images or actions.

Instructions

Send a notification to Home Assistant Mobile APP

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageYesNotification content
titleNoNotification title
subtitleNoNotification subtitle
dataNoExtended data, json string. ```json { "image": "http://a.com/photo.jpg", "video": "http://a.com/video.mp4", "audio": "http://a.com/audio.mp3", # ios only "actions": [ { "action": "YOUR_ACTION_KEY", # Required. The identifier passed back in events. "title": "Do Something", "icon": "sfsymbols:bell.slash" # ios only }, { "action": "URL", # Must be set to URI if you plan to use a URI "title": "Open Url", # The action button title "url": "https://github.com" # URL to open when action is selected }, { "action": "REPLY", # When set to REPLY, you will be prompted for text to send with the event. "title": "Reply me", "behavior": "textInput" # Optional. Set to `textInput` to prompt for text to return with the event. This also occurs when setting the action to `REPLY`. } ] } ``` All fields in the extended data are optional. {}
urlNoOpening a URL when tapping on a notification
device_keyNoDevice key, Default to get from environment variables

Implementation Reference

  • Registration of hass tools (including ha_send_mobile) via hass.add_tools(mcp)
    hass.add_tools(mcp)
  • Main tool registration and handler: defines the @mcp.tool decorator and the ha_send_mobile function that sends notifications to Home Assistant Mobile App via its REST API
    @mcp.tool(
        title="Send to HomeAssistant Mobile APP",
        description="Send a notification to Home Assistant Mobile APP",
    )
    def ha_send_mobile(
        message: str = Field(description="Notification content"),
        title: str = Field("", description="Notification title"),
        subtitle: str = Field("", description="Notification subtitle"),
        data: str | dict = Field("{}", description=f"Extended data, json string.{HA_NOTIFY_DATA_PROMPT}"),
        url: str = Field("", description="Opening a URL when tapping on a notification"),
        device_key: str = Field("", description="Device key, Default to get from environment variables"),
    ):
        base = os.getenv("HASS_BASE_URL") or "http://homeassistant.local:8123"
        if not (token := os.getenv("HASS_ACCESS_TOKEN")):
            return "You need to set `HASS_ACCESS_TOKEN` in the environment variable"
    
        headers = {"Authorization": f"Bearer {token}"}
        if not device_key:
            device_key = os.getenv("HASS_MOBILE_KEY", "")
        if not device_key:
            res = requests.get(f"{base}/api/services", headers=headers)
            for service in res.json() or []:
                if service["domain"] != "notify":
                    continue
                for name in service["services"]:
                    if name.startswith("mobile_app_"):
                        device_key = name
                        break
        if device_key.startswith("notify."):
            device_key = device_key[7:]
        elif not device_key.startswith("mobile_app_"):
            device_key = f"mobile_app_{device_key}"
    
        if isinstance(data, str):
            try:
                data = json.loads(data)
            except ValueError:
                data = {}
        elif not isinstance(data, dict):
            data = {}
        if url:
            data.setdefault("url", url)  # ios
            data.setdefault("clickAction", url)  # android
        if subtitle:
            data.setdefault("subtitle", subtitle)  # ios
            data.setdefault("subject", subtitle)  # android
    
        res = requests.post(
            f"{base}/api/services/notify/{device_key}",
            json={
                "message": message,
                "title": title,
                "data": data,
            },
            headers=headers,
        )
        return res.json()
  • The @mcp.tool decorator registers ha_send_mobile as a tool with title and description
    @mcp.tool(
        title="Send to HomeAssistant Mobile APP",
        description="Send a notification to Home Assistant Mobile APP",
    )
  • Input schema/parameters for ha_send_mobile: message (required), title, subtitle, data (extended JSON data), url, device_key
    def ha_send_mobile(
        message: str = Field(description="Notification content"),
        title: str = Field("", description="Notification title"),
        subtitle: str = Field("", description="Notification subtitle"),
        data: str | dict = Field("{}", description=f"Extended data, json string.{HA_NOTIFY_DATA_PROMPT}"),
        url: str = Field("", description="Opening a URL when tapping on a notification"),
        device_key: str = Field("", description="Device key, Default to get from environment variables"),
    ):
Behavior2/5

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

With no annotations, the description bears full responsibility for behavioral disclosure. It fails to mention any traits such as asynchronicity, error handling, or network requirements. The only behavior implied is sending, but no side effects or success indicators.

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

Conciseness3/5

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

The description is extremely concise (one sentence), but it sacrifices informativeness. It arguably could be expanded to include key capabilities without losing conciseness. It is not verbose, but it is under-specific.

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 tool's complexity (6 parameters, including a complex JSON field) and the lack of an output schema, the description is too sparse. It does not explain what happens after sending (e.g., success response, errors) or provide context like whether the device key is required.

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

Parameters3/5

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

The input schema has 100% description coverage, including detailed examples for the 'data' field. The tool description adds no additional parameter meaning, so the baseline of 3 is appropriate. It does not compensate for any missing schema details.

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 action (send a notification) and the target (Home Assistant Mobile APP), which differentiates it from sibling notification tools targeting other platforms. However, it does not elaborate on the capabilities like rich content (images, actions) hinted in the schema.

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?

No usage guidelines are provided. The description does not specify when to use this tool over alternatives (e.g., bark, tg_send_message), nor does it mention any prerequisites or limitations.

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/al-one/mcp-notify'

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