Skip to main content
Glama

show

Read-only

View detailed commit information and changes in a Git repository. Specify format, paths, or file status to customize output.

Instructions

Display commit details and changes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commitNoCommit hash, branch, or tag to show (defaults to HEAD)
formatNoPretty-print format for commit
nameOnlyNoShow only names of changed files (--name-only)
nameStatusNoShow names and status of changed files (--name-status)
pathspecNoLimit show to specific paths
repoPathYesAbsolute path to the git repository
statNoShow diffstat (--stat)

Implementation Reference

  • The private #handle method implements the core logic of the 'show' tool. It validates the repo, constructs git show arguments based on input, executes using simple-git, and returns the result as text content.
    readonly #handle: ToolCallback<typeof GIT_SHOW_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',
    				},
    			],
    		};
    	}
    
    	const args: string[] = [];
    
    	if (input.format) {
    		args.push(`--pretty=${input.format}`);
    	}
    
    	if (input.nameOnly) {
    		args.push('--name-only');
    	}
    
    	if (input.nameStatus) {
    		args.push('--name-status');
    	}
    
    	if (input.stat) {
    		args.push('--stat');
    	}
    
    	const commit = input.commit ?? 'HEAD';
    	args.push(commit);
    
    	if (input.pathspec && input.pathspec.length > 0) {
    		args.push('--', ...input.pathspec);
    	}
    
    	const result = await sg.show(args);
    
    	return {
    		content: [
    			{
    				type: 'text',
    				text: result || `No information found for ${commit}`,
    			},
    		],
    	};
    };
  • GIT_SHOW_INPUT_SCHEMA defines the Zod input schema for the 'show' tool, including repoPath, commit, format, and various flags.
    export const GIT_SHOW_INPUT_SCHEMA = {
    	repoPath: z.string().describe('Absolute path to the git repository'),
    	commit: z.string().optional().describe('Commit hash, branch, or tag to show (defaults to HEAD)'),
    	format: z
    		.enum(['oneline', 'short', 'medium', 'full', 'fuller', 'email', 'raw'])
    		.optional()
    		.describe('Pretty-print format for commit'),
    	nameOnly: z.boolean().optional().describe('Show only names of changed files (--name-only)'),
    	nameStatus: z.boolean().optional().describe('Show names and status of changed files (--name-status)'),
    	stat: z.boolean().optional().describe('Show diffstat (--stat)'),
    	pathspec: z.array(z.string()).optional().describe('Limit show to specific paths'),
    };
  • new GitShowTool().register(server); registers the 'show' tool with the MCP server.
    new GitShowTool().register(server);
  • The register method on GitShowTool calls srv.registerTool(this.name, this.config, this.#handle) to register the tool.
    register(srv: McpServer) {
    	srv.registerTool(this.name, this.config, this.#handle);
    }
  • The name getter returns 'show', defining the tool's name.
    get name() {
    	return 'show';
    }
Behavior3/5

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

Annotations already declare readOnlyHint=true, so the agent knows this is a safe read operation. The description adds minimal behavioral context beyond this - it mentions 'displaying' but doesn't elaborate on output format, pagination, or error conditions. With annotations covering the safety profile, this meets baseline expectations without adding significant value.

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 perfectly concise - a single sentence that immediately communicates the core functionality without any wasted words. It's front-loaded with the essential information and doesn't include unnecessary elaboration or repetition.

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 tool's moderate complexity (7 parameters, Git operations) and the absence of an output schema, the description is minimally adequate. It identifies what the tool does but lacks information about return values, error conditions, or how it fits within the broader Git workflow. The annotations help but don't fully compensate for these gaps.

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 all parameters are well-documented in the schema itself. The description doesn't add any meaningful parameter semantics beyond what's already in the schema descriptions - it doesn't explain parameter interactions, default behaviors, or usage patterns. This meets the baseline for high schema 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 verb ('Display') and resource ('commit details and changes'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'diff' or 'log' which also show commit-related information, 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 'diff' (for comparing changes) or 'log' (for viewing commit history). There's no mention of prerequisites, typical use cases, or exclusion criteria, leaving the agent with insufficient context for tool selection.

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