List books over gRPCv1.0.0 · Protobuf Schema
Searches and lists Catalog books with full metadata through the book.v1 gRPC contract.
1. Search Books over gRPC for MCP Tools
McpTools calls book.v1.BookGrpcService/ListBooks on Catalog API with an optional search string to retrieve matching BookItem records.
Payload details
- Request (
ListBooksRequest):search(string, empty string returns unfiltered results). - Response (
ListBooksResponse):books(repeated BookItem).
Using this example
Returns StatusCode.OK with ListBooksResponse.Books containing matching BookItem projections.
using BookWorm.Catalog.Grpc.Services;using BookWorm.Chassis.Utilities;using BookWorm.Chassis.Utilities.Configurations;
// 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.ListBooksAsync( new() { Search = "Le Guin" }, deadline: DateTime.UtcNow.AddSeconds(10), cancellationToken: cancellationToken);1edition = "2023";
2
3package book.v1;
4
5service BookGrpcService {
6 rpc ListBooks (ListBooksRequest) returns (ListBooksResponse);
7}
8
9message ListBooksRequest {
10 string search = 1;
11}
12
13message ListBooksResponse {
14 repeated BookItem books = 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