bazel_fetch_dependencies
Fetch external dependencies for Bazel build targets to ensure required resources are available before building or testing.
Instructions
Fetch Bazel external dependencies
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| targets | No | List of specific targets to fetch dependencies for | |
| additionalArgs | No | Additional Bazel command line arguments (e.g. ['--experimental_repository_cache_hardlinks', '--repository_cache=path/to/cache']) |
Implementation Reference
- index.ts:345-357 (handler)Core handler function in BazelClient that executes the bazel_fetch_dependencies tool by running 'bazel build fetch //...' or specific targets with validation.async fetchDependencies(targets?: string[], additionalArgs?: string[], onOutput?: (chunk: string) => void): Promise<string> { const validatedArgs = this.validateAdditionalArgs(additionalArgs); const args = ["fetch"]; if (targets && targets.length > 0) { args.push(...targets); } else { args.push("//..."); } args.push(...validatedArgs); const { stdout, stderr } = await this.runBazelCommand("build", args, onOutput); return `${stdout}\n${stderr}`; }
- index.ts:164-186 (schema)Tool schema definition including name, description, and inputSchema for bazel_fetch_dependencies.const fetchDependenciesTool: Tool = { name: "bazel_fetch_dependencies", description: "Fetch Bazel external dependencies", inputSchema: { type: "object", properties: { targets: { type: "array", items: { type: "string", }, description: "List of specific targets to fetch dependencies for", }, additionalArgs: { type: "array", items: { type: "string", }, description: "Additional Bazel command line arguments (e.g. ['--experimental_repository_cache_hardlinks', '--repository_cache=path/to/cache'])", }, }, }, };
- index.ts:562-567 (registration)Registration of the tool handler in the CallToolRequest switch statement, dispatching to the fetchDependencies method.case "bazel_fetch_dependencies": { const args = request.params.arguments as unknown as FetchDependenciesArgs; log(`Processing bazel_fetch_dependencies`, 'info', false); response = await bazelClient.fetchDependencies(args.targets, args.additionalArgs); break; }
- index.ts:608-615 (registration)Registration of the tool in the ListToolsRequest handler response, including it in the available tools list.tools: [ buildTargetTool, queryTargetTool, testTargetTool, listTargetsTool, fetchDependenciesTool, setWorkspacePathTool, ],
- index.ts:60-63 (schema)TypeScript interface defining the input arguments for the bazel_fetch_dependencies tool.interface FetchDependenciesArgs { targets?: string[]; additionalArgs?: string[]; }