Skip to content

refactor(tools): model_dump() instead of the deprecated Pydantic dict() - #197

Merged
Cipher208 merged 1 commit into
masterfrom
fix/pydantic-model-dump
Nov 4, 2026
Merged

Cipher208 merged 1 commit into
masterfrom
fix/pydantic-model-dump

Conversation

@Cipher208

Copy link
Copy Markdown
Owner

Why

Every tool result model serialized through Pydantic v1's .dict(); Pydantic 2.x answers each call with PydanticDeprecatedSince20. That was 157 of the suite's 172 warnings — real signal drowned in deprecation noise.

What

All 34 call sites in mcp_server/tools/ now use .model_dump() — memory (5), ops (16), session/episodic/graph (2 each), forget/project (2 each), think/dream/evolve (1 each).

The returned dict is unchanged: every receiver is a *Result inheriting _ResultBase(BaseModel) with extra="forbid" and no aliases or custom dict(), and all 34 calls are argument-free. Proven:

  • red/green: test_think_declared.py -W error::DeprecationWarning fails on base with PydanticDeprecatedSince20, passes here;
  • full suite 2868 passed; warnings 172 → 15, zero Pydantic deprecations (remainder: 10 RuntimeWarning / 4 intentional saga-rotation DeprecationWarning / 1 sklearn FutureWarning — other classes);
  • ruff clean · mypy 42 = baseline.

Every tool result model serialized through Pydantic v1's .dict(), which
Pydantic 2.x answers with PydanticDeprecatedSince20 — 157 of the suite's
172 warnings. All 34 call sites now use .model_dump(); the returned dict
is unchanged (no aliases or custom config), which the full suite proves.
@coderabbitai

coderabbitai Bot commented Nov 4, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions github-actions Bot added the chore label Nov 4, 2026
@Cipher208
Cipher208 merged commit 8e538ab into master Nov 4, 2026
19 checks passed
@Cipher208
Cipher208 deleted the fix/pydantic-model-dump branch November 4, 2026 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant