git_config
Configure Git repository settings by setting or updating configuration keys and values for local, global, or system scopes to customize repository behavior.
Instructions
Configure git settings for the repository.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| repo_path | Yes | The path to the local Git repository | |
| scope | No | Configuration scope (local, global, system) | local |
| key | Yes | Configuration key | |
| value | Yes | Configuration value |
Implementation Reference
- src/handlers/config-operations.js:11-56 (handler)Main handler function that sets Git configuration for the repository using simpleGit.addConfig and returns formatted success or error response.export async function handleGitConfig({ repo_path, scope = "local", key, value, }) { try { const git = simpleGit(repo_path); // Set the configuration await git.addConfig(key, value, false, scope); return { content: [ { type: "text", text: JSON.stringify( { success: true, message: `Set ${scope} config ${key}=${value}`, key: key, value: value, scope: scope, }, null, 2 ), }, ], }; } catch (error) { return { content: [ { type: "text", text: JSON.stringify( { error: `Failed to set git config: ${error.message}` }, null, 2 ), }, ], isError: true, }; } }
- src/server.js:564-591 (schema)Input schema definition for the git_config tool, specifying parameters repo_path, scope, key, and value.{ name: "git_config", description: "Configure git settings for the repository.", inputSchema: { type: "object", properties: { repo_path: { type: "string", description: "The path to the local Git repository", }, scope: { type: "string", description: "Configuration scope (local, global, system)", default: "local", enum: ["local", "global", "system"], }, key: { type: "string", description: "Configuration key", }, value: { type: "string", description: "Configuration value", }, }, required: ["repo_path", "key", "value"], }, },
- src/server.js:917-917 (registration)Maps the 'git_config' tool name to the handleGitConfig handler function in the handlersMap.git_config: handleGitConfig,
- src/handlers/index.js:28-28 (registration)Imports the handleGitConfig function from config-operations.js for re-export.import { handleGitConfig } from "./config-operations.js";
- src/handlers/index.js:75-76 (registration)Re-exports handleGitConfig as part of the handlers index module.// Config operations handleGitConfig,