# Search the library

Search Interlinea's library of Latin and Ancient Greek texts by author, work title or topic (war, love, the gods, friendship, death, rhetoric, letters, comedy).

Canonical: https://interlinea.aeterna-institute.org/docs/mcp/search_library

`tools/call search_library`

Matches English, Latin and Greek names and ignores accents. Returns authors and works, best known first, each with a url. Pass a work's url to get_text to read its opening, or a citation such as "Aeneid 4.1" to start elsewhere.

## Input

| Field | Type | Description |
|---|---|---|
| `query` | string | Words from a name or title, or a topic: "Virgil", "Aeneid", "Ὅμηρος", "war". Up to 200 characters. |
| `lang` | string | Optional. la for Latin, grc for Ancient Greek. One of `la`, `grc`. |
| `limit` | integer | Optional. Works to return, at most 50. Default `10`. From 1 to 50. |
| `offset` | integer | Optional. Default `0`. |

## Output

`structuredContent` has these fields, and `content` repeats the same JSON as one text item.

| Field | Type | Description |
|---|---|---|
| `query` | string |  |
| `lang` | string or null | Language code: la (Latin) or grc (Ancient Greek). One of `la`, `grc`. |
| `total` | integer | Matching works. |
| `offset` | integer |  |
| `limit` | integer |  |
| `next` | string or null | The next page of works. |
| `topics` | array of object | Hand-picked works for a topic the query names (war, love, the gods, …). |
| `topics[].key` | string |  |
| `topics[].label` | string |  |
| `topics[].blurb` | string |  |
| `topics[].works` | array of object |  |
| `topics[].works[].title` | string |  |
| `topics[].works[].nativeTitle` | string or null | The title in Latin or Greek, when it differs. |
| `topics[].works[].author` | string |  |
| `topics[].works[].lang` | string | Language code: la (Latin) or grc (Ancient Greek). One of `la`, `grc`. |
| `topics[].works[].genre` | string or null |  |
| `topics[].works[].words` | integer |  |
| `topics[].works[].sections` | integer | Reading sections. |
| `topics[].works[].urn` | string or null | CTS URN, e.g. urn:cts:latinLit:phi0690.phi003.perseus-lat2:1.1-1.11. Null when the edition has none (The Latin Library's own numbering). |
| `topics[].works[].url` | string | Absolute URL. |
| `topics[].works[].api` | string | Absolute URL. |
| `authors` | array of object |  |
| `authors[].name` | string |  |
| `authors[].nativeName` | string or null |  |
| `authors[].lang` | string | Language code: la (Latin) or grc (Ancient Greek). One of `la`, `grc`. |
| `authors[].period` | string or null |  |
| `authors[].url` | string | Absolute URL. |
| `authors[].api` | string | Absolute URL. |
| `works` | array of object |  |
| `works[].title` | string |  |
| `works[].nativeTitle` | string or null | The title in Latin or Greek, when it differs. |
| `works[].author` | string |  |
| `works[].lang` | string | Language code: la (Latin) or grc (Ancient Greek). One of `la`, `grc`. |
| `works[].genre` | string or null |  |
| `works[].words` | integer |  |
| `works[].sections` | integer | Reading sections. |
| `works[].urn` | string or null | CTS URN, e.g. urn:cts:latinLit:phi0690.phi003.perseus-lat2:1.1-1.11. Null when the edition has none (The Latin Library's own numbering). |
| `works[].url` | string | Absolute URL. |
| `works[].api` | string | Absolute URL. |

The same reads as [`GET /api/v1/search`](https://interlinea.aeterna-institute.org/docs/api/search.md), with the same shape.

## Example call

Arguments:

```json
{
  "query": "aeneid",
  "lang": "la"
}
```

curl:

```sh
curl https://interlinea.aeterna-institute.org/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"search_library","arguments":{"query":"aeneid","lang":"la"}}}'
```

TypeScript:

```js
import { Client, StreamableHTTPClientTransport } from "@modelcontextprotocol/client"

const client = new Client({ name: "my-app", version: "1.0.0" })
await client.connect(new StreamableHTTPClientTransport(new URL("https://interlinea.aeterna-institute.org/mcp")))

const result = await client.callTool({ name: "search_library", arguments: { "query": "aeneid", "lang": "la" } })
console.log(result.structuredContent)
```

## Example output

structuredContent:

```json
{
  "query": "aeneid",
  "lang": "la",
  "total": 4,
  "offset": 0,
  "limit": 10,
  "next": null,
  "topics": [],
  "authors": [
    {
      "name": "Vergil's Aeneid II",
      "nativeName": null,
      "lang": "la",
      "period": "late-republic-augustan",
      "url": "https://interlinea.aeterna-institute.org/library/latin/vergil-s-aeneid-ii",
      "api": "https://interlinea.aeterna-institute.org/api/v1/library/latin/vergil-s-aeneid-ii"
    }
  ],
  "works": [
    {
      "title": "Aeneid",
      "nativeTitle": null,
      "author": "Vergil's Aeneid II",
      "lang": "la",
      "genre": "epic",
      "words": 5172,
      "sections": 19,
      "urn": null,
      "url": "https://interlinea.aeterna-institute.org/library/latin/vergil-s-aeneid-ii/aeneid",
      "api": "https://interlinea.aeterna-institute.org/api/v1/library/latin/vergil-s-aeneid-ii/aeneid"
    },
    {
      "title": "Aeneid",
      "nativeTitle": "Aeneis",
      "author": "Virgil",
      "lang": "la",
      "genre": "epic",
      "words": 63347,
      "sections": 223,
      "urn": "urn:cts:latinLit:phi0690.phi003",
      "url": "https://interlinea.aeterna-institute.org/library/latin/virgil/aeneid",
      "api": "https://interlinea.aeterna-institute.org/api/v1/library/latin/virgil/aeneid"
    },
    {
      "title": "Selections from The Aeneid (19 B.C.)",
      "nativeTitle": null,
      "author": "Imperialisms, Ancient and Modern",
      "lang": "la",
      "genre": null,
      "words": 284,
      "sections": 1,
      "urn": null,
      "url": "https://interlinea.aeterna-institute.org/library/latin/imperialisms-ancient-and-modern/selections-from-the-aeneid-19-b-c",
      "api": "https://interlinea.aeterna-institute.org/api/v1/library/latin/imperialisms-ancient-and-modern/selections-from-the-aeneid-19-b-c"
    },
    // 1 more
  ]
}
```

---

Previous: [MCP server](https://interlinea.aeterna-institute.org/docs/mcp.md)
Next: [Read a text](https://interlinea.aeterna-institute.org/docs/mcp/get_text.md)
