Skip to main content
Glama
AbdurRaahimm

MCP Terminal & Git Server

by AbdurRaahimm

git_clone

Clone a Git repository to a specified directory path. Optionally open the cloned project in VSCode for immediate development work.

Instructions

Clone a git repository to a specified location

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repositoryUrlYesGit repository URL
destinationYesDestination path where to clone the repository
openInVSCodeNoOpen the cloned repository in VSCode (default: false)

Implementation Reference

  • Handler implementation for the git_clone tool. Clones the specified git repository to the destination path using simple-git, ensures the parent directory exists, resolves paths, and optionally opens the cloned repository in VSCode.
    case "git_clone": {
      const { repositoryUrl, destination, openInVSCode: shouldOpenInVSCode = false } = args as {
        repositoryUrl: string;
        destination: string;
        openInVSCode?: boolean;
      };
      
      const destPath = resolvePath(destination);
      await ensureDirectory(path.dirname(destPath));
      
      await git.clone(repositoryUrl, destPath);
      
      if (shouldOpenInVSCode) {
        await openInVSCode(destPath);
      }
      
      return {
        content: [
          {
            type: "text",
            text: `Successfully cloned ${repositoryUrl} to ${destPath}${shouldOpenInVSCode ? " and opened in VSCode" : ""}`,
          },
        ],
      };
    }
  • Tool schema definition including name, description, and input schema for git_clone, registered in the ListTools response.
    {
      name: "git_clone",
      description: "Clone a git repository to a specified location",
      inputSchema: {
        type: "object",
        properties: {
          repositoryUrl: {
            type: "string",
            description: "Git repository URL",
          },
          destination: {
            type: "string",
            description: "Destination path where to clone the repository",
          },
          openInVSCode: {
            type: "boolean",
            description: "Open the cloned repository in VSCode (default: false)",
          },
        },
        required: ["repositoryUrl", "destination"],
      },
    },
  • Helper function to resolve input paths, handling ~ expansion to home directory, used in git_clone handler.
    function resolvePath(inputPath: string): string {
      if (inputPath.startsWith("~")) {
        return path.join(os.homedir(), inputPath.slice(1));
      }
      return path.resolve(inputPath);
    }
  • Helper function to ensure a directory exists, called in git_clone to create parent dir if needed.
    async function ensureDirectory(dirPath: string): Promise<void> {
      try {
        await fs.mkdir(dirPath, { recursive: true });
      } catch (error) {
        console.error(`Error creating directory ${dirPath}:`, error);
      }
  • Helper function to open a project in VSCode, trying multiple executable paths, used optionally in git_clone.
    async function openInVSCode(projectPath: string): Promise<void> {
      try {
        await execa("code", [projectPath]);
      } catch (error) {
        // If 'code' command fails, try common VSCode executable paths
        const vscodePaths = [
          "code",
          "/usr/local/bin/code",
          "/usr/bin/code",
          "C:\\Program Files\\Microsoft VS Code\\Code.exe",
          "C:\\Program Files (x86)\\Microsoft VS Code\\Code.exe",
        ];
    
        for (const codePath of vscodePaths) {
          try {
            await execa(codePath, [projectPath]);
            return;
          } catch {
            // Continue to next path
          }
        }
        
        throw new Error("VSCode not found. Please ensure VSCode is installed and 'code' command is available in PATH");
      }
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It mentions cloning but lacks details on behavioral traits: it doesn't specify if it overwrites existing directories, requires authentication for private repos, handles errors, or has rate limits. The description is minimal and misses critical operational context for a mutation tool.

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 a single, efficient sentence with zero waste. It's front-loaded with the core action and resource, making it easy to parse. Every word contributes to understanding the tool's purpose without redundancy.

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 the complexity of a git cloning operation (a mutation with potential side effects), no annotations, and no output schema, the description is incomplete. It fails to address key aspects like error handling, success indicators, or integration with sibling tools (e.g., 'open_in_vscode' for the optional parameter). More detail is needed for safe and effective use.

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%, so the schema fully documents the three parameters. The description adds no additional meaning beyond implying a cloning action with a destination. It doesn't explain parameter interactions or provide examples, but the high schema coverage justifies the baseline score of 3.

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

Purpose4/5

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

The description clearly states the action ('Clone') and resource ('a git repository'), specifying the destination ('to a specified location'). It distinguishes from siblings like 'open_in_vscode' by focusing on cloning rather than opening. However, it doesn't explicitly differentiate from other installation tools (e.g., 'install_next_project'), which might be related but serve different purposes.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., git installation), when not to use it (e.g., for existing repositories), or compare it to sibling tools like 'execute_command' for similar tasks. Usage is implied but not explicitly stated.

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

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/AbdurRaahimm/mcp-git-terminal-server'

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