Skip to content

Commit 3a04c33

Browse files
committed
chore: unify condition names with experimental convention
1 parent b507475 commit 3a04c33

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
handler: async (_request, response, _context) => {
@@ -62,7 +62,7 @@ export const executeInPageTool = definePageTool({
6262
annotations: {
6363
category: ToolCategory.IN_PAGE,
6464
readOnlyHint: false,
65-
conditions: ['inPageTools'],
65+
conditions: ['experimentalInPageTools'],
6666
},
6767
schema: {
6868
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
@@ -89,7 +89,7 @@ export const clickAt = definePageTool({
8989
annotations: {
9090
category: ToolCategory.INPUT,
9191
readOnlyHint: false,
92-
conditions: ['computerVision'],
92+
conditions: ['experimentalVision'],
9393
},
9494
schema: {
9595
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
@@ -29,7 +29,7 @@ export const startScreencast = definePageTool(args => ({
2929
category: ToolCategory.DEBUGGING,
3030
readOnlyHint: false,
3131

32-
conditions: ['screencast'],
32+
conditions: ['experimentalScreencast'],
3333
},
3434
schema: {
3535
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
handler: async (_request, response, context) => {

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)