Skip to content

Commit 28ef64a

Browse files
OzTamirOrKoN
authored andcommitted
fix: ensure that resourceTypes has elements
1 parent 3dfcbab commit 28ef64a

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

src/McpResponse.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ import type {
77
ImageContent,
88
TextContent,
99
} from '@modelcontextprotocol/sdk/types.js';
10-
import type {ResourceType} from 'puppeteer-core';
10+
import type { ResourceType } from 'puppeteer-core';
1111

12-
import {formatConsoleEvent} from './formatters/consoleFormatter.js';
12+
import { formatConsoleEvent } from './formatters/consoleFormatter.js';
1313
import {
1414
getFormattedHeaderValue,
1515
getShortDescriptionForRequest,
1616
getStatusFromRequest,
1717
} from './formatters/networkFormatter.js';
18-
import {formatA11ySnapshot} from './formatters/snapshotFormatter.js';
19-
import type {McpContext} from './McpContext.js';
20-
import type {ImageContentData, Response} from './tools/ToolDefinition.js';
21-
import {paginate, type PaginationOptions} from './utils/pagination.js';
18+
import { formatA11ySnapshot } from './formatters/snapshotFormatter.js';
19+
import type { McpContext } from './McpContext.js';
20+
import type { ImageContentData, Response } from './tools/ToolDefinition.js';
21+
import { paginate, type PaginationOptions } from './utils/pagination.js';
2222

2323
export class McpResponse implements Response {
2424
#includePages = false;
@@ -60,9 +60,9 @@ export class McpResponse implements Response {
6060
pagination:
6161
options?.pageSize || options?.pageIdx
6262
? {
63-
pageSize: options.pageSize,
64-
pageIdx: options.pageIdx,
65-
}
63+
pageSize: options.pageSize,
64+
pageIdx: options.pageIdx,
65+
}
6666
: undefined,
6767
resourceTypes: options?.resourceTypes,
6868
};
@@ -197,7 +197,7 @@ Call browser_handle_dialog to handle it before continuing.`);
197197
let requests = context.getNetworkRequests();
198198

199199
// Apply resource type filtering if specified
200-
if (this.#networkRequestsOptions.resourceTypes) {
200+
if (this.#networkRequestsOptions.resourceTypes?.length) {
201201
const normalizedTypes = new Set(
202202
this.#networkRequestsOptions.resourceTypes,
203203
);
@@ -217,7 +217,7 @@ Call browser_handle_dialog to handle it before continuing.`);
217217
response.push('Invalid page number provided. Showing first page.');
218218
}
219219

220-
const {startIndex, endIndex, currentPage, totalPages} =
220+
const { startIndex, endIndex, currentPage, totalPages } =
221221
paginationResult;
222222
response.push(
223223
`Showing ${startIndex + 1}-${endIndex} of ${requests.length} (Page ${currentPage + 1} of ${totalPages}).`,

0 commit comments

Comments
 (0)