Skip to content

Commit 8dc9ae0

Browse files
committed
refactor: replace JsonNode with Map for parameter handling in tool examples; update documentation links for clarity
1 parent d02777f commit 8dc9ae0

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

src/site/markdown/getting-started.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ Now for the powerful part. Let's give Copilot the ability to call your code by d
156156
import com.github.copilot.sdk.*;
157157
import com.github.copilot.sdk.events.*;
158158
import com.github.copilot.sdk.json.*;
159-
import com.fasterxml.jackson.databind.JsonNode;
160159
import java.util.*;
161160
import 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:
234233
import com.github.copilot.sdk.*;
235234
import com.github.copilot.sdk.events.*;
236235
import com.github.copilot.sdk.json.*;
237-
import com.fasterxml.jackson.databind.JsonNode;
238236
import java.util.*;
239237
import 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

Comments
 (0)