git_branch_explained
Understand Git branch workflows by visualizing branches with clear explanations to manage development processes effectively.
Instructions
Show branches with explanation of branch workflow
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "git_branch_explained"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.js:81-103 (registration)MCP server.tool registration for 'git_branch_explained' tool, including empty input schema, description, and inline handler function.
"git_branch_explained", "Show branches with explanation of branch workflow", {}, async () => { const result = await runCommand("git branch -a"); if (!result.success) { return { content: [{ type: "text", text: `Error: ${result.error}` }] }; } let output = `BRANCHES:\n${result.stdout}\n\n`; output += `BRANCH WORKFLOW:\n`; output += `1. main/master - Production code. Never commit directly here.\n`; output += `2. develop - Integration branch (if used). Features merge here first.\n`; output += `3. feature/* - Your working branches. Create with:\n`; output += ` git checkout -b feature/my-feature-name\n\n`; output += `TO CREATE A NEW BRANCH:\n`; output += ` git checkout -b feature/your-feature-name\n\n`; output += `TO SWITCH BRANCHES:\n`; output += ` git checkout branch-name\n`; return { content: [{ type: "text", text: output }] }; } ); - src/tools.js:80-98 (handler)Exported handler function gitBranchExplained (identical logic, likely for testing purposes). Uses commandRunner helper.
export async function gitBranchExplained() { const result = await commandRunner("git branch -a"); if (!result.success) { return { content: [{ type: "text", text: `Error: ${result.error}` }] }; } let output = `BRANCHES:\n${result.stdout}\n\n`; output += `BRANCH WORKFLOW:\n`; output += `1. main/master - Production code. Never commit directly here.\n`; output += `2. develop - Integration branch (if used). Features merge here first.\n`; output += `3. feature/* - Your working branches. Create with:\n`; output += ` git checkout -b feature/my-feature-name\n\n`; output += `TO CREATE A NEW BRANCH:\n`; output += ` git checkout -b feature/your-feature-name\n\n`; output += `TO SWITCH BRANCHES:\n`; output += ` git checkout branch-name\n`; return { content: [{ type: "text", text: output }] }; } - src/tools.js:579-579 (registration)Inclusion in the exported 'tools' object (possibly for alternative registration or testing).
gitBranchExplained, - src/index.js:18-25 (helper)Shared runCommand helper used by the git_branch_explained handler to execute shell commands safely.
async function runCommand(cmd, options = {}) { try { const { stdout, stderr } = await execAsync(cmd, { timeout: 30000, ...options }); return { success: true, stdout: stdout.trim(), stderr: stderr.trim() }; } catch (error) { return { success: false, error: error.message, stdout: error.stdout?.trim(), stderr: error.stderr?.trim() }; } } - src/index.js:83-83 (schema)Empty input schema object indicating the tool takes no parameters.
{},