17
17
18
18
package ai .wanaku .routers .proxies .resources ;
19
19
20
- import java .util .List ;
21
- import java .util .Map ;
22
-
23
20
import ai .wanaku .api .types .ResourceReference ;
21
+ import ai .wanaku .api .types .management .Configuration ;
22
+ import ai .wanaku .api .types .management .Configurations ;
24
23
import ai .wanaku .api .types .management .Service ;
25
24
import ai .wanaku .core .exchange .InquireReply ;
26
25
import ai .wanaku .core .exchange .InquireRequest ;
35
34
import io .quarkiverse .mcp .server .ResourceContents ;
36
35
import io .quarkiverse .mcp .server .ResourceManager ;
37
36
import io .quarkiverse .mcp .server .TextResourceContents ;
37
+ import java .util .List ;
38
+ import java .util .Map ;
38
39
import org .jboss .logging .Logger ;
39
40
40
41
/**
@@ -56,7 +57,7 @@ public List<ResourceContents> eval(ResourceManager.ResourceArguments arguments,
56
57
}
57
58
58
59
LOG .infof ("Requesting %s from %s" , mcpResource .getName (), service .getTarget ());
59
- final ResourceReply reply = acquireRemotely (mcpResource , service . getTarget () );
60
+ final ResourceReply reply = acquireRemotely (mcpResource , arguments , service );
60
61
if (reply .getIsError ()) {
61
62
TextResourceContents textResourceContents =
62
63
new TextResourceContents (arguments .requestUri ().value (), reply .getContent (), "text/plain" );
@@ -75,16 +76,20 @@ public String name() {
75
76
return "resource-acquirer" ;
76
77
}
77
78
78
- private ResourceReply acquireRemotely (ResourceReference mcpResource , String target ) {
79
- ManagedChannel channel = ManagedChannelBuilder .forTarget (target )
79
+ private ResourceReply acquireRemotely (ResourceReference mcpResource , ResourceManager . ResourceArguments arguments , Service service ) {
80
+ ManagedChannel channel = ManagedChannelBuilder .forTarget (service . getTarget () )
80
81
.usePlaintext ()
81
82
.build ();
82
83
84
+ Map <String , Configuration > configurations = service .getConfigurations ().getConfigurations ();
85
+ Map <String , String > serviceConfigurations = Configurations .toStringMap (configurations );
86
+
83
87
ResourceRequest request = ResourceRequest
84
88
.newBuilder ()
85
89
.setLocation (mcpResource .getLocation ())
86
90
.setType (mcpResource .getType ())
87
91
.setName (mcpResource .getName ())
92
+ .putAllServiceConfigurations (serviceConfigurations )
88
93
.build ();
89
94
90
95
ResourceAcquirerGrpc .ResourceAcquirerBlockingStub blockingStub = ResourceAcquirerGrpc .newBlockingStub (channel );
0 commit comments