get_git_log_by_repo
Retrieve git commit history from a specified repository to automatically populate CV/resume project sections with recent development activity.
Instructions
Get git commits from a specific repository by name
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| repo_name | Yes | Name of the repository (e.g., 'CompanyA', 'Personal') | |
| since | No | Time range for commits | 6 months ago |
Implementation Reference
- The core handler function that implements the tool logic: validates repo_name, retrieves repo path from config, executes git log command filtered by author and since date, excludes merges, formats output with commit hash, message, and relative date.async def get_git_log_by_repo(repo_name: Optional[str], since: str) -> list[TextContent]: """Get git commits from a specific repository.""" if not repo_name: return [TextContent(type="text", text="Error: repo_name is required")] if not REPO_DICT: return [TextContent(type="text", text="No repositories configured")] if repo_name not in REPO_DICT: available = ", ".join(REPO_DICT.keys()) return [TextContent( type="text", text=f"Repository '{repo_name}' not found.\n\nAvailable repositories: {available}" )] repo_path = REPO_DICT[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=repo_path, capture_output=True, text=True, check=True ) output = result.stdout.strip() return [TextContent( type="text", text=f"Git commits from '{repo_name}' ({repo_path}):\n\n{output if output else 'No commits found'}" )] except subprocess.CalledProcessError as e: return [TextContent(type="text", text=f"Git error for '{repo_name}': {e.stderr}")]
- The tool schema definition including name, description, input schema with repo_name (required) and since (optional, default '6 months ago'), registered in the list_tools() function.Tool( name="get_git_log_by_repo", description="Get git commits from a specific repository by name", inputSchema={ "type": "object", "properties": { "repo_name": { "type": "string", "description": "Name of the repository (e.g., 'CompanyA', 'Personal')" }, "since": { "type": "string", "description": "Time range for commits", "default": "6 months ago" } }, "required": ["repo_name"] } ),
- src/cv_resume_builder_mcp/server.py:315-319 (registration)Tool dispatch/registration in the main call_tool handler: matches tool name and calls the get_git_log_by_repo function with parsed arguments.elif name == "get_git_log_by_repo": return await get_git_log_by_repo( arguments.get("repo_name"), arguments.get("since", "6 months ago") )