Skip to main content
Glama

git_config

Set up or modify Git repository configurations by specifying the repository path, scope, and key-value pairs to adjust settings as needed.

Instructions

Configure git settings for the repository.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYesConfiguration key
repo_pathYesThe path to the local Git repository
scopeNoConfiguration scope (local, global, system)local
valueYesConfiguration value

Implementation Reference

  • Core implementation of the git_config tool handler using simpleGit to set git configuration.
    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, }; } }
  • JSON Schema defining the input parameters and validation for the git_config tool.
    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)
    Registers the git_config tool name to its handler in the central handlersMap used for tool execution.
    git_config: handleGitConfig,
  • Re-exports the handleGitConfig function from config-operations.js for use in server.js.
    handleGitConfig,
  • Categorizes git_config under 'config' tools for organized listing and discoverability.
    config: ["git_config"],

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/bsreeram08/git-commands-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server