ping
Probe configured accounts to return connectivity status and latency, allowing the LLM to self-check account health.
Instructions
Probe every configured account (or just the named one). Returns per- account {name, kind, ok, latency_ms, error?} so the LLM can self-check.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| account | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/productivity_mcp/server.py:771-798 (handler)The main 'ping' tool handler — decorated with @mcp.tool() and @_logged. Probes every configured email/calendar account (or a specific one) and returns per-account status including latency.
@mcp.tool() @_logged def ping(account: str | None = None) -> list[dict[str, Any]]: """Probe every configured account (or just the named one). Returns per- account {name, kind, ok, latency_ms, error?} so the LLM can self-check.""" import time as _t results: list[dict[str, Any]] = [] providers: list[tuple[str, Any]] = [] if account is None or account in _email_providers: for n, p in _email_providers.items(): if account is None or n == account: providers.append((f"email:{n}", p)) if account is None or account in _calendar_providers: for n, p in _calendar_providers.items(): if account is None or n == account: providers.append((f"calendar:{n}", p)) for label, p in providers: t0 = _t.time() entry: dict[str, Any] = {"name": label, "kind": p.__class__.__name__, "ok": True} try: p.ping() except Exception as exc: entry["ok"] = False entry["error"] = f"{type(exc).__name__}: {exc}" entry["latency_ms"] = int((_t.time() - t0) * 1000) results.append(entry) return results - src/productivity_mcp/server.py:771-771 (registration)Registration of the 'ping' tool via the @mcp.tool() decorator on line 771, which registers it with the FastMCP server instance.
@mcp.tool() - Default ping implementation on EmailProvider base class — delegates to self.list_folders() as a health check.
def ping(self) -> None: self.list_folders() - Default ping implementation on CalendarProvider base class — delegates to self.list_calendars() as a health check.
def ping(self) -> None: self.list_calendars()