Skip to content

Commit ad67043

Browse files
committed
Add list of in-page tools to new_page result
1 parent 24be83c commit ad67043

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

src/tools/pages.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ export const newPage = defineTool({
129129
);
130130

131131
response.setIncludePages(true);
132+
response.setListInPageTools();
132133
},
133134
});
134135

tests/McpResponse.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
closePage,
2020
listPages,
2121
navigatePage,
22+
newPage,
2223
selectPage,
2324
} from '../src/tools/pages.js';
2425
import type {InsightName} from '../src/trace-processing/parse.js';
@@ -1188,4 +1189,19 @@ describe('inPage tools', () => {
11881189
);
11891190
}, 'navigate_page');
11901191
});
1192+
1193+
it('includes in-page tools in new_page response', async () => {
1194+
await testIncludesInPageTools(async (response, context) => {
1195+
// Workaround to ensure the test environment's new page contain in-page tools
1196+
sinon.stub(context, 'newPage').resolves(context.getSelectedMcpPage());
1197+
1198+
await newPage.handler(
1199+
{
1200+
params: {url: 'about:blank'},
1201+
},
1202+
response,
1203+
context,
1204+
);
1205+
}, 'new_page');
1206+
});
11911207
});

0 commit comments

Comments
 (0)