forked from modelcontextprotocol/csharp-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStdioClientTransportOptions.cs
More file actions
72 lines (65 loc) · 2.69 KB
/
StdioClientTransportOptions.cs
File metadata and controls
72 lines (65 loc) · 2.69 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
namespace ModelContextProtocol.Client;
/// <summary>
/// Provides options for configuring <see cref="StdioClientTransport"/> instances.
/// </summary>
public class StdioClientTransportOptions
{
/// <summary>
/// Gets or sets the command to execute to start the server process.
/// </summary>
public required string Command
{
get;
set
{
if (string.IsNullOrWhiteSpace(value))
{
throw new ArgumentException("Command cannot be null or empty.", nameof(value));
}
field = value;
}
}
/// <summary>
/// Gets or sets the arguments to pass to the server process when it is started.
/// </summary>
public IList<string>? Arguments { get; set; }
/// <summary>
/// Gets or sets a transport identifier used for logging purposes.
/// </summary>
public string? Name { get; set; }
/// <summary>
/// Gets or sets the working directory for the server process.
/// </summary>
public string? WorkingDirectory { get; set; }
/// <summary>
/// Gets or sets environment variables to set for the server process.
/// </summary>
/// <remarks>
/// <para>
/// This property allows you to specify environment variables that will be set in the server process's
/// environment. This is useful for passing configuration, authentication information, or runtime flags
/// to the server without modifying its code.
/// </para>
/// <para>
/// By default, when starting the server process, the server process will inherit the current environment's variables,
/// as discovered via <see cref="Environment.GetEnvironmentVariables()"/>. After those variables are found, the entries
/// in this <see cref="EnvironmentVariables"/> dictionary are used to augment and overwrite the entries read from the environment.
/// That includes removing the variables for any of this collection's entries with a null value.
/// </para>
/// </remarks>
public Dictionary<string, string?>? EnvironmentVariables { get; set; }
/// <summary>
/// Gets or sets the timeout to wait for the server to shut down gracefully.
/// </summary>
/// <remarks>
/// <para>
/// This property dictates how long the client should wait for the server process to exit cleanly during shutdown
/// before forcibly terminating it. This balances between giving the server enough time to clean up
/// resources and not hanging indefinitely if a server process becomes unresponsive.
/// </para>
/// <para>
/// The default is five seconds.
/// </para>
/// </remarks>
public TimeSpan ShutdownTimeout { get; set; } = TimeSpan.FromSeconds(5);
}