get_workspace_info
Retrieve workspace details including root path, operating system, Node.js version, and git status summary.
Instructions
Get information about the current workspace: root directory, platform, Node version, git status summary.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workspace_root | No | Workspace root directory (optional) |
Implementation Reference
- src/index.ts:302-311 (registration)Registration of the 'get_workspace_info' tool in the tools list, including its description and inputSchema (with optional workspace_root property).
{ name: "get_workspace_info", description: "Get information about the current workspace: root directory, platform, Node version, git status summary.", inputSchema: { type: "object", properties: { workspace_root: { type: "string", description: "Workspace root directory (optional)" }, }, }, }, - src/index.ts:551-571 (handler)Handler for 'get_workspace_info' tool. Extracts workspace root (or uses cwd), retrieves git branch and status via shell commands, then returns workspace info including root, platform, node_version, git_branch, and git_status as JSON.
case "get_workspace_info": { const root = (a.workspace_root as string | undefined) ?? process.cwd(); let gitBranch = "N/A"; let gitStatus = "N/A"; try { const { stdout: branch } = await execAsync("git rev-parse --abbrev-ref HEAD", { cwd: root }); gitBranch = branch.trim(); const { stdout: status } = await execAsync("git status --short", { cwd: root }); gitStatus = status.trim() || "clean"; } catch { // not a git repo } const info = { workspace_root: root, platform: process.platform, node_version: process.version, git_branch: gitBranch, git_status: gitStatus, }; return { content: [{ type: "text", text: JSON.stringify(info, null, 2) }] }; }