Skip to main content
Glama

bazel_set_workspace_path

Set the Bazel workspace path to enable building, testing, and managing projects through subsequent commands.

Instructions

Set the current Bazel workspace path for subsequent commands

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesThe absolute path to the Bazel workspace directory

Implementation Reference

  • Core handler function that validates the new workspace path (existence and Bazel files) and updates the BazelClient's workspacePath property.
    setWorkspacePath(newPath: string): string { if (!fs.existsSync(newPath)) { throw new Error(`Workspace path does not exist: ${newPath}`); } // Check if it appears to be a Bazel workspace const isWorkspace = fs.existsSync(path.join(newPath, 'WORKSPACE')) || fs.existsSync(path.join(newPath, 'WORKSPACE.bazel')) || fs.existsSync(path.join(newPath, 'MODULE.bazel')); if (!isWorkspace) { throw new Error(`Path does not appear to be a Bazel workspace: ${newPath}`); } const oldPath = this.workspacePath; this.workspacePath = newPath; return `Workspace path updated from ${oldPath} to ${newPath}`; }
  • Defines the tool's metadata, description, and input schema for validation (requires 'path' string).
    const setWorkspacePathTool: Tool = { name: "bazel_set_workspace_path", description: "Set the current Bazel workspace path for subsequent commands", inputSchema: { type: "object", properties: { path: { type: "string", description: "The absolute path to the Bazel workspace directory", }, }, required: ["path"], }, };
  • index.ts:569-577 (registration)
    Registration and dispatch in the CallToolRequest handler switch statement; casts arguments and calls the core handler.
    case "bazel_set_workspace_path": { const args = request.params.arguments as unknown as SetWorkspacePathArgs; log(`Processing bazel_set_workspace_path to: ${args.path}`, 'info', false); if (!args.path) { throw new Error("Missing required argument: path"); } response = bazelClient.setWorkspacePath(args.path); break; }
  • index.ts:608-615 (registration)
    Tool is registered/returned in the ListToolsRequest response as part of the available tools list.
    tools: [ buildTargetTool, queryTargetTool, testTargetTool, listTargetsTool, fetchDependenciesTool, setWorkspacePathTool, ],
  • Type definition for tool arguments used in the handler.
    interface SetWorkspacePathArgs { path: 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