Skip to content

Commit e49c4e2

Browse files
committed
chore: unify condition names with experimental convention
1 parent 6e4a0fa commit e49c4e2

6 files changed

Lines changed: 10 additions & 23 deletions

File tree

scripts/generate-cli.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {Client} from '@modelcontextprotocol/sdk/client/index.js';
1111
import {StdioClientTransport} from '@modelcontextprotocol/sdk/client/stdio.js';
1212

1313
import {parseArguments} from '../build/src/bin/chrome-devtools-mcp-cli-options.js';
14-
import {CONDITION_TO_FLAG, buildFlag} from '../build/src/index.js';
14+
import {buildFlag} from '../build/src/index.js';
1515
import {
1616
labels,
1717
ToolCategory,
@@ -174,11 +174,7 @@ async function generateCli() {
174174

175175
const conditions = toolNameToConditions.get(tool.name) || [];
176176
for (const condition of conditions) {
177-
const flag =
178-
CONDITION_TO_FLAG[condition as keyof typeof CONDITION_TO_FLAG];
179-
if (flag) {
180-
requiredFlags.push(`--${flag}=true`);
181-
}
177+
requiredFlags.push(`--${condition}=true`);
182178
}
183179

184180
if (requiredFlags.length > 0) {

src/index.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,6 @@ import {pageIdSchema} from './tools/ToolDefinition.js';
3434
import {createTools} from './tools/tools.js';
3535
import {VERSION} from './version.js';
3636

37-
export const CONDITION_TO_FLAG: Record<string, string> = {
38-
computerVision: 'experimentalVision',
39-
experimentalMemory: 'experimentalMemory',
40-
experimentalInteropTools: 'experimentalInteropTools',
41-
screencast: 'experimentalScreencast',
42-
experimentalWebmcp: 'experimentalWebmcp',
43-
};
44-
4537
export function buildFlag(category: ToolCategory) {
4638
return category === ToolCategory.IN_PAGE
4739
? 'categoryInPageTools'
@@ -88,9 +80,8 @@ function getConditionStatus(
8880
condition: string,
8981
serverArgs: ReturnType<typeof parseArguments>,
9082
): {conditionFlag?: string; disabled: boolean} {
91-
const experimentalFlag = CONDITION_TO_FLAG[condition];
92-
if (experimentalFlag && !serverArgs[experimentalFlag]) {
93-
return {conditionFlag: experimentalFlag, disabled: true};
83+
if (condition && !serverArgs[condition]) {
84+
return {conditionFlag: condition, disabled: true};
9485
}
9586

9687
return {disabled: false};

src/tools/inPage.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const listInPageTools = definePageTool({
4848
annotations: {
4949
category: ToolCategory.IN_PAGE,
5050
readOnlyHint: true,
51-
conditions: ['inPageTools'],
51+
conditions: ['experimentalInPageTools'],
5252
},
5353
schema: {},
5454
blockedByDialog: false,
@@ -63,7 +63,7 @@ export const executeInPageTool = definePageTool({
6363
annotations: {
6464
category: ToolCategory.IN_PAGE,
6565
readOnlyHint: false,
66-
conditions: ['inPageTools'],
66+
conditions: ['experimentalInPageTools'],
6767
},
6868
schema: {
6969
toolName: zod.string().describe('The name of the tool to execute'),

src/tools/input.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export const clickAt = definePageTool({
9090
annotations: {
9191
category: ToolCategory.INPUT,
9292
readOnlyHint: false,
93-
conditions: ['computerVision'],
93+
conditions: ['experimentalVision'],
9494
},
9595
schema: {
9696
x: zod.number().describe('The x coordinate'),

src/tools/screencast.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const startScreencast = definePageTool(args => ({
2828
annotations: {
2929
category: ToolCategory.DEBUGGING,
3030
readOnlyHint: false,
31-
conditions: ['screencast'],
31+
conditions: ['experimentalScreencast'],
3232
},
3333
schema: {
3434
filePath: zod
@@ -99,7 +99,7 @@ export const stopScreencast = definePageTool({
9999
annotations: {
100100
category: ToolCategory.DEBUGGING,
101101
readOnlyHint: false,
102-
conditions: ['screencast'],
102+
conditions: ['experimentalScreencast'],
103103
},
104104
schema: {},
105105
blockedByDialog: false,

tests/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ describe('e2e', () => {
114114
);
115115
assert.ok(listInPageTools);
116116
},
117-
['--category-in-page-tools'],
117+
['--category-in-page-tools', '--experimental-in-page-tools'],
118118
);
119119
});
120120

0 commit comments

Comments
 (0)