Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b4RzcCS5JCAgcxLz7T
28 lines
1.1 KiB
Java
28 lines
1.1 KiB
Java
package com.ankurm.mcpapps;
|
|
|
|
import io.modelcontextprotocol.spec.McpSchema.ReadResourceResult;
|
|
import io.modelcontextprotocol.spec.McpSchema.TextResourceContents;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import org.springframework.ai.mcp.annotation.McpResource;
|
|
|
|
/** Test-only resources that answer two questions about Spring AI 2.1.0. */
|
|
class ProbeResources {
|
|
|
|
/** A URI with a variable: where does it get listed? */
|
|
@McpResource(uri = "ui://probe/{theme}.html", name = "probe_template", mimeType = UiMeta.MIME_TYPE)
|
|
public String templated(String theme) {
|
|
return "<!DOCTYPE html><title>" + theme + "</title>";
|
|
}
|
|
|
|
/** The method builds the result itself: whose _meta wins? */
|
|
@McpResource(uri = "ui://probe/explicit.html", name = "probe_explicit", mimeType = UiMeta.MIME_TYPE,
|
|
metaProvider = UiMeta.BoardResource.class)
|
|
public ReadResourceResult explicit() {
|
|
return ReadResourceResult.builder(List.of(TextResourceContents
|
|
.builder("ui://probe/explicit.html", "<!DOCTYPE html><title>explicit</title>")
|
|
.mimeType(UiMeta.MIME_TYPE)
|
|
.build())).build();
|
|
}
|
|
}
|