2222from base_agent import BaseAgent , TInputSchema , TOutputSchema
2323from constants import COMMIT_PREFIX , BRANCH_PREFIX
2424from observability import setup_observability
25- from tools import ShellCommandTool
25+ from tools . shell_command import ShellCommandTool
2626from triage_agent import RebaseData , ErrorData
27- from utils import redis_client , get_git_finalization_steps
27+ from utils import mcp_tools , redis_client , get_git_finalization_steps
2828
2929logger = logging .getLogger (__name__ )
3030
@@ -45,6 +45,10 @@ class InputSchema(BaseModel):
4545 git_email : str = Field (
4646 description = "E-mail address of the git user" ,
default = "[email protected] " 4747 )
48+ git_repo_basepath : str = Field (
49+ description = "Base path for cloned git repos" ,
50+ default = os .getenv ("GIT_REPO_BASEPATH" ),
51+ )
4852
4953
5054class OutputSchema (BaseModel ):
@@ -113,7 +117,6 @@ def prompt(self) -> str:
113117 * The Git user's email address is {{ git_email }}
114118 * Use {{ gitlab_user }} as the GitLab user.
115119 * Work only in a temporary directory that you can create with the mktemp tool.
116- * To create forks and open merge requests, always use GitLab's `glab` CLI tool.
117120 * You can find packaging guidelines at https://docs.fedoraproject.org/en-US/packaging-guidelines/
118121 * You can find the RPM packaging guide at https://rpm-packaging-guide.github.io/.
119122 * Do not run the `centpkg new-sources` command for now (testing purposes), just write down the commands you would run.
@@ -137,9 +140,8 @@ def prompt(self) -> str:
137140 * Do not clone any repository for detecting the version in .spec file.
138141
139142 3. Create a local Git repository by following these steps:
140- * Check if the fork already exists for {{ gitlab_user }} as {{ gitlab_user }}/{{ package }} and if not,
141- create a fork of the {{ package }} package using the glab tool.
142- * Clone the fork using git and HTTPS into the temp directory.
143+ * Create a fork of the {{ package }} package using the `fork_repository` tool.
144+ * Clone the fork using git and HTTPS into a temporary directory under {{ git_repo_basepath }}.
143145
144146 4. Update the {{ package }} to the newer version:
145147 * Create a new Git branch named `automated-package-update-{{ version }}`.
@@ -171,6 +173,19 @@ def prompt(self) -> str:
171173 - Any validation issues found with rpmlint
172174 """
173175
176+ async def run_with_schema (self , input : TInputSchema ) -> TOutputSchema :
177+ async with mcp_tools (os .getenv ("MCP_GITLAB_URL" )) as gitlab_tools :
178+ tools = self ._tools .copy ()
179+ try :
180+ self ._tools .extend (gitlab_tools )
181+ return await self ._run_with_schema (input )
182+ finally :
183+ self ._tools = tools
184+ # disassociate removed tools from requirements
185+ for requirement in self ._requirements :
186+ if requirement ._source_tool in gitlab_tools :
187+ requirement ._source_tool = None
188+
174189
175190async def main () -> None :
176191 logging .basicConfig (level = logging .INFO )
0 commit comments