|
12 | 12 | using ModelContextProtocol.Client; |
13 | 13 | using ModelContextProtocol.Protocol.Transport; |
14 | 14 | using ModelContextProtocol.Protocol.Types; |
| 15 | +using Octokit; |
15 | 16 | using Tool = LangChain.Cli.Models.Tool; |
16 | 17 |
|
17 | 18 | namespace LangChain.Cli.Commands; |
@@ -188,6 +189,12 @@ .. tools.Contains(Tool.Filesystem) |
188 | 189 | name: "FindFilePathsByContent", |
189 | 190 | description: "Finds file paths by content.") } |
190 | 191 | : [], |
| 192 | + .. tools.Contains(Tool.GitHub) |
| 193 | + ? new [] { AIFunctionFactory.Create( |
| 194 | + GetAvailableLabels, |
| 195 | + name: "GetAvailableLabelsForRepository", |
| 196 | + description: "Retrieves all available labels for a GitHub repository.") } |
| 197 | + : [], |
191 | 198 | ], |
192 | 199 | ResponseFormat = format switch |
193 | 200 | { |
@@ -271,6 +278,17 @@ static async Task<IList<string>> FindFilePathsByContent( |
271 | 278 |
|
272 | 279 | return paths; |
273 | 280 | } |
| 281 | + |
| 282 | + [Description("Retrieves all available labels for a GitHub repository.")] |
| 283 | + static async Task<IReadOnlyList<Label>> GetAvailableLabels( |
| 284 | + [Description("The owner of the repository")] string owner, |
| 285 | + [Description("The name of the repository")] string name) |
| 286 | + { |
| 287 | + var github = new GitHubClient(new ProductHeaderValue("LangChain DO MCP extension")); |
| 288 | + var labels = await github.Issue.Labels.GetAllForRepository(owner, name).ConfigureAwait(false); |
| 289 | + |
| 290 | + return labels; |
| 291 | + } |
274 | 292 | } |
275 | 293 |
|
276 | 294 | public static ChatResponseFormatJson ChatResponseFormatForType<T>( |
|
0 commit comments