Modern Treasury · Capability

Modern Treasury — Document

Modern Treasury — Document. 8 operations. Lead operation: list documents. Self-contained Naftiko capability covering one Modern Treasury business surface.

Run with Naftiko Modern TreasuryDocument

What You Can Do

GET
Listdocuments — list documents
/v1/api/documents
POST
Createdocument — create document
/v1/api/documents
GET
Getdocument — get document
/v1/api/documents/{id}
GET
Downloaddocument — download document
/v1/api/documents/{id}/download
GET
Listdocumentsnested — list documents - nested path (legacy)
/v1/api/{documentable-type}/{documentable-id}/documents
POST
Createdocumentnested — create document - nested path (legacy)
/v1/api/{documentable-type}/{documentable-id}/documents
GET
Getdocumentnested — get document - nested path (legacy)
/v1/api/{documentable-type}/{documentable-id}/documents/{id}
GET
Downloaddocumentnested — download document - nested path (legacy)
/v1/api/{documentable-type}/{documentable-id}/documents/{id}/download

MCP Tools

list-documents

list documents

read-only idempotent
create-document

create document

get-document

get document

read-only idempotent
download-document

download document

read-only idempotent
list-documents-nested-path-legacy

list documents - nested path (legacy)

read-only idempotent
create-document-nested-path-legacy

create document - nested path (legacy)

get-document-nested-path-legacy

get document - nested path (legacy)

read-only idempotent
download-document-nested-path-legacy

download document - nested path (legacy)

read-only idempotent

Capability Spec

modern-treasury-document.yaml Raw ↑
naftiko: 1.0.0-alpha2
info:
  label: Modern Treasury — Document
  description: 'Modern Treasury — Document. 8 operations. Lead operation: list documents. Self-contained Naftiko capability
    covering one Modern Treasury business surface.'
  tags:
  - Modern Treasury
  - Document
  created: '2026-05-19'
  modified: '2026-05-19'
binds:
- namespace: env
  keys:
    MODERN_TREASURY_API_KEY: MODERN_TREASURY_API_KEY
