proxy_import_har
Import HAR files from disk to create queryable sessions for analyzing and replaying captured network traffic.
Instructions
Import a HAR file from disk into a new persisted session for querying, findings, and replay.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| har_file | Yes | Path to HAR file on disk | |
| session_name | No | Optional name for the imported session | |
| storage_dir | No | Optional custom session storage directory | |
| max_disk_mb | No | Session disk cap in MB | |
| strict | No | When true, abort on first invalid HAR entry; when false, skip invalid entries |
Implementation Reference
- src/tools/sessions.ts:110-137 (handler)The handler for the 'proxy_import_har' tool, which takes a file path and import settings, delegates to `proxyManager.importHarAsSession`, and returns the result.
server.tool( "proxy_import_har", "Import a HAR file from disk into a new persisted session for querying, findings, and replay.", { har_file: z.string().describe("Path to HAR file on disk"), session_name: z.string().optional().describe("Optional name for the imported session"), storage_dir: z.string().optional().describe("Optional custom session storage directory"), max_disk_mb: z.number().optional().default(1024).describe("Session disk cap in MB"), strict: z.boolean().optional().default(false) .describe("When true, abort on first invalid HAR entry; when false, skip invalid entries"), }, async ({ har_file, session_name, storage_dir, max_disk_mb, strict }) => { try { const result = await proxyManager.importHarAsSession({ harFile: har_file, sessionName: session_name, storageDir: storage_dir, maxDiskMb: max_disk_mb, strict, }); return { content: [{ type: "text", text: truncateResult({ status: "success", ...result }) }], }; } catch (e) { return { content: [{ type: "text", text: JSON.stringify({ status: "error", error: toError(e) }) }] }; } }, ); - src/state.ts:711-713 (handler)The actual implementation of importHarAsSession, which delegates to the session store.
async importHarAsSession(opts: HarImportOptions): Promise<{ session: SessionManifest; importSummary: HarImportSummary }> { return await this.sessionStore.importHar(opts); } - src/tools/sessions.ts:110-130 (registration)Tool definition and registration of 'proxy_import_har'.
server.tool( "proxy_import_har", "Import a HAR file from disk into a new persisted session for querying, findings, and replay.", { har_file: z.string().describe("Path to HAR file on disk"), session_name: z.string().optional().describe("Optional name for the imported session"), storage_dir: z.string().optional().describe("Optional custom session storage directory"), max_disk_mb: z.number().optional().default(1024).describe("Session disk cap in MB"), strict: z.boolean().optional().default(false) .describe("When true, abort on first invalid HAR entry; when false, skip invalid entries"), }, async ({ har_file, session_name, storage_dir, max_disk_mb, strict }) => { try { const result = await proxyManager.importHarAsSession({ harFile: har_file, sessionName: session_name, storageDir: storage_dir, maxDiskMb: max_disk_mb, strict, }); return {