MCPcopy Create free account
hub / github.com/ChromeDevTools/chrome-devtools-mcp / getToolStatusInfo

Function getToolStatusInfo

src/ToolHandler.ts:74–118  ·  view source on GitHub ↗
(
  tool: ToolDefinition | DefinedPageTool,
  serverArgs: ReturnType<typeof parseArguments>,
)

Source from the content-addressed store, hash-verified

72}
73
74function getToolStatusInfo(
75 tool: ToolDefinition | DefinedPageTool,
76 serverArgs: ReturnType<typeof parseArguments>,
77): {disabled: boolean; reason?: string} {
78 const category = tool.annotations.category;
79 const categoryCheck = getCategoryStatus(category, serverArgs);
80
81 if (category && categoryCheck.disabled) {
82 if (!categoryCheck.categoryFlag) {
83 throw new Error(
84 'when the category is disabled there should always be a flag set',
85 );
86 }
87
88 return {
89 disabled: true,
90 reason: buildDisabledMessage(
91 tool.name,
92 `--${categoryCheck.categoryFlag}`,
93 labels[category!],
94 ),
95 };
96 }
97
98 for (const condition of tool.annotations.conditions || []) {
99 const conditionCheck = getConditionStatus(condition, serverArgs);
100 if (conditionCheck.disabled) {
101 if (!conditionCheck.conditionFlag) {
102 throw new Error(
103 'when the condition is disabled there should always be a flag set',
104 );
105 }
106
107 return {
108 disabled: true,
109 reason: buildDisabledMessage(
110 tool.name,
111 `--${conditionCheck.conditionFlag}`,
112 ),
113 };
114 }
115 }
116
117 return {disabled: false};
118}
119
120function isPageScopedTool(
121 tool: ToolDefinition | DefinedPageTool,

Callers 1

constructorMethod · 0.85

Calls 3

getCategoryStatusFunction · 0.85
buildDisabledMessageFunction · 0.85
getConditionStatusFunction · 0.85

Tested by

no test coverage detected