Skip to main content
Glama

remote_add

Enable AI assistants to add a Git remote by specifying the repository path, remote name, and URL for enhanced repository management via the Git MCP Server.

Instructions

Add a remote

Input Schema

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

Implementation Reference

  • The primary handler function in GitOperations class that executes the 'git remote add' command. It validates the repository path, remote name, and URL, runs the git command via CommandExecutor, handles caching invalidation, and formats the success response.
    static async remoteAdd({ path, name, url }: 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);
          if (!url) {
            throw ErrorHandler.handleValidationError(
              new Error('URL is required when adding a remote'),
              { operation: context.operation, path: repoPath }
            );
          }
          PathValidator.validateRemoteUrl(url);
          
          const result = await CommandExecutor.executeGitCommand(
            `remote add ${name} ${url}`,
            context.operation,
            repoPath
          );
    
          return {
            content: [{
              type: 'text',
              text: `Remote '${name}' added successfully\n${CommandExecutor.formatOutput(result)}`
            }]
          };
        },
        {
          command: 'remote_add',
          invalidateCache: true, // Invalidate remote cache
          stateType: RepoStateType.REMOTE
        }
      );
    }
  • Registration and dispatch logic in ToolHandler's CallToolRequest handler switch statement. Validates arguments using isRemoteOptions type guard and delegates to GitOperations.remoteAdd.
    case 'remote_add': {
      const validArgs = this.validateArguments(operation, args, isRemoteOptions);
      return await GitOperations.remoteAdd(validArgs, context);
    }
  • JSON schema definition for the 'remote_add' tool provided to MCP clients via ListToolsRequest. Specifies input parameters: path (optional), name and url (required).
    name: 'remote_add',
    description: 'Add a remote',
    inputSchema: {
      type: 'object',
      properties: {
        path: {
          type: 'string',
          description: `Path to repository. ${PATH_DESCRIPTION}`,
        },
        name: {
          type: 'string',
          description: 'Remote name',
        },
        url: {
          type: 'string',
          description: 'Remote URL',
        },
      },
      required: ['name', 'url'],
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden for behavioral disclosure. 'Add a remote' implies a write/mutation operation, but it doesn't specify whether this requires specific permissions, what happens on success/failure, if it's idempotent, or any side effects. For a mutation tool with zero annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with a single phrase 'Add a remote', which is front-loaded and wastes no words. While it may be under-specified, it's not verbose or poorly structured—every word earns its place by stating the core action.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given this is a mutation tool with no annotations and no output schema, the description is incomplete. It doesn't explain what a 'remote' is in context, what the tool returns, error conditions, or how it interacts with sibling tools. For a 3-parameter tool that modifies state, more context is needed to be fully helpful to an agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with clear descriptions for all three parameters (name, path, url). The description adds no additional parameter semantics beyond what the schema already provides, such as explaining relationships between parameters or usage examples. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Add a remote' is a tautology that restates the tool name without specifying what a 'remote' is or what resource it operates on. While it implies a Git repository context from sibling tools, it doesn't distinguish this tool from other remote-related tools like 'remote_list' or 'remote_remove' beyond the basic verb. It's minimally better than just 'Process' but still vague about purpose.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like 'remote_list' or 'remote_remove', nor any prerequisites or context for adding a remote. The description doesn't mention when this operation is appropriate or what scenarios it addresses, leaving usage entirely to inference from the tool name and sibling list.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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