Skip to main content
Glama

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

TableJSON Schema
NameRequiredDescriptionDefault
nameYesRemote name
pathNoPath to repository. MUST be an absolute path (e.g., /Users/username/projects/my-repo)

Implementation Reference

  • 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
        }
      );
    }
  • 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);
    }
  • 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'],
      },
    },

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/Sheshiyer/git-mcp-v2'

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