remote_remove
Remove a specified remote from a Git repository by providing the repository path and remote name. Supports enhanced Git operations through the Git MCP Server.
Instructions
Remove a remote
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Remote name | |
| path | No | Path to repository. MUST be an absolute path (e.g., /Users/username/projects/my-repo) |
Input Schema (JSON Schema)
{
"properties": {
"name": {
"description": "Remote name",
"type": "string"
},
"path": {
"description": "Path to repository. MUST be an absolute path (e.g., /Users/username/projects/my-repo)",
"type": "string"
}
},
"required": [
"name"
],
"type": "object"
}
Implementation Reference
- src/git-operations.ts:662-690 (handler)Implements the core logic for the remote_remove tool by executing the 'git remote remove' command with proper validation, error handling, caching, and result formatting.static async remoteRemove({ path, name }: RemoteOptions, context: GitToolContext): Promise<GitToolResult> { const resolvedPath = this.getPath({ path }); return await this.executeOperation( context.operation, resolvedPath, async () => { const { path: repoPath } = PathValidator.validateGitRepo(resolvedPath); PathValidator.validateRemoteName(name); const result = await CommandExecutor.executeGitCommand( `remote remove ${name}`, context.operation, repoPath ); return { content: [{ type: 'text', text: `Remote '${name}' removed successfully\n${CommandExecutor.formatOutput(result)}` }] }; }, { command: 'remote_remove', invalidateCache: true, // Invalidate remote cache stateType: RepoStateType.REMOTE } ); }
- src/tool-handler.ts:648-651 (registration)Registers the dispatching logic for the 'remote_remove' tool, validating arguments with isRemoteOptions and delegating to GitOperations.remoteRemove.case 'remote_remove': { const validArgs = this.validateArguments(operation, args, isRemoteOptions); return await GitOperations.remoteRemove(validArgs, context); }
- src/tool-handler.ts:406-422 (schema)Defines the tool schema for 'remote_remove' including input properties for path (optional) and name (required), advertised to MCP clients.name: 'remote_remove', description: 'Remove a remote', inputSchema: { type: 'object', properties: { path: { type: 'string', description: `Path to repository. ${PATH_DESCRIPTION}`, }, name: { type: 'string', description: 'Remote name', }, }, required: ['name'], }, },