Skip to content

fix: make MCP get schemas validator-safe#137

Merged
D4Vinci merged 2 commits intoD4Vinci:devfrom
robin-ede:fix/mcp-schema-auth-cookies
Feb 26, 2026
Merged

fix: make MCP get schemas validator-safe#137
D4Vinci merged 2 commits intoD4Vinci:devfrom
robin-ede:fix/mcp-schema-auth-cookies

Conversation

@robin-ede
Copy link
Contributor

@robin-ede robin-ede commented Feb 24, 2026

Summary

  • Use MCP-friendly input types for get and bulk_get by changing cookies, proxy_auth, and auth to dictionary-based schemas.
  • Add _NormalizeCredentials to convert auth dictionaries into tuple credentials expected by the fetchers.
  • Update parameter docs to reflect the new dictionary format for basic auth fields.

Why

Some strict MCP clients reject tuple/list-based JSON schema variants generated for these fields and fail tool registration with errors like array schema missing items. This change keeps runtime behavior while producing schemas that validate reliably across clients.

Validation

  • python3 -m py_compile scrapling/core/ai.py
  • OpenCode 1.2.10 compatibility check:
    • Before this patch: MCP tool registration failed with Invalid schema for function 'scrapling_get' ... array schema missing items.
    • After this patch: Scrapling MCP tools register successfully.

robin-ede and others added 2 commits February 23, 2026 19:49
Use JSON-object input types for cookies and basic-auth fields in get and bulk_get so strict MCP schema validators can register tools reliably.

Normalize auth dictionaries to the tuple format expected by fetchers to preserve runtime behavior.
@D4Vinci
Copy link
Owner

D4Vinci commented Feb 26, 2026

Looks good to me, thanks mate!

@D4Vinci D4Vinci merged commit 2904441 into D4Vinci:dev Feb 26, 2026
@D4Vinci D4Vinci mentioned this pull request Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants