bridge_status
Determine if the bridge is up to date by comparing its version with the latest on npm. Returns upgrade steps when an update is available.
Instructions
Report the bridge's own version and check whether a newer one is on npm. Returns {bridge_version, bridge_latest, update_available, upgrade_steps}. Call this when the user asks 'is mockzilla-mcp up to date?', or proactively if a tool starts failing in a way that could be a stale-bridge issue.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- lib/version.js:66-84 (handler)The bridgeStatus function that executes the tool logic. Reads the current version from package.json, checks npm registry for the latest version, compares them with semver, and returns version info plus upgrade steps if an update is available.
export async function bridgeStatus() { const current = await bridgeVersion(); const latest = await latestPublishedVersion(); const updateAvailable = latest != null && compareSemver(latest, current) > 0; return { bridge_version: current, bridge_latest: latest, update_available: updateAvailable, upgrade_steps: updateAvailable ? [ "Run: npx clear-npx-cache @mockzilla/mcp", "Quit and reopen your MCP client (Claude Desktop / Cursor).", "If your config uses '@mockzilla/mcp@latest', the new version is fetched on the next launch automatically.", ] : null, }; } - lib/tools.js:312-325 (schema)Registration of the 'bridge_status' tool with its description (telling the agent when to call it) and inputSchema (empty object, no params needed).
bridge_status: { description: "Report the bridge's own version and check whether a newer one " + "is on npm. Returns {bridge_version, bridge_latest, update_available, " + "upgrade_steps}. Call this when the user asks 'is mockzilla-mcp up " + "to date?', or proactively if a tool starts failing in a way that " + "could be a stale-bridge issue.", inputSchema: { type: "object", properties: {}, additionalProperties: false, }, handler: bridgeStatus, }, - lib/tools.js:312-325 (registration)The tool definition in the LOCAL_TOOLS registry, mapping the name 'bridge_status' to its description, input schema, and handler.
bridge_status: { description: "Report the bridge's own version and check whether a newer one " + "is on npm. Returns {bridge_version, bridge_latest, update_available, " + "upgrade_steps}. Call this when the user asks 'is mockzilla-mcp up " + "to date?', or proactively if a tool starts failing in a way that " + "could be a stale-bridge issue.", inputSchema: { type: "object", properties: {}, additionalProperties: false, }, handler: bridgeStatus, }, - lib/version.js:21-27 (helper)Helper that reads and caches the current bridge version from package.json.
export async function bridgeVersion() { if (cachedVersion) return cachedVersion; const raw = await readFile(PKG_PATH, "utf8"); const pkg = JSON.parse(raw); cachedVersion = pkg.version; return cachedVersion; } - lib/version.js:33-54 (helper)Helper that fetches the latest published version from the npm registry with caching and a 4-second timeout.
export async function latestPublishedVersion() { if (cachedLatest && Date.now() - cachedAt < LATEST_CACHE_TTL_MS) { return cachedLatest; } const ctrl = new AbortController(); const t = setTimeout(() => ctrl.abort(), 4000); try { const res = await fetch( "https://registry.npmjs.org/@mockzilla/mcp/latest", { signal: ctrl.signal }, ); if (!res.ok) return null; const body = await res.json(); cachedLatest = body.version || null; cachedAt = Date.now(); return cachedLatest; } catch { return null; } finally { clearTimeout(t); } }