Skip to content

mcp-server-aws-stepfunctions: list_state_machines returns only the first 100 results (missing pagination) #2050

@JulienJBO

Description

@JulienJBO

Describe the bug

list_state_machines in the AWS Step Functions MCP server does not handle AWS pagination (nextToken).
In accounts with more than 100 state machines, the tool only returns the first page (max 100) and there is no way to retrieve the remaining state machines.

This leads to incomplete inventories and incorrect results for any workflow relying on a full list of state machines.
This silently truncates results, which is easy to miss

Expected Behavior

When listing state machines, the server should return all state machines (or provide a supported way to page through results, e.g. exposing nextToken / maxResults).
At minimum, it should not silently truncate results at 100.

Current Behavior

The tool returns only the first page of results (≤ 100 state machines).
Additional pages are not fetched / nextToken is ignored, so state machines beyond the first 100 are never returned.

Reproduction Steps

1.	Use an AWS account/region with > 100 Step Functions state machines.
2.	Run the MCP Step Functions server.
3.	Call the tool that lists state machines (e.g. list_state_machines / equivalent tool in the server).
4.	Observe the tool returns only 100 items (or fewer), even though the account contains more.

Verification with AWS CLI (shows the full set; AWS CLI paginates automatically):
aws stepfunctions list-state-machines --region <REGION> --output json | jq '.stateMachines | length'

The MCP tool returns 100, while AWS CLI returns a larger number (e.g. 142).

Possible Solution

Implement pagination by looping on nextToken until it is absent, concatenating results (optionally bounded by a user-provided limit).

I opened a PR with a fix: #1923

Additional Information/Context

•	AWS ListStateMachines API supports pagination via nextToken and maxResults.
•	This is not region- or OS-specific; it reproduces anywhere there are >100 state machines.
•	Happy to adjust behavior if maintainers prefer exposing paging tokens instead of returning the full list by default.

OS

macOS 15.x (Apple Silicon)

Server

other

Server Version

0.1.16

Region experiencing the issue

all

Other information

No response

Service quota

  • I have reviewed the service quotas for this construct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds-triageThis needs to be handled, it is the first automatically assigned label to issues.

    Type

    No type

    Projects

    Status

    To triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions