syntax = "proto3";

package wabee.tools;

// Common types we might need
message Int64Value {
  int64 value = 1;
}

message StringValue {
  string value = 1;
}

message FloatValue {
  double value = 1;
}

service ToolService {
  rpc Execute (ExecuteRequest) returns (ExecuteResponse);
  rpc GetToolSchema (GetToolSchemaRequest) returns (ToolSchema);
}

message ExecuteRequest {
  string tool_name = 1;
  oneof input {
    string json_data = 2;  // For backwards compatibility
    bytes proto_data = 3;  // For dynamic proto encoding
  }
}

message ImageToolResponse {                                                                                                                                                                                                                       
     string mime_type = 1;                                                                                                                                                                                                                         
     string data = 2;                                                                                                                                                                                                                              
 }                                                                                                                                                                                                                                                 
                                                                                                                                                                                                                                                   
 message StructuredToolResponse {                                                                                                                                                                                                                  
     string variable_name = 1;                                                                                                                                                                                                                     
     string content = 2;                                                                                                                                                                                                                           
     optional string local_file_path = 3;                                                                                                                                                                                                          
     map<string, string> metadata = 4;  // Using string for values for simplicity                                                                                                                                                                  
     optional bool memory_push = 5;                                                                                                                                                                                                                         
     repeated ImageToolResponse images = 6;                                                                                                                                                                                                        
     optional string error = 7;                                                                                                                                                                                                                    
 }

message ExecuteResponse {
  oneof result {
    string json_result = 1;  // For backwards compatibility
    bytes proto_result = 2;  // For dynamic proto encoding
    StructuredToolResponse structured_result = 3; // New preferred format
  }
  ToolError error = 4;    
}

message ToolError {
  string type = 1;
  string message = 2;
}

message GetToolSchemaRequest {
  string tool_name = 1;
}

message ToolSchema {
  string tool_name = 1;
  string description = 2;
  repeated FieldSchema fields = 3;
}

message FieldSchema {
  string name = 1;
  string type = 2;
  bool required = 3;
  string description = 4;
}
