Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,15 @@
final class Calendar {

private final Path file;
private final String uri;

Calendar() {
try {
this.file = Files.createTempFile("calendar", "-calendar");
this.uri = file.toUri().toString();
} catch (IOException ex) {
throw new UncheckedIOException(ex);
}
}

String uri() {
return uri;
}

String readContent() {
try {
return Files.readString(file);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ List<McpToolContent> addCalendarEvent(McpFeatures features,
progress.send(0);
calendar.createNewEvent(name, date, attendees);
progress.send(50);
features.subscriptions().sendUpdate(calendar.uri());
features.subscriptions().sendUpdate(EVENTS_URI);
progress.send(100);

return List.of(McpToolContents.textContent("New event added to the calendar"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import io.helidon.extensions.mcp.server.McpToolContent;
import io.helidon.extensions.mcp.server.McpToolContents;

import static io.helidon.extensions.mcp.examples.calendar.Calendar.EVENTS_URI;

/**
* MCP tool to add a new Event to the calendar.
*/
Expand Down Expand Up @@ -111,7 +113,7 @@ private List<McpToolContent> addCalendarEvent(McpRequest request) {

progress.send(50);
calendar.createNewEvent(name, date, attendees);
features.subscriptions().sendUpdate(calendar.uri());
features.subscriptions().sendUpdate(EVENTS_URI);
progress.send(100);

return List.of(McpToolContents.textContent("New event added to the calendar"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,15 @@ final class Calendar {
static final String EVENTS_URI_TEMPLATE = EVENTS_URI + "/{name}";

private final Path file;
private final String uri;

Calendar() {
try {
this.file = Files.createTempFile("calendar", "-calendar");
this.uri = file.toUri().toString();
} catch (IOException ex) {
throw new UncheckedIOException(ex);
}
}

String uri() {
return uri;
}

String readContent() {
try {
return Files.readString(file);
Expand Down