An API of Ice And Fire · Capability

An API of Ice And Fire — Books

Books — the canon of A Song of Ice and Fire. 2 operations. Lead operation: An API of Ice And Fire List Books. Self-contained Naftiko capability covering one An API of Ice And Fire business surface.

Run with Naftiko An API of Ice And FireBooksA Song of Ice and Fire

What You Can Do

GET
Listbooks — List Books in the A Song of Ice and Fire series.
/v1/books
GET
Getbook — Get Book by ID.
/v1/books/{id}

MCP Tools

list-books

List Books in the A Song of Ice and Fire series.

read-only idempotent
get-book

Get a specific book by its numeric ID.

read-only idempotent

Capability Spec

an-api-of-ice-and-fire-books.yaml Raw ↑
naftiko: "1.0.0-alpha2"

info:
  label: "An API of Ice And Fire — Books"
  description: >-
    Books — the canon of A Song of Ice and Fire. 2 operations.
    Lead operation: An API of Ice And Fire List Books.
    Self-contained Naftiko capability covering one An API of Ice And Fire
    business surface.
  tags:
    - An API of Ice And Fire
    - Books
    - A Song of Ice and Fire
  created: "2026-05-30"
  modified: "2026-05-30"

binds:
  - namespace: env
    keys: {}

capability:

  # ── 1. Consumes — upstream HTTP API ─────────────────────────────────────
  consumes:
    - type: http
      namespace: "an-api-of-ice-and-fire-books"
      baseUri: "https://anapioficeandfire.com/api"
      description: >-
        An API of Ice And Fire — Books business capability. Self-contained,
        no shared references. No authentication required; rate-limited to
        20,000 requests per IP per day.
      resources:
        - name: "books"
          path: "/books"
          operations:
            - name: "listBooks"
              method: GET
              description: "List Books in the A Song of Ice and Fire series."
              inputParameters:
                - name: "page"
                  in: query
                  type: integer
                  required: false
                  description: "Page number (1-indexed)."
                - name: "pageSize"
                  in: query
                  type: integer
                  required: false
                  description: "Items per page (default 10, max 50)."
                - name: "name"
                  in: query
                  type: string
                  required: false
                  description: "Filter books by exact book name."
                - name: "fromReleaseDate"
                  in: query
                  type: string
                  required: false
                  description: "Only include books released on or after this date."
                - name: "toReleaseDate"
                  in: query
                  type: string
                  required: false
                  description: "Only include books released on or before this date."
              outputRawFormat: json
              outputParameters:
                - name: result
                  type: object
                  value: "$."
        - name: "books-by-id"
          path: "/books/{id}"
          operations:
            - name: "getBook"
              method: GET
              description: "Get Book by ID with full hypermedia character references."
              inputParameters:
                - name: "id"
                  in: path
                  type: integer
                  required: true
                  description: "Numeric book identifier."
              outputRawFormat: json
              outputParameters:
                - name: result
                  type: object
                  value: "$."

  # ── 2. REST exposer ─────────────────────────────────────────────────────
  exposes:
    - type: rest
      namespace: "an-api-of-ice-and-fire-books-rest"
      port: 8080
      description: >-
        REST adapter for An API of Ice And Fire — Books. One Spectral-compliant
        resource per consumed operation, prefixed with /v1.
      resources:
        - path: "/v1/books"
          name: "books"
          description: "REST surface for the books collection."
          operations:
            - method: GET
              name: "listBooks"
              description: "List Books in the A Song of Ice and Fire series."
              call: "an-api-of-ice-and-fire-books.listBooks"
              with:
                page: "rest.page"
                pageSize: "rest.pageSize"
                name: "rest.name"
                fromReleaseDate: "rest.fromReleaseDate"
                toReleaseDate: "rest.toReleaseDate"
              outputParameters:
                - type: object
                  mapping: "$."
        - path: "/v1/books/{id}"
          name: "books-by-id"
          description: "REST surface for retrieving a single book by ID."
          operations:
            - method: GET
              name: "getBook"
              description: "Get Book by ID."
              call: "an-api-of-ice-and-fire-books.getBook"
              with:
                id: "rest.id"
              outputParameters:
                - type: object
                  mapping: "$."

  # ── 3. MCP exposer ──────────────────────────────────────────────────────
    - type: mcp
      namespace: "an-api-of-ice-and-fire-books-mcp"
      port: 9090
      transport: http
      description: >-
        MCP adapter for An API of Ice And Fire — Books. One verb-noun tool
        per consumed operation, routed through this capability's consumes
        block.
      tools:
        - name: "list-books"
          description: "List Books in the A Song of Ice and Fire series."
          hints:
            readOnly: true
            destructive: false
            idempotent: true
          call: "an-api-of-ice-and-fire-books.listBooks"
          with:
            page: "tools.page"
            pageSize: "tools.pageSize"
            name: "tools.name"
            fromReleaseDate: "tools.fromReleaseDate"
            toReleaseDate: "tools.toReleaseDate"
          outputParameters:
            - type: object
              mapping: "$."
        - name: "get-book"
          description: "Get a specific book by its numeric ID."
          hints:
            readOnly: true
            destructive: false
            idempotent: true
          call: "an-api-of-ice-and-fire-books.getBook"
          with:
            id: "tools.id"
          outputParameters:
            - type: object
              mapping: "$."