capability:
  consumes:
  - type: http
    namespace: modern-treasury-document
    baseUri: http://localhost:3000
    description: Modern Treasury — Document business capability. Self-contained, no shared references.
    resources:
    - name: api-documents
      path: /api/documents
      operations:
      - name: listdocuments
        method: GET
        description: list documents
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: documentable_id
          in: query
          type: string
          description: The unique identifier for the associated object.
        - name: documentable_type
          in: query
          type: string
          description: The type of the associated object. Currently can be one of `payment_order`, `transaction`, `expected_payment`,
            `counterparty`, `organization`, `case`, `internal
        - name: after_cursor
          in: query
          type: string
        - name: per_page
          in: query
          type: integer
      - name: createdocument
        method: POST
        description: create document
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: Idempotency-Key
          in: header
          type: string
          description: This key should be something unique, preferably something like an UUID.
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: false
    - name: api-documents-id
      path: /api/documents/{id}
      operations:
      - name: getdocument
        method: GET
        description: get document
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: api-documents-id-download
      path: /api/documents/{id}/download
      operations:
      - name: downloaddocument
        method: GET
        description: download document
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: api-documentable_type-documentable_id-documents
      path: /api/{documentable_type}/{documentable_id}/documents
      operations:
      - name: listdocumentsnested
        method: GET
        description: list documents - nested path (legacy)
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: documentable_id
          in: path
          type: string
          description: The unique identifier for the associated object.
          required: true
        - name: documentable_type
          in: path
          type: string
          description: The type of the associated object. Currently can be one of `payment_order`, `transaction`, `expected_payment`,
            `counterparty`, `organization`, `case`, `internal
          required: true
        - name: document_type
          in: query
          type: string
          description: A category given to the document, can be `null`.
        - name: after_cursor
          in: query
          type: string
        - name: per_page
          in: query
          type: integer
      - name: createdocumentnested
        method: POST
        description: create document - nested path (legacy)
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: documentable_id
          in: path
          type: string
          description: The unique identifier for the associated object.
          required: true
        - name: documentable_type
          in: path
          type: string
          description: The type of the associated object. Currently can be one of `payment_order`, `transaction`, `expected_payment`,
            `counterparty`, `organization`, `case`, `internal
          required: true
        - name: Idempotency-Key
          in: header
          type: string
          description: This key should be something unique, preferably something like an UUID.
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: false
    - name: api-documentable_type-documentable_id-documents-id
      path: /api/{documentable_type}/{documentable_id}/documents/{id}
      operations:
      - name: getdocumentnested
        method: GET
        description: get document - nested path (legacy)
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: api-documentable_type-documentable_id-documents-id-download
      path: /api/{documentable_type}/{documentable_id}/documents/{id}/download
      operations:
      - name: downloaddocumentnested
        method: GET
        description: download document - nested path (legacy)
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    authentication:
      type: basic
      username: '{{env.MODERN_TREASURY_USER}}'
      password: '{{env.MODERN_TREASURY_PASS}}'
  exposes:
  - type: rest
    namespace: modern-treasury-document-rest
    port: 8080
    description: REST adapter for Modern Treasury — Document. One Spectral-compliant resource per consumed operation, prefixed
      with /v1.
    resources:
    - path: /v1/api/documents
      name: api-documents
      description: REST surface for api-documents.
      operations:
      - method: GET
        name: listdocuments
        description: list documents
        call: modern-treasury-document.listdocuments
        with:
          documentable_id: rest.documentable_id
          documentable_type: rest.documentable_type
          after_cursor: rest.after_cursor
          per_page: rest.per_page
        outputParameters:
        - type: object
          mapping: $.
      - method: POST
        name: createdocument
        description: create document
        call: modern-treasury-document.createdocument
        with:
          Idempotency-Key: rest.Idempotency-Key
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/api/documents/{id}
      name: api-documents-id
      description: REST surface for api-documents-id.
      operations:
      - method: GET
        name: getdocument
        description: get document
        call: modern-treasury-document.getdocument
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/api/documents/{id}/download
      name: api-documents-id-download
      description: REST surface for api-documents-id-download.
      operations:
      - method: GET
        name: downloaddocument
        description: download document
        call: modern-treasury-document.downloaddocument
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/api/{documentable-type}/{documentable-id}/documents
      name: api-documentable-type-documentable-id-documents
      description: REST surface for api-documentable_type-documentable_id-documents.
      operations:
      - method: GET
        name: listdocumentsnested
        description: list documents - nested path (legacy)
        call: modern-treasury-document.listdocumentsnested
        with:
          documentable_id: rest.documentable_id
          documentable_type: rest.documentable_type
          document_type: rest.document_type
          after_cursor: rest.after_cursor
          per_page: rest.per_page
        outputParameters:
        - type: object
          mapping: $.
      - method: POST
        name: createdocumentnested
        description: create document - nested path (legacy)
        call: modern-treasury-document.createdocumentnested
        with:
          documentable_id: rest.documentable_id
          documentable_type: rest.documentable_type
          Idempotency-Key: rest.Idempotency-Key
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/api/{documentable-type}/{documentable-id}/documents/{id}
      name: api-documentable-type-documentable-id-documents-id
      description: REST surface for api-documentable_type-documentable_id-documents-id.
      operations:
      - method: GET
        name: getdocumentnested
        description: get document - nested path (legacy)
        call: modern-treasury-document.getdocumentnested
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/api/{documentable-type}/{documentable-id}/documents/{id}/download
      name: api-documentable-type-documentable-id-documents-id-download
      description: REST surface for api-documentable_type-documentable_id-documents-id-download.
      operations:
      - method: GET
        name: downloaddocumentnested
        description: download document - nested path (legacy)
        call: modern-treasury-document.downloaddocumentnested
        outputParameters:
        - type: object
          mapping: $.
  - type: mcp
    namespace: modern-treasury-document-mcp
    port: 9090
    transport: http
    description: MCP adapter for Modern Treasury — Document. One tool per consumed operation, routed inline through this capability's
      consumes block.
    tools:
    - name: list-documents
      description: list documents
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: modern-treasury-document.listdocuments
      with:
        documentable_id: tools.documentable_id
        documentable_type: tools.documentable_type
        after_cursor: tools.after_cursor
        per_page: tools.per_page
      outputParameters:
      - type: object
        mapping: $.
    - name: create-document
      description: create document
      hints:
        readOnly: false
        destructive: false
        idempotent: false
      call: modern-treasury-document.createdocument
      with:
        Idempotency-Key: tools.Idempotency-Key
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.
    - name: get-document
      description: get document
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: modern-treasury-document.getdocument
      outputParameters:
      - type: object
        mapping: $.
    - name: download-document
      description: download document
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: modern-treasury-document.downloaddocument
      outputParameters:
      - type: object
        mapping: $.
    - name: list-documents-nested-path-legacy
      description: list documents - nested path (legacy)
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: modern-treasury-document.listdocumentsnested
      with:
        documentable_id: tools.documentable_id
        documentable_type: tools.documentable_type
        document_type: tools.document_type
        after_cursor: tools.after_cursor
        per_page: tools.per_page
      outputParameters:
      - type: object
        mapping: $.
    - name: create-document-nested-path-legacy
      description: create document - nested path (legacy)
      hints:
        readOnly: false
        destructive: false
        idempotent: false
      call: modern-treasury-document.createdocumentnested
      with:
        documentable_id: tools.documentable_id
        documentable_type: tools.documentable_type
        Idempotency-Key: tools.Idempotency-Key
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.
    - name: get-document-nested-path-legacy
      description: get document - nested path (legacy)
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: modern-treasury-document.getdocumentnested
      outputParameters:
      - type: object
        mapping: $.
    - name: download-document-nested-path-legacy
      description: download document - nested path (legacy)
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: modern-treasury-document.downloaddocumentnested
      outputParameters:
      - type: object
        mapping: $.