get_git_log
Retrieve recent Git commits by author to extract project contributions for CV/resume building, excluding merge commits.
Instructions
Get latest git commits by author from default repo (excludes merge commits)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| since | No | Time range for commits | 6 months ago |
Implementation Reference
- The handler function that runs 'git log' on the default repository for the specified author, excluding merges, since the given time, formats the output, and returns it as TextContent.async def get_git_log(since: str) -> list[TextContent]: """Get git commits by author from first/default repo.""" # Get first repo (usually 'default' or first configured) if not REPO_DICT: return [TextContent(type="text", text="No repositories configured")] first_repo_name = list(REPO_DICT.keys())[0] first_repo_path = REPO_DICT[first_repo_name] try: cmd = [ "git", "log", f"--author={AUTHOR_NAME}", "--no-merges", f"--since={since}", "--pretty=format:%h - %s (%cr)" ] result = subprocess.run( cmd, cwd=first_repo_path, capture_output=True, text=True, check=True ) output = result.stdout.strip() repo_label = f"'{first_repo_name}'" if first_repo_name != "default" else "default repo" return [TextContent( type="text", text=f"Git commits from {repo_label}:\n\n{output if output else 'No commits found'}" )] except subprocess.CalledProcessError as e: return [TextContent(type="text", text=f"Git error: {e.stderr}")]
- src/cv_resume_builder_mcp/server.py:102-115 (registration)Registers the get_git_log tool with the MCP server in the list_tools handler, including name, description, and input schema.Tool( name="get_git_log", description="Get latest git commits by author from default repo (excludes merge commits)", inputSchema={ "type": "object", "properties": { "since": { "type": "string", "description": "Time range for commits", "default": "6 months ago" } } } ),
- Input schema defining the 'since' parameter as a string with default '6 months ago'.inputSchema={ "type": "object", "properties": { "since": { "type": "string", "description": "Time range for commits", "default": "6 months ago" } }
- Dispatch logic in call_tool that invokes the get_git_log handler with the 'since' argument.if name == "get_git_log": return await get_git_log(arguments.get("since", "6 months ago"))