Skip to main content
Glama

add

Stage files in a Git repository by specifying the repository path and file paths. Simplify Git workflows and prepare changes for commits efficiently.

Instructions

Add files to the git staging area.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filesYesList of pathspecs to add
repoPathYesAbsolute path to the git repository

Implementation Reference

  • The private handler method that implements the core logic of the 'add' tool: validates the repository, executes git add on the input files using simple-git, and returns success or error message.
    readonly #handle: ToolCallback<typeof GIT_ADD_INPUT_SCHEMA> = async (input) => {
    	const sg = simpleGit(input.repoPath);
    
    	const isRepo = await sg.checkIsRepo();
    	if (!isRepo) {
    		return {
    			isError: true,
    			content: [
    				{
    					type: 'text',
    					text: 'Not a git repository',
    				},
    			],
    		};
    	}
    
    	// Execute git add
    	await sg.add(input.files);
    
    	return {
    		content: [
    			{
    				type: 'text',
    				text: `Files added to staging area.`,
    			},
    		],
    	};
    };
  • Zod input schema defining the parameters for the 'add' tool: repository path and list of files to add.
    export const GIT_ADD_INPUT_SCHEMA = {
    	repoPath: z.string().describe('Absolute path to the git repository'),
    	files: z.array(z.string()).describe('List of pathspecs to add'),
    };
  • The register method of GitAddTool class that registers the tool with the MCP server using its name ('add'), config, and handler.
    register(srv: McpServer) {
    	srv.registerTool(this.name, this.config, this.#handle);
    }
  • Instantiation of GitAddTool and call to its register method on the MCP server instance, effectively registering the 'add' tool.
    new GitAddTool().register(server);
  • Getter that returns the tool name 'add' used during registration.
    get name() {
    	return 'add';
    }
Behavior3/5

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

Annotations provide readOnlyHint=false (indicating mutation), and the description adds that this modifies 'the git staging area' - useful context about what gets changed. However, it doesn't disclose important behavioral details like whether this is idempotent, what happens with invalid pathspecs, or if there are side effects beyond staging.

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 that communicates the core purpose without any wasted words. It's appropriately sized for a simple tool with only two parameters.

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

Completeness3/5

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

For a mutation tool with no output schema, the description adequately covers the basic operation but lacks important context about what happens after staging (e.g., need to commit), error conditions, or typical usage patterns. The annotations provide some safety context but more behavioral detail would be helpful.

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?

With 100% schema description coverage, both parameters are already documented in the schema. The description doesn't add any additional semantic context about parameters beyond what's in the schema descriptions, meeting the baseline for high coverage.

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 ('Add files') and target ('to the git staging area'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'commit' or 'reset' which also interact with the staging area, preventing a perfect score.

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 like 'commit' (which moves staged changes to repository) or 'reset' (which can unstage changes). There's no mention of prerequisites, typical workflow context, or exclusions.

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/ver0-project/mcps'

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