File tree Expand file tree Collapse file tree 4 files changed +75
-16
lines changed Expand file tree Collapse file tree 4 files changed +75
-16
lines changed Original file line number Diff line number Diff line change @@ -13,18 +13,13 @@ public partial class ResponseExamples
1313 [ Test ]
1414 public void Example05_RemoteMcp ( )
1515 {
16- // This is a dice rolling MCP server.
17- string serverLabel = "dmcp" ;
18- Uri serverUri = new Uri ( "https://dmcp-server.deno.dev/sse" ) ;
19-
20- McpToolCallApprovalPolicy approvalPolicy = new McpToolCallApprovalPolicy ( GlobalMcpToolCallApprovalPolicy . NeverRequireApproval ) ;
21-
2216 ResponseCreationOptions options = new ( )
2317 {
2418 Tools = {
25- new McpTool ( serverLabel , serverUri )
19+ new McpTool ( serverLabel : "dmcp" , serverUri : new Uri ( "https://dmcp-server.deno.dev/sse" ) )
2620 {
27- ToolCallApprovalPolicy = approvalPolicy
21+ ServerDescription = "A Dungeons and Dragons MCP server to assist with dice rolling." ,
22+ ToolCallApprovalPolicy = new McpToolCallApprovalPolicy ( GlobalMcpToolCallApprovalPolicy . NeverRequireApproval )
2823 }
2924 }
3025 } ;
Original file line number Diff line number Diff line change @@ -14,18 +14,13 @@ public partial class ResponseExamples
1414 [ Test ]
1515 public async Task Example05_RemoteMcpAsync ( )
1616 {
17- // This is a dice rolling MCP server.
18- string serverLabel = "dmcp" ;
19- Uri serverUri = new Uri ( "https://dmcp-server.deno.dev/sse" ) ;
20-
21- McpToolCallApprovalPolicy approvalPolicy = new McpToolCallApprovalPolicy ( GlobalMcpToolCallApprovalPolicy . NeverRequireApproval ) ;
22-
2317 ResponseCreationOptions options = new ( )
2418 {
2519 Tools = {
26- new McpTool ( serverLabel , serverUri )
20+ new McpTool ( serverLabel : "dmcp" , serverUri : new Uri ( "https://dmcp-server.deno.dev/sse" ) )
2721 {
28- ToolCallApprovalPolicy = approvalPolicy
22+ ServerDescription = "A Dungeons and Dragons MCP server to assist with dice rolling." ,
23+ ToolCallApprovalPolicy = new McpToolCallApprovalPolicy ( GlobalMcpToolCallApprovalPolicy . NeverRequireApproval )
2924 }
3025 }
3126 } ;
Original file line number Diff line number Diff line change 1+ using NUnit . Framework ;
2+ using OpenAI . Responses ;
3+ using System ;
4+
5+ namespace OpenAI . Examples ;
6+
7+ // This example uses experimental APIs which are subject to change. To use experimental APIs,
8+ // please acknowledge their experimental status by suppressing the corresponding warning.
9+ #pragma warning disable OPENAI001
10+
11+ public partial class ResponseExamples
12+ {
13+ [ Test ]
14+ public void Example06_RemoteMcpAuthentication ( )
15+ {
16+ ResponseCreationOptions options = new ( )
17+ {
18+ Tools = {
19+ new McpTool ( serverLabel : "stripe" , serverUri : new Uri ( "https://mcp.stripe.com" ) )
20+ {
21+ AuthorizationToken = Environment . GetEnvironmentVariable ( "STRIPE_OAUTH_ACCESS_TOKEN" ) ,
22+ }
23+ }
24+ } ;
25+
26+ OpenAIResponseClient client = new ( model : "gpt-5" , apiKey : Environment . GetEnvironmentVariable ( "OPENAI_API_KEY" ) ) ;
27+
28+ OpenAIResponse response = client . CreateResponse ( "Create a payment link for $20" , options ) ;
29+
30+ Console . WriteLine ( $ "[ASSISTANT]: { response . GetOutputText ( ) } ") ;
31+ }
32+ }
33+
34+ #pragma warning restore OPENAI001
Original file line number Diff line number Diff line change 1+ using NUnit . Framework ;
2+ using OpenAI . Responses ;
3+ using System ;
4+ using System . Threading . Tasks ;
5+
6+ namespace OpenAI . Examples ;
7+
8+ // This example uses experimental APIs which are subject to change. To use experimental APIs,
9+ // please acknowledge their experimental status by suppressing the corresponding warning.
10+ #pragma warning disable OPENAI001
11+
12+ public partial class ResponseExamples
13+ {
14+ [ Test ]
15+ public async Task Example06_RemoteMcpAuthenticationAsync ( )
16+ {
17+ ResponseCreationOptions options = new ( )
18+ {
19+ Tools = {
20+ new McpTool ( serverLabel : "stripe" , serverUri : new Uri ( "https://mcp.stripe.com" ) )
21+ {
22+ AuthorizationToken = Environment . GetEnvironmentVariable ( "STRIPE_OAUTH_ACCESS_TOKEN" ) ,
23+ }
24+ }
25+ } ;
26+
27+ OpenAIResponseClient client = new ( model : "gpt-5" , apiKey : Environment . GetEnvironmentVariable ( "OPENAI_API_KEY" ) ) ;
28+
29+ OpenAIResponse response = await client . CreateResponseAsync ( "Create a payment link for $20" , options ) ;
30+
31+ Console . WriteLine ( $ "[ASSISTANT]: { response . GetOutputText ( ) } ") ;
32+ }
33+ }
34+
35+ #pragma warning restore OPENAI001
You can’t perform that action at this time.
0 commit comments