---
id: ListBooksGrpc
name: List books over gRPC
version: 1.0.0
badges:
  - content: Catalog Management
    backgroundColor: green
    textColor: green
summary: Searches and lists Catalog books with full metadata through the book.v1 gRPC contract.
owners:
  - catalog-experience-team
schemaPath: schema.proto
sidebar:
  badge: "gRPC"
---

`ListBooksGrpc` invokes the internal `book.v1.BookGrpcService/ListBooks` gRPC unary RPC on [[service|catalog-api]] to search and list books with full metadata (descriptions, images, pricing, stock status, relationships, and rating summaries). [[service|mcp-server]] calls this RPC to power its `search_catalog` tool.

## Overview

| Property                           | Value                                                                                        |
| :--------------------------------- | :------------------------------------------------------------------------------------------- |
| **Bounded Context**                | Catalog                                                                                      |
| **Owner Service**                  | [[service\|catalog-api]]                                                                     |
| **Protocol / Format**              | gRPC unary RPC (`book.v1.BookGrpcService/ListBooks`), Protobuf `edition = "2023"`            |
| **Gateway Endpoint**               | Internal gRPC RPC `book.v1.BookGrpcService/ListBooks` (not exposed via API Gateway)          |
| **Authentication & Authorization** | Internal service-to-service anonymous read                                                   |
| **Idempotency / Concurrency**      | Read-only and naturally idempotent                                                           |
| **Rate Limit / Caching**           | Hybrid vector search (cached `5 min`) when `search` is non-empty; filtered page cached `60s` |
| **Contract Version**               | `1.0.0`                                                                                      |

:::note
This RPC uses fixed defaults (`pageIndex = 1`, `pageSize = 20`, `orderBy = "Name"`, `isDescending = false`) and does not expose paging parameters. Callers requiring multi-page traversal or price/relationship filters must use HTTP [[query|ListBooks]].
:::

## Request & Response Contract

### Request Message (`ListBooksRequest`)

| Name     | Type     | Required | Constraints                                 | Description                                             |
| :------- | :------- | :------- | :------------------------------------------ | :------------------------------------------------------ |
| `search` | `string` | No       | Tag `1`; blank/whitespace treated as `null` | Free-text search term executed via hybrid vector search |

### Success Response (`ListBooksResponse`)

| Name    | Type         | Required | Constraints                          | Description                                                                                                                    |
| :------ | :----------- | :------- | :----------------------------------- | :----------------------------------------------------------------------------------------------------------------------------- |
| `books` | `BookItem[]` | Yes      | Tag `1` (`repeated`); max `20` items | Matching books with full metadata (empty collection if zero matches). See [[query\|GetBookDetailsGrpc]] for `BookItem` fields. |

## Behavior & Side Effects

- **Hybrid search & caching:** When `search` is non-empty, executes hybrid vector search against Qdrant and filters matching books from PostgreSQL.
- **No state mutation:** Pure read RPC with no database writes or integration events.

## Error Responses

| Status / Code        | Condition                                                                                      | Client Recovery Action                      |
| :------------------- | :--------------------------------------------------------------------------------------------- | :------------------------------------------ |
| `Unavailable` (`14`) | Catalog API (or backing Qdrant/PostgreSQL dependency during an uncached search) is unreachable | Retry within the budgeted resilience policy |

## Related Documentation

- [[service|catalog-api]] — Service overview, persistence, and gRPC services.
- [[service|mcp-server]] — Primary caller exposing the `search_catalog` MCP tool.
- [[entity|book]] — Book entity model.
- [[query|ListBooks]] — Public HTTP `QUERY /catalog/api/v1/books` supporting pagination and rich filters.
- [[query|GetBookDetailsGrpc]] — Full `BookItem` field schema and single-book lookup.

<NodeGraph />

<SchemaViewer
	file="schema.proto"
	title="List books over gRPC schema"
	maxHeight="500"
	search="true"
/>


 ## Raw Schema:schema.proto

edition = "2023";

package book.v1;

service BookGrpcService {
  rpc ListBooks (ListBooksRequest) returns (ListBooksResponse);
}

message ListBooksRequest {
  string search = 1;
}

message ListBooksResponse {
  repeated BookItem books = 1;
}

message BookItem {
  string id = 1;
  string name = 2;
  string description = 3;
  string image_url = 4;
  DecimalValue price = 5;
  DecimalValue price_sale = 6;
  BookStatus status = 7;
  CategoryItem category = 8;
  PublisherItem publisher = 9;
  repeated AuthorItem authors = 10;
  double average_rating = 11;
  int32 total_reviews = 12;
}

enum BookStatus {
  BOOK_STATUS_UNSPECIFIED = 0;
  BOOK_STATUS_IN_STOCK = 1;
  BOOK_STATUS_OUT_OF_STOCK = 2;
}

message DecimalValue {
  int64 units = 1;
  sfixed32 nanos = 2;
}

message CategoryItem {
  string id = 1;
  string name = 2;
}

message PublisherItem {
  string id = 1;
  string name = 2;
}

message AuthorItem {
  string id = 1;
  string name = 2;
}
