Get book details over gRPCv1.0.0 · Protobuf Schema
Returns full Catalog book details by identifier through the book.v1 gRPC contract.
1. Retrieve Full Book Details for MCP Tools
McpTools calls book.v1.BookGrpcService/GetBookDetails on Catalog API to fetch a book’s full metadata, category, publisher, authors, and rating summary.
Payload details
- Request (
GetBookDetailsRequest):book_id(Catalog book UUID string). - Response (
GetBookDetailsResponse):book(BookItemwithid,name,description,image_url,price,price_sale,status,category,publisher,authors,average_rating, andtotal_reviews).
Using this example
Returns StatusCode.OK with GetBookDetailsResponse.Book populated, or throws RpcException with StatusCode.NotFound if the book ID does not exist.
using BookWorm.Catalog.Grpc.Services;using BookWorm.Chassis.Utilities;using BookWorm.Chassis.Utilities.Configurations;using Grpc.Core;
// 1. DI registration in McpTools (src/Services/McpTools/BookWorm.McpTools/Grpc/Extensions.cs)builder.Services.AddGrpcServiceReference<BookGrpcService.BookGrpcServiceClient>( HttpUtilities .AsUrlBuilder() .WithScheme(builder.GetScheme()) .WithHost(Constants.Aspire.Services.Catalog) .Build(), HealthStatus.Degraded);
// 2. Typed gRPC client invocation (src/Services/McpTools/BookWorm.McpTools/Grpc/Services/Book/BookService.cs)var response = await client.GetBookDetailsAsync( new() { BookId = "01960a1b-2c3d-7e4f-8a9b-0c1d2e3f4a10" }, deadline: DateTime.UtcNow.AddSeconds(10), cancellationToken: cancellationToken);1edition = "2023";
2
3package book.v1;
4
5service BookGrpcService {
6 rpc GetBookDetails (GetBookDetailsRequest) returns (GetBookDetailsResponse);
7}
8
9message GetBookDetailsRequest {
10 string book_id = 1;
11}
12
13message GetBookDetailsResponse {
14 BookItem book = 1;
15}
16
17message BookItem {
18 string id = 1;
19 string name = 2;
20 string description = 3;
21 string image_url = 4;
22 DecimalValue price = 5;
23 DecimalValue price_sale = 6;
24 BookStatus status = 7;
25 CategoryItem category = 8;
26 PublisherItem publisher = 9;
27 repeated AuthorItem authors = 10;
28 double average_rating = 11;
29 int32 total_reviews = 12;
30}
31
32enum BookStatus {
33 BOOK_STATUS_UNSPECIFIED = 0;
34 BOOK_STATUS_IN_STOCK = 1;
35 BOOK_STATUS_OUT_OF_STOCK = 2;
36}
37
38message DecimalValue {
39 int64 units = 1;
40 sfixed32 nanos = 2;
41}
42
43message CategoryItem {
44 string id = 1;
45 string name = 2;
46}
47
48message PublisherItem {
49 string id = 1;
50 string name = 2;
51}
52
53message AuthorItem {
54 string id = 1;
55 string name = 2;
56}
57