Bark推送通知
bark_send_notifySend push notifications to iOS devices via Bark. Customize title, subtitle, URL, icon, and alert level to control urgency and display behavior.
Instructions
通过Bark推送通知
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| body | Yes | 推送内容 | |
| title | No | 推送标题 | |
| subtitle | No | 推送副标题 | |
| device_key | No | 设备key,默认从环境变量获取 | |
| url | No | 点击推送时,跳转的URL ,支持URL Scheme 和 Universal Link | |
| icon | No | 自定义图标URL | |
| level | No | 推送中断级别。critical: 重要警告, 在静音模式下也会响铃active:默认值,系统会立即亮屏显示通知timeSensitive:时效性通知,可在专注状态下显示通知。passive:仅将通知添加到通知列表,不会亮屏提醒。 | active |
| volume | No | 重要警告的通知音量(0-10),默认为5 |
Implementation Reference
- mcp_notify/other.py:105-140 (handler)The bark_send_notify function that executes the Bark push notification logic. It sends a POST request to the Bark API (default https://api.day.app) with the provided body, title, subtitle, device_key, url, icon, level, and volume parameters. Falls back to BARK_DEVICE_KEY and BARK_BASE_URL environment variables.
def bark_send_notify( body: str = Field(description="推送内容"), title: str = Field("", description="推送标题"), subtitle: str = Field("", description="推送副标题"), device_key: str = Field("", description="设备key,默认从环境变量获取"), url: str = Field("", description="点击推送时,跳转的URL ,支持URL Scheme 和 Universal Link"), icon: str = Field("", description="自定义图标URL"), level: str = Field( "active", description="推送中断级别。" "critical: 重要警告, 在静音模式下也会响铃" "active:默认值,系统会立即亮屏显示通知" "timeSensitive:时效性通知,可在专注状态下显示通知。" "passive:仅将通知添加到通知列表,不会亮屏提醒。", ), volume: int = Field(5, description="重要警告的通知音量(0-10),默认为5"), ): """ https://bark.day.app/#/tutorial """ if not device_key: device_key = os.getenv("BARK_DEVICE_KEY", "") base = os.getenv("BARK_BASE_URL") or "https://api.day.app" res = requests.post( f"{base}/{device_key}", json={ "body": body, "title": title, "subtitle": subtitle, "url": url, "icon": icon, "level": level, "volume": volume, }, ) return res.json() - mcp_notify/other.py:105-121 (schema)The function signature with Pydantic Field definitions serving as input schema/validation for all parameters (body, title, subtitle, device_key, url, icon, level, volume).
def bark_send_notify( body: str = Field(description="推送内容"), title: str = Field("", description="推送标题"), subtitle: str = Field("", description="推送副标题"), device_key: str = Field("", description="设备key,默认从环境变量获取"), url: str = Field("", description="点击推送时,跳转的URL ,支持URL Scheme 和 Universal Link"), icon: str = Field("", description="自定义图标URL"), level: str = Field( "active", description="推送中断级别。" "critical: 重要警告, 在静音模式下也会响铃" "active:默认值,系统会立即亮屏显示通知" "timeSensitive:时效性通知,可在专注状态下显示通知。" "passive:仅将通知添加到通知列表,不会亮屏提醒。", ), volume: int = Field(5, description="重要警告的通知音量(0-10),默认为5"), ): - mcp_notify/other.py:101-104 (registration)The @mcp.tool decorator that registers bark_send_notify as an MCP tool, with title 'Bark推送通知' and description '通过Bark推送通知'.
@mcp.tool( title="Bark推送通知", description="通过Bark推送通知", ) - mcp_notify/__init__.py:21-23 (registration)The call to other.add_tools(mcp) which registers all tools in other.py (including bark_send_notify) with the FastMCP instance.
other.add_tools(mcp) hass.add_tools(mcp) util.add_tools(mcp)