@@ -71,17 +71,17 @@ public String serverKey() {
7171 public java.util.List<io.modelcontextprotocol.server.McpServerFeatures.SyncCompletionSpecification> completions(io.jooby.Jooby app) {
7272 var invoker = app.require(io.jooby.mcp.McpInvoker.class);
7373 var completions = new java.util.ArrayList<io.modelcontextprotocol.server.McpServerFeatures.SyncCompletionSpecification>();
74- completions.add(new io.modelcontextprotocol.server.McpServerFeatures.SyncCompletionSpecification(new io.modelcontextprotocol.spec.McpSchema.PromptReference("review_code"), (exchange, req) -> invoker.invoke(new io.jooby.mcp.McpOperation( "completions/review_code", "tests.i3830.ExampleServer", "reviewCode"), () -> this. reviewCodeCompletionHandler(exchange, exchange.transportContext(), req) )));
75- completions.add(new io.modelcontextprotocol.server.McpServerFeatures.SyncCompletionSpecification(new io.modelcontextprotocol.spec.McpSchema.ResourceReference("file:///users/{id}/{name}/profile"), (exchange, req) -> invoker.invoke(new io.jooby.mcp.McpOperation( "completions/file:///users/{id}/{name}/profile", "tests.i3830.ExampleServer", "getUserProfile"), () -> this. getUserProfileCompletionHandler(exchange, exchange.transportContext(), req) )));
74+ completions.add(new io.modelcontextprotocol.server.McpServerFeatures.SyncCompletionSpecification(new io.modelcontextprotocol.spec.McpSchema.PromptReference("review_code"), invoker.asCompletionHandler( "completions/review_code", "tests.i3830.ExampleServer", "reviewCode", this:: reviewCodeCompletionHandler)));
75+ completions.add(new io.modelcontextprotocol.server.McpServerFeatures.SyncCompletionSpecification(new io.modelcontextprotocol.spec.McpSchema.ResourceReference("file:///users/{id}/{name}/profile"), invoker.asCompletionHandler( "completions/file:///users/{id}/{name}/profile", "tests.i3830.ExampleServer", "getUserProfile", this:: getUserProfileCompletionHandler)));
7676 return completions;
7777 }
7878
7979 @Override
8080 public java.util.List<io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncCompletionSpecification> statelessCompletions(io.jooby.Jooby app) {
8181 var invoker = app.require(io.jooby.mcp.McpInvoker.class);
8282 var completions = new java.util.ArrayList<io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncCompletionSpecification>();
83- completions.add(new io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncCompletionSpecification(new io.modelcontextprotocol.spec.McpSchema.PromptReference("review_code"), (ctx, req) -> invoker.invoke(new io.jooby.mcp.McpOperation( "completions/review_code", "tests.i3830.ExampleServer", "reviewCode"), () -> this. reviewCodeCompletionHandler(null, ctx, req) )));
84- completions.add(new io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncCompletionSpecification(new io.modelcontextprotocol.spec.McpSchema.ResourceReference("file:///users/{id}/{name}/profile"), (ctx, req) -> invoker.invoke(new io.jooby.mcp.McpOperation( "completions/file:///users/{id}/{name}/profile", "tests.i3830.ExampleServer", "getUserProfile"), () -> this. getUserProfileCompletionHandler(null, ctx, req) )));
83+ completions.add(new io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncCompletionSpecification(new io.modelcontextprotocol.spec.McpSchema.PromptReference("review_code"), invoker.asStatelessCompletionHandler( "completions/review_code", "tests.i3830.ExampleServer", "reviewCode", this:: reviewCodeCompletionHandler)));
84+ completions.add(new io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncCompletionSpecification(new io.modelcontextprotocol.spec.McpSchema.ResourceReference("file:///users/{id}/{name}/profile"), invoker.asStatelessCompletionHandler( "completions/file:///users/{id}/{name}/profile", "tests.i3830.ExampleServer", "getUserProfile", this:: getUserProfileCompletionHandler)));
8585 return completions;
8686 }
8787
@@ -91,10 +91,10 @@ public void install(io.jooby.Jooby app, io.modelcontextprotocol.server.McpSyncSe
9191 var invoker = app.require(io.jooby.mcp.McpInvoker.class);
9292 var schemaGenerator = app.require(com.github.victools.jsonschema.generator.SchemaGenerator.class);
9393
94- server.addTool(new io.modelcontextprotocol.server.McpServerFeatures.SyncToolSpecification(addToolSpec(schemaGenerator), (exchange, req) -> invoker.invoke(new io.jooby.mcp.McpOperation( "tools/calculator", "tests.i3830.ExampleServer", "add"), () -> this. add(exchange, exchange.transportContext(), req) )));
95- server.addPrompt(new io.modelcontextprotocol.server.McpServerFeatures.SyncPromptSpecification(reviewCodePromptSpec(), (exchange, req) -> invoker.invoke(new io.jooby.mcp.McpOperation( "prompts/review_code", "tests.i3830.ExampleServer", "reviewCode"), () -> this. reviewCode(exchange, exchange.transportContext(), req) )));
96- server.addResource(new io.modelcontextprotocol.server.McpServerFeatures.SyncResourceSpecification(getLogsResourceSpec(), (exchange, req) -> invoker.invoke(new io.jooby.mcp.McpOperation( "resources/file:///logs/app.log", "tests.i3830.ExampleServer", "getLogs"), () -> this. getLogs(exchange, exchange.transportContext(), req) )));
97- server.addResourceTemplate(new io.modelcontextprotocol.server.McpServerFeatures.SyncResourceTemplateSpecification(getUserProfileResourceTemplateSpec(), (exchange, req) -> invoker.invoke(new io.jooby.mcp.McpOperation( "resources/file:///users/{id}/{name}/profile", "tests.i3830.ExampleServer", "getUserProfile"), () -> this. getUserProfile(exchange, exchange.transportContext(), req) )));
94+ server.addTool(new io.modelcontextprotocol.server.McpServerFeatures.SyncToolSpecification(addToolSpec(schemaGenerator), invoker.asToolHandler( "tools/calculator","tests.i3830.ExampleServer", "add", this:: add)));
95+ server.addPrompt(new io.modelcontextprotocol.server.McpServerFeatures.SyncPromptSpecification(reviewCodePromptSpec(), invoker.asPromptHandler( "prompts/review_code","tests.i3830.ExampleServer", "reviewCode", this:: reviewCode)));
96+ server.addResource(new io.modelcontextprotocol.server.McpServerFeatures.SyncResourceSpecification(getLogsResourceSpec(), invoker.asResourceHandler( "resources/file:///logs/app.log","tests.i3830.ExampleServer", "getLogs", this:: getLogs)));
97+ server.addResourceTemplate(new io.modelcontextprotocol.server.McpServerFeatures.SyncResourceTemplateSpecification(getUserProfileResourceTemplateSpec(), invoker.asResourceHandler( "resources/file:///users/{id}/{name}/profile","tests.i3830.ExampleServer", "getUserProfile", this:: getUserProfile)));
9898 }
9999
100100 @Override
@@ -103,10 +103,10 @@ public void install(io.jooby.Jooby app, io.modelcontextprotocol.server.McpStatel
103103 var invoker = app.require(io.jooby.mcp.McpInvoker.class);
104104 var schemaGenerator = app.require(com.github.victools.jsonschema.generator.SchemaGenerator.class);
105105
106- server.addTool(new io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncToolSpecification(addToolSpec(schemaGenerator), (ctx, req) -> invoker.invoke(new io.jooby.mcp.McpOperation( "tools/calculator", "tests.i3830.ExampleServer", "add"), () -> this. add(null, ctx, req) )));
107- server.addPrompt(new io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncPromptSpecification(reviewCodePromptSpec(), (ctx, req) -> invoker.invoke(new io.jooby.mcp.McpOperation( "prompts/review_code", "tests.i3830.ExampleServer", "reviewCode"), () -> this. reviewCode(null, ctx, req) )));
108- server.addResource(new io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncResourceSpecification(getLogsResourceSpec(), (ctx, req) -> invoker.invoke(new io.jooby.mcp.McpOperation( "resources/file:///logs/app.log", "tests.i3830.ExampleServer", "getLogs"), () -> this. getLogs(null, ctx, req) )));
109- server.addResourceTemplate(new io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncResourceTemplateSpecification(getUserProfileResourceTemplateSpec(), (ctx, req) -> invoker.invoke(new io.jooby.mcp.McpOperation( "resources/file:///users/{id}/{name}/profile", "tests.i3830.ExampleServer", "getUserProfile"), () -> this. getUserProfile(null, ctx, req) )));
106+ server.addTool(new io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncToolSpecification(addToolSpec(schemaGenerator), invoker.asStatelessToolHandler( "tools/calculator","tests.i3830.ExampleServer", "add", this:: add)));
107+ server.addPrompt(new io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncPromptSpecification(reviewCodePromptSpec(), invoker.asStatelessPromptHandler( "prompts/review_code","tests.i3830.ExampleServer", "reviewCode", this:: reviewCode)));
108+ server.addResource(new io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncResourceSpecification(getLogsResourceSpec(), invoker.asStatelessResourceHandler( "resources/file:///logs/app.log","tests.i3830.ExampleServer", "getLogs", this:: getLogs)));
109+ server.addResourceTemplate(new io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncResourceTemplateSpecification(getUserProfileResourceTemplateSpec(), invoker.asStatelessResourceHandler( "resources/file:///users/{id}/{name}/profile","tests.i3830.ExampleServer", "getUserProfile", this:: getUserProfile)));
110110 }
111111
112112 private io.modelcontextprotocol.spec.McpSchema.Tool addToolSpec(com.github.victools.jsonschema.generator.SchemaGenerator schemaGenerator) {
0 commit comments