syntax = "proto3";

package rbt.mcp.v1;

import "google/protobuf/struct.proto";
import "rbt/v1alpha1/options.proto";

////////////////////////////////////////////////////////////////////////

message Session {
  option (rbt.v1alpha1.state) = {
  };

  // Client info we initialized with, optional to distinguish when
  // initialization has occured.
  optional Implementation client_info = 1;

  repeated string stream_ids = 2;
}

////////////////////////////////////////////////////////////////////////

service SessionMethods {
  rpc HandleMessage(HandleMessageRequest) returns (HandleMessageResponse) {
    option (rbt.v1alpha1.method).workflow = {
    };
  }

  rpc Run(RunRequest) returns (RunResponse) {
    option (rbt.v1alpha1.method).workflow = {
    };
  }

  // Returns public representation of this session.
  rpc Get(GetRequest) returns (GetResponse) {
    option (rbt.v1alpha1.method).reader = {
    };
  }
}

////////////////////////////////////////////////////////////////////////

message Implementation {
  // Technically `name` is _supposed_ to be
  // required, but it does not look like that is enforced
  // by the Pydantic models, so we're making it optional, see:
  // github.com/modelcontextprotocol/python-sdk/blob/main/src/mcp/types.py#L231
  optional string name = 1;
  optional string title = 2;
  string version = 3;
}

////////////////////////////////////////////////////////////////////////

message HandleMessageRequest {
  string path = 1;
  bytes message_bytes = 2;
  optional google.protobuf.Value access_token = 3;
}

message HandleMessageResponse {}

////////////////////////////////////////////////////////////////////////

message RunRequest {
  string path = 1;
  bytes message_bytes = 2;
  optional google.protobuf.Value access_token = 3;
}

message RunResponse {}

////////////////////////////////////////////////////////////////////////

message GetRequest {}

message GetResponse {
  optional Implementation client_info = 1;
  repeated string stream_ids = 2;
}

////////////////////////////////////////////////////////////////////////
