Skip to content

fix: Reject limit below 1 on the run, dataset and store list tools - #1582

Merged
jirispilka merged 1 commit into
masterfrom
fix/list-limit-min
Oct 15, 2026
Merged

jirispilka merged 1 commit into
masterfrom
fix/list-limit-min

Conversation

@jirispilka

Copy link
Copy Markdown
Collaborator

Why

Closes #1479.

get-actor-run-list, get-dataset-list and get-key-value-store-list accepted limit: 0. apify-client drops a zero limit, so the API returned its default page of up to 1,000 items from tools that cap limit at 10 or 20.

What changed

limit in the three schemas gets .int().min(1), as in get-actor-list and get-actor-build-list. Defaults and maximums are unchanged (runs 10/10, datasets 10/20, stores 10/10).

Tool contract change: in tools/list, limit goes from {"type":"number","maximum":N,"default":10} to {"type":"integer","minimum":1,"maximum":N,"default":10}. Zero, negative and fractional values (and null, which AJV coerces to 0) now fail validation with -32602 before any API request.

Notes for reviewers (human-written)

Proof it works

mcpc against two local stdio builds (master and this branch, 0.18.3), --tools runs,storage:

Tool limit master this branch
get-actor-run-list 0 result with limit: 1000, 786 runs -32602 /limit: must be >= 1
get-dataset-list 0 result with limit: 1000, 11 datasets -32602 /limit: must be >= 1
get-key-value-store-list 0 result with limit: 1000, 18 stores -32602 /limit: must be >= 1
all three -1 tool error from apify-client: "Expected property number limit to not be negative" -32602 /limit: must be >= 1
all three 1.5 result with limit: 1 -32602 /limit: must be integer
all three 1 result with limit: 1 same

Unit tests (failed on master for 0, -1 and 1.5): per-tool AJV boundaries (0, -1, 1.5, max+1 rejected; 1, max and omitted accepted), and a tools/call test per tool showing -32602 with no runs() / datasets() / keyValueStores() call, with limit: 1 as a control that does reach the client.

Same class, not changed here: get-key-value-store-keys limit, get-dataset-schema limit, and offset on these three tools.

AI-assisted: Claude Code wrote the change, tests and this description, and ran the mcpc probe. Issue reported by @ondraulehla.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CPzYK17FoL2F3cuVonqnej


Generated by Claude Code

get-actor-run-list, get-dataset-list and get-key-value-store-list took
limit 0, negative and fractional values. apify-client drops limit 0, so
the API returned its 1,000-item default page. The three limit schemas
now require an integer of at least 1, as get-actor-build-list and
get-actor-list do; invalid values fail validation before any request.

Closes #1479

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CPzYK17FoL2F3cuVonqnej
@jirispilka
jirispilka marked this pull request as ready for review October 14, 2026 11:21
@apify-service-account apify-service-account added the tested Temporary label used only programatically for some analytics. label Oct 14, 2026
@apify-service-account apify-service-account added the t-ai Issues owned by the AI team. label Oct 14, 2026
@jirispilka
jirispilka merged commit 5eebfec into master Oct 15, 2026
22 of 24 checks passed
@jirispilka
jirispilka deleted the fix/list-limit-min branch October 15, 2026 10:19
jirispilka pushed a commit that referenced this pull request Oct 15, 2026
…med-filter

Conflicts in the dataset and key-value store list tests: kept this branch's
named/empty-page tests and master's limit validation tests from #1582, which
replace the old "rejects limit above N" test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CPzYK17FoL2F3cuVonqnej
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-ai Issues owned by the AI team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: limit: 0 passes validation on three list tools and the platform returns up to 1000 items

4 participants