Skip to main content
Glama

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
NameRequiredDescriptionDefault
targetsNoList of specific targets to fetch dependencies for
additionalArgsNoAdditional Bazel command line arguments (e.g. ['--experimental_repository_cache_hardlinks', '--repository_cache=path/to/cache'])

Implementation Reference

  • 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}`; }
  • 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, ],
  • TypeScript interface defining the input arguments for the bazel_fetch_dependencies tool.
    interface FetchDependenciesArgs { targets?: string[]; additionalArgs?: string[]; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nacgarg/bazel-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server