refresh
Reload a browser tab to update stale page state after changes. Use the tab ID from create_tab.
Instructions
Reload the current page. Useful when page state is stale or after changes.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tabId | Yes | Tab ID from create_tab |
Implementation Reference
- src/tools/navigation.ts:82-107 (registration)Registration of the 'refresh' tool on the MCP server. Defines input schema (tabId string) and handler that calls client.refresh().
server.tool( "refresh", "Reload the current page. Useful when page state is stale or after changes.", { tabId: z.string().min(1).describe("Tab ID from create_tab") }, async (input: unknown) => { try { const parsed = z.object({ tabId: z.string().min(1).describe("Tab ID from create_tab") }).parse(input); const tracked = getTrackedTab(parsed.tabId); const action = await deps.client.refresh(parsed.tabId, tracked.userId); incrementToolCall(parsed.tabId); if (action.url) { updateTabUrl(parsed.tabId, action.url); } return okResult({ success: true, url: action.url, title: action.title ?? "", refsAvailable: action.refsAvailable }); } catch (error) { return toErrorResult(error); } } ); - src/client.ts:394-405 (handler)Handler function - sends POST request to /tabs/{tabId}/refresh API endpoint with userId in the body, returns url, title, and refsAvailable.
async refresh(tabId: string, userId: string): Promise<NavigationActionResponse> { const response = await this.requestJson(`/tabs/${encodeURIComponent(tabId)}/refresh`, { method: "POST", body: JSON.stringify({ userId }) }, NavigationActionRawResponseSchema); return { url: response.url ?? "", title: response.title, refsAvailable: response.refsAvailable }; } - src/client.ts:106-112 (schema)Zod schema for raw API response validation for refresh (and navigation) endpoints.
const NavigationActionRawResponseSchema = z .object({ url: z.string().optional(), title: z.string().optional(), refsAvailable: z.boolean().optional() }) .passthrough(); - src/types.ts:91-95 (schema)TypeScript interface defining the shape of the refresh response.
export interface NavigationActionResponse { url: string; title?: string; refsAvailable?: boolean; }