forked from Azure/azure-sdk-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMCPTool.cs
More file actions
34 lines (27 loc) · 932 Bytes
/
Copy pathMCPTool.cs
File metadata and controls
34 lines (27 loc) · 932 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using System.CommandLine;
using System.CommandLine.Invocation;
namespace Azure.Sdk.Tools.Cli.Contract
{
/// <summary>
/// This is the base class defining how an MCP enabled tool will interface with the server.
///
/// This covers:
/// - route registration/disambiguation
/// - compilation trim avoidance for reflection-included MCP tools
/// </summary>
public abstract class MCPTool
{
public MCPTool() { }
public Command? Command;
public int ExitCode { get; set; } = 0;
public void SetFailure(int exitCode = 1)
{
ExitCode = exitCode;
}
public CommandGroup[] CommandHierarchy { get; set; } = [];
public abstract Command GetCommand();
public abstract Task HandleCommand(InvocationContext ctx, CancellationToken ct);
}
}