@@ -24,7 +24,7 @@ import type {ImageContentData, Response} from './tools/ToolDefinition.js';
2424import { paginate , type PaginationOptions } from './utils/pagination.js' ;
2525
2626interface NetworkRequestData {
27- networkRequestUrl : string ;
27+ networkRequestStableId : number ;
2828 requestBody ?: string ;
2929 responseBody ?: string ;
3030}
@@ -106,9 +106,9 @@ export class McpResponse implements Response {
106106 } ;
107107 }
108108
109- attachNetworkRequest ( url : string ) : void {
109+ attachNetworkRequest ( reqid : number ) : void {
110110 this . #attachedNetworkRequestData = {
111- networkRequestUrl : url ,
111+ networkRequestStableId : reqid ,
112112 } ;
113113 }
114114
@@ -123,8 +123,8 @@ export class McpResponse implements Response {
123123 get includeConsoleData ( ) : boolean {
124124 return this . #consoleDataOptions?. include ?? false ;
125125 }
126- get attachedNetworkRequestUrl ( ) : string | undefined {
127- return this . #attachedNetworkRequestData?. networkRequestUrl ;
126+ get attachedNetworkRequestId ( ) : number | undefined {
127+ return this . #attachedNetworkRequestData?. networkRequestStableId ;
128128 }
129129 get networkRequestsPageIdx ( ) : number | undefined {
130130 return this . #networkRequestsOptions?. pagination ?. pageIdx ;
@@ -167,9 +167,9 @@ export class McpResponse implements Response {
167167 await context . createTextSnapshot ( ) ;
168168 }
169169
170- if ( this . #attachedNetworkRequestData?. networkRequestUrl ) {
171- const request = context . getNetworkRequestByUrl (
172- this . #attachedNetworkRequestData. networkRequestUrl ,
170+ if ( this . #attachedNetworkRequestData?. networkRequestStableId ) {
171+ const request = context . getNetworkRequestById (
172+ this . #attachedNetworkRequestData. networkRequestStableId ,
173173 ) ;
174174
175175 this . #attachedNetworkRequestData. requestBody =
@@ -350,12 +350,12 @@ Call ${handleDialog.name} to handle it before continuing.`);
350350
351351 #getIncludeNetworkRequestsData( context : McpContext ) : string [ ] {
352352 const response : string [ ] = [ ] ;
353- const url = this . #attachedNetworkRequestData?. networkRequestUrl ;
353+ const url = this . #attachedNetworkRequestData?. networkRequestStableId ;
354354 if ( ! url ) {
355355 return response ;
356356 }
357357
358- const httpRequest = context . getNetworkRequestByUrl ( url ) ;
358+ const httpRequest = context . getNetworkRequestById ( url ) ;
359359 response . push ( `## Request ${ httpRequest . url ( ) } ` ) ;
360360 response . push ( `Status: ${ getStatusFromRequest ( httpRequest ) } ` ) ;
361361 response . push ( `### Request Headers` ) ;
0 commit comments