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 @@ -67,19 +67,16 @@ public static void main(String[] args) {
userId);

// Print the response from the tool call
logger.info(
"""
Success! Check your email at {}

You just chained 3 tools together:
1. Searched Google News for stories about MCP URL mode elicitation
2. Created a Google Doc with the results
3. Sent yourself an email with the document link

Email metadata: {}
""",
userId,
sendEmailResult);
logger.info("""
Success! Check your email at {}

You just chained 3 tools together:
1. Searched Google News for stories about MCP URL mode elicitation
2. Created a Google Doc with the results
3. Sent yourself an email with the document link

Email metadata: {}
""", userId, sendEmailResult);
}

/**
Expand All @@ -101,14 +98,11 @@ public static Map<String, JsonValue> authorizeAndRunTool(
.status()
.filter(status -> status != AuthorizationResponse.Status.COMPLETED)
.flatMap(status -> authResponse.url())
.ifPresent(url -> logger.info(
"""
Click this link to authorize {}:
{}.
The process will continue once you have authorized the app.
""",
toolName,
url));
.ifPresent(url -> logger.info("""
Click this link to authorize {}:
{}.
The process will continue once you have authorized the app.
""", toolName, url));
client.auth().waitForCompletion(authResponse);

// Execute the tool and extract the output as a Map
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
@SpringBootApplication
public class SpringAIExample {

private static final String SYSTEM_PROMPT =
"""
private static final String SYSTEM_PROMPT = """
You are a specialized Music Assistant with access to two MCP tools: get_spotify_state and play_song.
Your goal is to provide a seamless, proactive audio experience. Follow these operational guidelines:
Context Awareness: Before playing any music, always use get_spotify_state to see if music is already playing. If it is, acknowledge what is currently playing before switching to the new track.
Expand Down Expand Up @@ -86,14 +85,11 @@ String play(@ToolParam(description = "The name of the artist to play") String na
*
* @return A string object of the playback state.
*/
@Tool(
name = "get_spotify_state",
description =
"""
Get information about the user's current playback state,
including track or episode, and active device.
This tool does not perform any actions. Use other tools to control playback.
""")
@Tool(name = "get_spotify_state", description = """
Get information about the user's current playback state,
including track or episode, and active device.
This tool does not perform any actions. Use other tools to control playback.
""")
String playbackState() {
return executeTool("Spotify.GetPlaybackState", Map.of());
}
Expand Down
Loading