get_git_repositories
Retrieve Git repositories for a Backlog project using project ID or key to manage version-controlled code within project workflows.
Instructions
Returns list of Git repositories for a project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | No | The numeric ID of the project (e.g., 12345) | |
| projectKey | No | The key of the project (e.g., 'PROJECT') |
Implementation Reference
- src/tools/getGitRepositories.ts:44-54 (handler)The handler function that resolves the project ID or key using resolveIdOrKey utility and calls backlog.getGitRepositories(result.value) to fetch the list of Git repositories.handler: async ({ projectId, projectKey }) => { const result = resolveIdOrKey( 'project', { id: projectId, key: projectKey }, t ); if (!result.ok) { throw result.error; } return backlog.getGitRepositories(result.value); },
- src/tools/getGitRepositories.ts:8-27 (schema)Input schema definition for the tool parameters: optional projectId (number) and projectKey (string), with descriptions translated via t function.const getGitRepositoriesSchema = buildToolSchema((t) => ({ projectId: z .number() .optional() .describe( t( 'TOOL_GET_GIT_REPOSITORIES_PROJECT_ID', 'The numeric ID of the project (e.g., 12345)' ) ), projectKey: z .string() .optional() .describe( t( 'TOOL_GET_GIT_REPOSITORIES_PROJECT_KEY', "The key of the project (e.g., 'PROJECT')" ) ), }));
- src/tools/getGitRepositories.ts:29-56 (registration)Definition and export of the getGitRepositoriesTool function, which creates and returns the ToolDefinition object with name 'get_git_repositories', description, input/output schemas, and handler.export const getGitRepositoriesTool = ( backlog: Backlog, { t }: TranslationHelper ): ToolDefinition< ReturnType<typeof getGitRepositoriesSchema>, (typeof GitRepositorySchema)['shape'] > => { return { name: 'get_git_repositories', description: t( 'TOOL_GET_GIT_REPOSITORIES_DESCRIPTION', 'Returns list of Git repositories for a project' ), schema: z.object(getGitRepositoriesSchema(t)), outputSchema: GitRepositorySchema, handler: async ({ projectId, projectKey }) => { const result = resolveIdOrKey( 'project', { id: projectId, key: projectKey }, t ); if (!result.ok) { throw result.error; } return backlog.getGitRepositories(result.value); }, }; };
- src/tools/tools.ts:130-146 (registration)The getGitRepositoriesTool is registered as part of the 'git' toolset group in the allTools function, which aggregates all available tools.{ name: 'git', description: 'Tools for managing Git repositories and pull requests.', enabled: false, tools: [ getGitRepositoriesTool(backlog, helper), getGitRepositoryTool(backlog, helper), getPullRequestsTool(backlog, helper), getPullRequestsCountTool(backlog, helper), getPullRequestTool(backlog, helper), addPullRequestTool(backlog, helper), updatePullRequestTool(backlog, helper), getPullRequestCommentsTool(backlog, helper), addPullRequestCommentTool(backlog, helper), updatePullRequestCommentTool(backlog, helper), ], },