@mastra/core
Version:
Mastra is a framework for building AI-powered applications and agents with a modern TypeScript stack.
35 lines (21 loc) • 847 B
Markdown
# DatasetsManager.list()
**Added in:** `@mastra/core@1.4.0`
Lists all datasets with pagination.
## Usage example
```typescript
import { Mastra } from '@mastra/core'
const mastra = new Mastra({
/* storage config */
})
const { datasets, pagination } = await mastra.datasets.list({ page: 0, perPage: 10 })
for (const ds of datasets) {
console.log(`${ds.id}: ${ds.name} (v${ds.version})`)
}
```
## Parameters
**page** (`number`): Page number. Defaults to \`0\`.
**perPage** (`number`): Number of datasets per page. Defaults to \`20\`.
## Returns
**result** (`Promise<object>`): Paginated dataset list.
**result.datasets** (`DatasetRecord[]`): Array of dataset records. See dataset.getDetails() for the record shape.
**result.pagination** (`PaginationInfo`): Pagination metadata with \`total\`, \`page\`, \`perPage\`, and \`hasMore\`.