MCPcopy Index your code
hub / github.com/getsentry/XcodeBuildMCP / registerToolsCommand

Function registerToolsCommand

src/cli/commands/tools.ts:164–271  ·  view source on GitHub ↗
(app: Argv)

Source from the content-addressed store, hash-verified

162 * Register the 'tools' command for listing available tools.
163 */
164export function registerToolsCommand(app: Argv): void {
165 app.command(
166 'tools',
167 'List available tools',
168 (yargs) => {
169 return yargs
170 .option('flat', {
171 alias: 'f',
172 type: 'boolean',
173 default: false,
174 describe: 'Show flat list instead of grouped by workflow',
175 })
176 .option('verbose', {
177 alias: 'v',
178 type: 'boolean',
179 default: false,
180 describe: 'Show full descriptions',
181 })
182 .option('json', {
183 type: 'boolean',
184 default: false,
185 describe: 'Output as JSON',
186 })
187 .option('workflow', {
188 alias: 'w',
189 type: 'string',
190 describe: 'Filter by workflow name',
191 });
192 },
193 async (argv) => {
194 const manifest = loadManifest();
195 let tools = await buildToolList(manifest);
196
197 // Filter by workflow if specified
198 if (argv.workflow) {
199 const workflowFilter = (argv.workflow as string).toLowerCase();
200 tools = tools.filter((t) => t.workflow.toLowerCase() === workflowFilter);
201 }
202
203 if (argv.json) {
204 if (argv.flat) {
205 const flatTools = [...tools]
206 .sort((a, b) => {
207 const aKey = `${a.workflow} ${a.cliName}`;
208 const bKey = `${b.workflow} ${b.cliName}`;
209 return aKey.localeCompare(bKey);
210 })
211 .map((tool) => toFlatJsonTool(tool));
212
213 const canonicalCount = flatTools.filter((t) => !t.canonicalWorkflow).length;
214 writeLine(
215 JSON.stringify(
216 {
217 canonicalToolCount: canonicalCount,
218 toolCount: flatTools.length,
219 tools: flatTools,
220 },
221 null,

Callers 1

buildYargsAppFunction · 0.90

Calls 8

loadManifestFunction · 0.90
formatToolListFunction · 0.90
buildToolListFunction · 0.85
toFlatJsonToolFunction · 0.85
toGroupedJsonToolFunction · 0.85
getMethod · 0.80
pushMethod · 0.80
writeLineFunction · 0.70

Tested by

no test coverage detected