get_git_log
Retrieve recent git commits by author to extract coding activity data 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 main handler function that executes the 'get_git_log' tool logic by running 'git log' on the default repository for the specified author, excluding merge commits, and returning formatted 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 in the MCP server's list_tools handler, including its 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" } } } ),
- Defines the input schema for the 'get_git_log' tool, specifying the optional 'since' parameter as a string with default value.inputSchema={ "type": "object", "properties": { "since": { "type": "string", "description": "Time range for commits", "default": "6 months ago" } }
- Dispatches the tool call to the specific get_git_log handler function within the main @app.call_tool() method.if name == "get_git_log": return await get_git_log(arguments.get("since", "6 months ago"))