git_commit
Commit staged changes in a Git repository using a specified message and optional working directory path.
Instructions
Commit staged changes
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| message | Yes | Commit message | |
| cwd | No | Repository path |
Implementation Reference
- src/services/GitService.ts:273-277 (handler)Core handler for the 'git_commit' tool. Executes 'git commit -m <message>' via gitCommand and validates the 'message' argument is present.
async gitCommit(args: GitCommitArgs): Promise<ToolResult> { const { message, cwd } = args; ValidationUtils.validateRequired({ message }, ['message']); return await this.gitCommand(['commit', '-m', message], cwd); } - src/services/GitService.ts:29-31 (schema)Type definition GitCommitArgs interface: extends GitCommandArgs with required 'message' string property.
export interface GitCommitArgs extends GitCommandArgs { message: string; } - src/index.ts:191-192 (registration)Routes the 'git_commit' tool name to GitService.gitCommit() in the main handler switch statement.
case 'git_commit': return await this.gitService.gitCommit(args as GitCommitArgs); - src/toolDefinitions.ts:261-272 (schema)Input schema definition for 'git_commit' tool: requires 'message' string, optional 'cwd' string.
{ name: 'git_commit', description: 'Commit staged changes', inputSchema: { type: 'object', properties: { message: { type: 'string', description: 'Commit message' }, cwd: { type: 'string', description: 'Repository path' }, }, required: ['message'], }, }, - src/types.ts:113-118 (helper)GitCommit interface in types.ts: defines the shape of a commit object (hash, author, date, message).
export interface GitCommit { hash: string; author: string; date: string; message: string; }