Skip to main content
Glama

get_changed_files

List files changed since a specified git base to understand the scope of recent modifications.

Instructions

List files changed since a base ref (default: HEAD~1). Useful to understand scope of recent changes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
baseNo

Implementation Reference

  • The core implementation: runs `git diff --name-status <base> HEAD` and parses output into ChangedFile objects with path and status (added, modified, deleted, renamed). Defaults base to 'HEAD~1'.
    async function getChangedFiles(repoDir: string, base?: string): Promise<ChangedFile[]> {
      const ref = base ?? 'HEAD~1';
      const { stdout } = await execFileAsync('git', [
        '-C',
        repoDir,
        'diff',
        '--name-status',
        ref,
        'HEAD',
      ]);
    
      return stdout
        .trim()
        .split('\n')
        .filter(Boolean)
        .map((line) => {
          const [rawStatus, ...parts] = line.split('\t');
          const path = parts[parts.length - 1] ?? '';
          const statusChar = (rawStatus ?? '')[0] ?? 'M';
          const statusMap: Record<string, ChangedFile['status']> = {
            A: 'added',
            M: 'modified',
            D: 'deleted',
            R: 'renamed',
          };
          return {
            path,
            status: statusMap[statusChar] ?? 'modified',
          };
        });
    }
  • Manager layer that combines git.getBranchContext and git.getChangedFiles in parallel, returning both context and changed files.
    async function getChangedFiles(base?: string): Promise<BranchManagerResult> {
      const [context, changedFiles] = await Promise.all([
        git.getBranchContext(repoDir),
        git.getChangedFiles(repoDir, base),
      ]);
      return { context, changedFiles };
    }
  • MCP tool handler that registers 'get_changed_files' via server.tool, calls manager.getChangedFiles(args.base), and returns JSON-stringified result.
    server.tool('get_changed_files', 'List files changed since a base ref (default: HEAD~1). Useful to understand scope of recent changes.', GetChangedFilesSchema.shape, async (args) => {
      const result = await manager.getChangedFiles(args.base);
      return {
        content: [{ type: 'text' as const, text: JSON.stringify(result, null, 2) }],
      };
    });
  • Zod schema defining optional 'base' string parameter (defaults to HEAD~1).
    export const GetChangedFilesSchema = z.object({
      base: z.string().optional(),
    });
  • ChangedFile interface with path and status type (added/modified/deleted/renamed).
    export interface ChangedFile {
      path: string;
      status: 'added' | 'modified' | 'deleted' | 'renamed';
    }
Behavior2/5

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

No annotations are provided, so the description must fully describe behavior. It only indicates the tool lists changed files with a default base ref, but does not disclose whether it is read-only, permission requirements, or return format. This is minimal for a tool that likely involves git operations.

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?

Two sentences, no filler. The first sentence defines the core functionality, and the second provides a use case. Every word earns its place, making it easy to parse.

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?

Given the single parameter and lack of annotations or output schema, the description is sufficient for basic understanding but incomplete. It does not specify what the output looks like (e.g., file paths only?), or whether other git refs (tags, commits) are valid inputs beyond commits.

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

Parameters4/5

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

The input schema has one parameter 'base' with no description (0% coverage). The description adds meaning by stating the default value (HEAD~1) and context ('base ref'), which helps the agent understand the parameter's purpose beyond the raw schema.

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

Purpose5/5

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

The description clearly states the tool lists files changed since a base ref with a default of HEAD~1. It uses specific verb 'list' and resource 'files changed', distinguishing it from siblings like 'get_git_diff' (which likely shows diffs) and 'mine_changed_files' (which may have advanced filtering).

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

Usage Guidelines3/5

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

The description mentions it is 'useful to understand scope of recent changes,' implying when to use it. However, it does not explicitly exclude other usages or compare with sibling tools, leaving ambiguity about alternatives like 'get_all_changes' or 'get_git_diff'.

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/2loch-ness6/mempalace-mcp-dev'

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