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;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states this sets workspace path 'for subsequent commands', implying persistence/statefulness, but doesn't clarify whether this affects the entire session, has side effects, requires specific permissions, or what happens on invalid paths. For a state-changing tool with zero annotation coverage, this is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that communicates the core purpose and usage context without any wasted words. It's appropriately sized for a single-parameter tool and front-loads the essential information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (state-changing configuration), lack of annotations, and no output schema, the description provides minimal but adequate coverage. It explains what the tool does but lacks details about behavioral implications, error conditions, or return values. For a configuration tool with state persistence, more context would be helpful.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents the single parameter ('path') as an absolute workspace directory path. The description doesn't add any parameter-specific semantics beyond what the schema provides. Baseline 3 is appropriate when schema does the documentation work.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Set') and the resource ('current Bazel workspace path'), making the purpose understandable. It distinguishes from siblings by focusing on workspace configuration rather than build/test/query operations. However, it doesn't explicitly contrast with specific sibling tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context ('for subsequent commands'), suggesting this should be called before other Bazel operations. However, it doesn't provide explicit guidance on when to use this vs. alternatives, nor does it mention prerequisites or exclusions. The relationship to sibling tools is only implied.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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