@@ -156,7 +156,6 @@ Now for the powerful part. Let's give Copilot the ability to call your code by d
156156import com.github.copilot.sdk.* ;
157157import com.github.copilot.sdk.events.* ;
158158import com.github.copilot.sdk.json.* ;
159- import com.fasterxml.jackson.databind.JsonNode ;
160159import java.util.* ;
161160import java.util.concurrent.* ;
162161
@@ -180,8 +179,8 @@ public class ToolExample {
180179 " required" , List . of(" city" )
181180 ),
182181 invocation - > {
183- JsonNode params = ( JsonNode ) invocation. getArguments();
184- String city = params. get(" city" ) . asText( );
182+ Map< String , Object > params = invocation. getArguments();
183+ String city = ( String ) params. get(" city" );
185184
186185 // In a real app, you'd call a weather API here
187186 String [] conditions = {" sunny" , " cloudy" , " rainy" , " partly cloudy" };
@@ -234,7 +233,6 @@ Let's put it all together into a useful interactive assistant:
234233import com.github.copilot.sdk.* ;
235234import com.github.copilot.sdk.events.* ;
236235import com.github.copilot.sdk.json.* ;
237- import com.fasterxml.jackson.databind.JsonNode ;
238236import java.util.* ;
239237import java.util.concurrent.* ;
240238
@@ -259,8 +257,8 @@ public class WeatherAssistant {
259257 " required" , List . of(" city" )
260258 ),
261259 invocation - > {
262- JsonNode params = ( JsonNode ) invocation. getArguments();
263- String city = params. get(" city" ) . asText( );
260+ Map< String , Object > params = invocation. getArguments();
261+ String city = ( String ) params. get(" city" );
264262 String [] conditions = {" sunny" , " cloudy" , " rainy" , " partly cloudy" };
265263 int temp = new Random (). nextInt(30 ) + 50 ;
266264 String condition = conditions[new Random (). nextInt(conditions. length)];
@@ -322,9 +320,9 @@ You've learned the core concepts of the Copilot SDK:
322320
323321** Explore more:**
324322
325- - [ API Documentation] ( documentation.html ) - Complete API reference
326- - [ MCP Integration ] ( mcp .html) - Connect to Model Context Protocol servers
327- - [ Examples on GitHub ] ( https://github.com/copilot-community-sdk/copilot-sdk-java/tree/main/examples )
323+ - [ Documentation] ( documentation.html ) - Basic usage and session management
324+ - [ Advanced Usage ] ( advanced .html) - Tools, BYOK, infinite sessions, and more
325+ - [ MCP Servers ] ( mcp.html ) - Connect to Model Context Protocol servers
328326
329327## Troubleshooting
330328
0 commit comments