Fix block content param type: str -> dict|str with JSON parsing #27
No reviewers
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo_admin/pal-e-mcp!27
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "26-fix-create-block-and-update-block-conten"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The
create_blockandupdate_blockMCP tools typedcontentasstr, but the pal-e-docs REST API expects a JSON dict. This caused a catch-22 where dict input was rejected by Pydantic validation and string input was rejected by the API. Fixed by changing the type todict | str | Nonewith automatic JSON parsing for string inputs.Changes
src/pal_e_docs_mcp/tools/blocks.py— Changedcontentparam type fromstr | Nonetodict | str | Nonein bothcreate_blockandupdate_block. Added_parse_contenthelper that normalises content (dict pass-through, JSON string auto-parse, None pass-through). Updated field descriptions with content shapes per block type (heading, paragraph, list, table, code).tests/conftest.py— Addedblocks_modtomock_sdkfixture so block tool tests can use the shared mock.tests/test_param_alignment.py— Added 14 new tests: 6 for_parse_contentunit tests (None, dict, valid JSON string, invalid JSON, JSON array, JSON scalar), 4 forcreate_blockcontent handling, 4 forupdate_blockcontent handling.Test Plan
uv run pytest tests/ -v— full passuv run ruff check src/ tests/— cleanuv run ruff format --check src/ tests/— cleanReview Checklist
contentparam type changed fromstr | Nonetodict | str | Nonein both tools_parse_contenthelper handles dict, JSON string, None, and error casesget_sdkfor blocks moduleRelated
todo-mcp-block-content-type