---
title: "postgres-list-sequences"
type: docs
weight: 1
description: >
 The "postgres-list-sequences" tool lists sequences in a Postgres database.
aliases:
- /resources/tools/postgres-list-sequences
---

## About

The `postgres-list-sequences` tool retrieves information about sequences in a
Postgres database. It's compatible with any of the following sources:

- [alloydb-postgres](../../sources/alloydb-pg.md)
- [cloud-sql-postgres](../../sources/cloud-sql-pg.md)
- [postgres](../../sources/postgres.md)

`postgres-list-sequences` lists detailed information as JSON for all sequences.
The tool takes the following input parameters:

- `sequence_name` (optional): A text to filter results by sequence name. The
  input is used within a LIKE clause. Default: `""`
- `schema_name` (optional): A text to filter results by schema name. The input is
  used within a LIKE clause. Default: `""`
- `limit` (optional): The maximum number of rows to return. Default: `50`.

## Example

```yaml
tools:
  list_indexes:
    kind: postgres-list-sequences
    source: postgres-source
    description: |
        Lists all the sequences in the database ordered by sequence name.
        Returns sequence name, schema name, sequence owner, data type of the
        sequence, starting value, minimum value, maximum value of the sequence,
        the value by which the sequence is incremented, and the last value
        generated by generated by the sequence in the current session.
```

The response is a json array with the following elements:

```json
{
    "sequence_name": "sequence name",
    "schema_name": "schema name",
    "sequence_owner": "owner of the sequence",
    "data_type": "data type of the sequence",
    "start_value": "starting value of the sequence",
    "min_value": "minimum value of the sequence",
    "max_value": "maximum value of the sequence",
    "increment_by": "increment value of the sequence",
    "last_value": "last value of the sequence"
}
```

## Reference

| **field**   | **type** | **required** | **description**                                      |
|-------------|:--------:|:------------:|------------------------------------------------------|
| kind        |  string  |     true     | Must be "postgres-list-sequences".                   |
| source      |  string  |     true     | Name of the source the SQL should execute on.        |
| description |  string  |    false     | Description of the tool that is passed to the agent. |
