Skip to content

fix(stepfunctions-tool-mcp-server): paginate list_state_machines - #4864

Open
mangeshraut712 wants to merge 3 commits into
awslabs:mainfrom
mangeshraut712:fix/stepfunctions-paginate-list-state-machines
Open

mangeshraut712 wants to merge 3 commits into
awslabs:mainfrom
mangeshraut712:fix/stepfunctions-paginate-list-state-machines

Conversation

@mangeshraut712

Copy link
Copy Markdown
Contributor

Fixes #2050

Summary

Changes

register_state_machines() called sfn_client.list_state_machines() once and never followed nextToken. In an account with more than 100 state machines, everything past the first page was dropped with no error, so those state machines never registered as MCP tools.

This adds get_all_state_machines(), which uses the boto3 paginator (get_paginator('list_state_machines')) and concatenates stateMachines across pages. register_state_machines() now calls that helper. The shape matches get_all_lambda_functions() in lambda-tool-mcp-server.

Existing unit tests that mocked list_state_machines now mock the paginator. Added test_get_all_state_machines.py for single-page, multi-page, and empty results, plus test_register_machines_across_multiple_pages so tools from both pages are registered.

User experience

Before: only the first page (up to 100) of state machines became MCP tools. After: every page is registered.

Checklist

  • I have reviewed the contributing guidelines
  • I have performed a self-review of this change
  • Changes have been tested
  • Changes are documented (helper docstring + regression tests)

Tests: uv run pytest -q in src/stepfunctions-tool-mcp-server (65 passed, 100% coverage). ruff check clean on the touched files.

Is this a breaking change? (Y/N) N

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.

@mangeshraut712

Copy link
Copy Markdown
Contributor Author

CI is green. Paginates list_state_machines so large accounts are not truncated. Please review and merge when you can.

@mangeshraut712
mangeshraut712 force-pushed the fix/stepfunctions-paginate-list-state-machines branch from 55c9cd0 to a4fa482 Compare October 27, 2026 14:37
register_state_machines() called list_state_machines() once and never
followed nextToken, so accounts with more than 100 state machines had
tools silently registered only for the first page. Use the boto3
paginator, matching the pattern lambda-tool-mcp-server already uses
for list_functions.

Fixes awslabs#2050
@mangeshraut712
mangeshraut712 force-pushed the fix/stepfunctions-paginate-list-state-machines branch from 805c3a3 to e79f4fe Compare October 28, 2026 04:43

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To triage

Development

Successfully merging this pull request may close these issues.

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

1 participant