Returning a list of interfaces in a CapnProto struct

I’m working on a toy project using the Capnproto RPC library (and really loving it) but I’ve run into a bit of a confusing issue. I’m trying to return a Capnproto struct that contains a reference to an additional capability. The idea is that a client can register with a central server and provide a callback that the service will use when the registration is approved:

The capnproto definitions are here:

struct RegistrationResponse {
    union {
        success @0 :Services.ServiceResolver;
        failure @1 :Text;
    }
}
interface ServiceResolver {
    resolve @0 () -> (services :List(Service));
}

The issue I’m running into is when I try to add the capability to the message itself, I get the following error:

Error: This expression has type
         [ `ServiceResolver_c8edc1bb857abafa ] Capability.t
       but an expression was expected of type Stdint.uint32

I believe I’m creating the capability correctly but I’m not sure how to extract the correct ID (which I’m assuming the uint32 corresponds to).

The code is a bit messing but maybe interpretable:

module Callback = struct
  let callback t result =
    let open Api.Client.RegistrationCallback.Callback in
    let request, params = Capability.Request.create Params.init_pointer in
    let builder = Params.response_init params in
    (match result with
     | Left c ->
      RP.Builder.RegistrationResponse.success_set builder (Some c)
    | Right err -> RP.Builder.RegistrationResponse.failure_set builder err);
    Capability.call_for_unit_exn t method_id request
end

let handle_registration callback ~name =
  Log.info (fun m ->m"Successfully registered %s" name);
  (* Create a new service resolver and return it*)
  let resolver = Service_resolver.make name in
  Callback.callback callback (Either.Left resolver) >|= fun () ->
  Ok (Service.Response.create_empty ())

Doing some web searches, I’m not sure if it’s even possible to nest an interface inside of a struct, of if I’m just missing a step. Any help would be appreciated. Thanks!