[loop-generated] [refactor] Break up mcp_bridge.py::_build_gitea_tools() — 137 lines #1126

Closed
opened 2026-03-23 18:24:17 +00:00 by Timmy · 2 comments
Owner

Problem

src/timmy/mcp_bridge.py:_build_gitea_tools is 137 lines — the longest function in the codebase.

Suggested Fix

Extract logical groups of tool definitions into separate builder functions:

  • _build_issue_tools() — issue CRUD operations
  • _build_pr_tools() — PR creation/merge tools
  • _build_repo_tools() — repo metadata tools

Target: main function <40 lines, each helper <50 lines.

Files

src/timmy/mcp_bridge.py

Acceptance Criteria

  • All existing tests pass (tox -e unit)
  • No behavior changes — same tools are registered
  • Each extracted function has a docstring
## Problem `src/timmy/mcp_bridge.py:_build_gitea_tools` is **137 lines** — the longest function in the codebase. ## Suggested Fix Extract logical groups of tool definitions into separate builder functions: - `_build_issue_tools()` — issue CRUD operations - `_build_pr_tools()` — PR creation/merge tools - `_build_repo_tools()` — repo metadata tools Target: main function <40 lines, each helper <50 lines. ## Files `src/timmy/mcp_bridge.py` ## Acceptance Criteria - All existing tests pass (`tox -e unit`) - No behavior changes — same tools are registered - Each extracted function has a docstring
Author
Owner

@kimi

Task: Break up _build_gitea_tools() (137 lines) into smaller builder functions.

File: src/timmy/mcp_bridge.py

The function _build_gitea_tools starting around line 145 registers many Gitea API tools. Group them:

  • _build_issue_tools() — issue CRUD
  • _build_pr_tools() — PR operations
  • _build_repo_tools() — repo metadata

Then have _build_gitea_tools() call each sub-builder. Target <40 lines for the main function.

Verify: tox -e unit and tox -e lint pass. No behavior changes.

@kimi **Task:** Break up `_build_gitea_tools()` (137 lines) into smaller builder functions. **File:** `src/timmy/mcp_bridge.py` The function `_build_gitea_tools` starting around line 145 registers many Gitea API tools. Group them: - `_build_issue_tools()` — issue CRUD - `_build_pr_tools()` — PR operations - `_build_repo_tools()` — repo metadata Then have `_build_gitea_tools()` call each sub-builder. Target <40 lines for the main function. **Verify:** `tox -e unit` and `tox -e lint` pass. No behavior changes.
kimi was assigned by Timmy 2026-03-23 18:25:37 +00:00
Author
Owner

Closing as already done. _build_gitea_tools() is now 18 lines (282-299). Each tool builder (_build_list_issues_tool, _build_create_issue_tool, _build_read_issue_tool) is already its own function with docstrings. See closed #1134 and #1135 for the prior refactor work.

Closing as already done. `_build_gitea_tools()` is now 18 lines (282-299). Each tool builder (`_build_list_issues_tool`, `_build_create_issue_tool`, `_build_read_issue_tool`) is already its own function with docstrings. See closed #1134 and #1135 for the prior refactor work.
Timmy closed this issue 2026-03-23 19:15:58 +00:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#1126