public static class McpServerFeatures.AsyncResourceSpecification
extends java.lang.Object
Example resource specification:
new McpServerFeatures.AsyncResourceSpecification(
Resource.builder()
.uri("docs")
.name("Documentation files")
.title("Documentation files")
.mimeType("text/markdown")
.description("Markdown documentation files")
.build(),
(exchange, request) -> Mono.fromSupplier(() -> readFile(request.getPath()))
.map(ReadResourceResult::new))
| 构造器和说明 |
|---|
AsyncResourceSpecification(McpSchema.Resource resource,
java.util.function.BiFunction<McpAsyncServerExchange,McpSchema.ReadResourceRequest,reactor.core.publisher.Mono<McpSchema.ReadResourceResult>> readHandler) |
| 限定符和类型 | 方法和说明 |
|---|---|
java.util.function.BiFunction<McpAsyncServerExchange,McpSchema.ReadResourceRequest,reactor.core.publisher.Mono<McpSchema.ReadResourceResult>> |
readHandler() |
McpSchema.Resource |
resource() |
public AsyncResourceSpecification(McpSchema.Resource resource, java.util.function.BiFunction<McpAsyncServerExchange,McpSchema.ReadResourceRequest,reactor.core.publisher.Mono<McpSchema.ReadResourceResult>> readHandler)
resource - The resource definition including name, description, and MIME typereadHandler - The function that handles resource read requests. The function's
first argument is an McpAsyncServerExchange upon which the server can
interact with the connected client. The second arguments is a
McpSchema.ReadResourceRequest.public McpSchema.Resource resource()
public java.util.function.BiFunction<McpAsyncServerExchange,McpSchema.ReadResourceRequest,reactor.core.publisher.Mono<McpSchema.ReadResourceResult>> readHandler()