Rewrite MCP tools to wrap SDK + add block tools #23
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!23
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "22-mcp-sdk-rewrite"
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
Rewrites all 26 existing MCP tools to wrap
pal-e-docs-sdkv0.1.0 instead of making raw httpx calls, and adds 7 new tools (6 block tools + delete_sprint) for 32 total tools with 100% SDK coverage.Changes
pyproject.toml— Replacehttpxdependency withpal-e-docs-sdk>=0.1.0, add Forgejo PyPI index ([tool.uv.sources]+[[tool.uv.index]]), bump version to 0.2.0, bumprequires-pythonto>=3.12to match SDKsrc/pal_e_docs_mcp/server.py— Replacehttpx.ClientwithPalEDocsClientviaget_sdk(),_ok()now takes parsed data (nothttpx.Response),_error_response()handlesPalEDocsErrorhierarchysrc/pal_e_docs_mcp/tools/notes.py— Rewrite 7 tools to wrap SDK; param translation forcontent->html_content,project->project_slug, CSVtags->list[str]src/pal_e_docs_mcp/tools/sprints.py— Rewrite 10 tools + adddelete_sprint; param translation for CSVlabels->list[str],_UNSETsentinel handling forupdate_sprint, defaultstatus="planning"forcreate_sprint, defaultposition=0foradd_sprint_itemsrc/pal_e_docs_mcp/tools/links.py— Rewrite 2 tools; CSVtarget_slugs->list[str]src/pal_e_docs_mcp/tools/projects.py— Rewrite 2 toolssrc/pal_e_docs_mcp/tools/repos.py— Rewrite 3 toolssrc/pal_e_docs_mcp/tools/tags.py— Rewrite 1 toolsrc/pal_e_docs_mcp/tools/__init__.py— Addblocksmodule registrationsrc/pal_e_docs_mcp/tools/blocks.py— 6 new block tools:get_note_toc,list_blocks,get_section,update_block,create_block,delete_blockuv.lock— Regenerated with SDK dependencyTest Plan
ruff checkandruff format --checkpassasyncio.run(mcp.list_tools()))httpximports in any source fileget_note_toc,get_section,get_note,list_tags,search_notesReview Checklist
ruff checkpassesruff format --checkpassesRelated
plan-2026-02-26-tf-modularize-postgres(Phase 8f)PR #23 Review
Phase 8f-2: Rewrite MCP tools to wrap SDK + add block/sprint tools.
I reviewed all source files on the
22-mcp-sdk-rewritebranch:server.py,__main__.py,tools/__init__.py, and all 7 tool modules (notes.py,tags.py,projects.py,repos.py,links.py,sprints.py,blocks.py). I cross-referenced every tool against the SDK mixin signatures inpal-e-docs-sdk.BLOCKERS
None.
NITS
Missing
__init__.pyat package root --/src/pal_e_docs_mcp/__init__.pydoes not exist. Hatchling'spackagesdirective makes this work for builds, but having an empty__init__.pyis conventional and helps IDEs. Non-blocking since hatch handles it..gitignoredoes not exclude.claude/-- The.claude/worktrees/decomposition-tools/directory exists in the repo tree. If this is local-only (git worktree), it's fine. If it were accidentally staged, it would be a problem. Recommend adding.claude/to.gitignoreas a safety measure.Tool count discrepancy -- Issue #22 says "26 existing + 7 new = 33 tools". Actual count from
@mcp.tool()decorators is 32 (7 notes + 1 tags + 2 projects + 3 repos + 2 links + 11 sprints + 6 blocks). Minor issue text inaccuracy, not a code problem.noqa: E741on variablel-- Insprints.pylines 162 and 199, the list comprehension useslas the loop variable in[l.strip() for l in labels.split(",")]. This triggers the ambiguous variable name lint and requiresnoqa. A rename tolblorlabelwould be cleaner. Non-blocking.Code Quality Assessment
Architecture: Clean modularization. Single
server.pywithget_sdk(),_ok(),_error_response()helpers. Seven tool modules registered viaregister_all_tools()intools/__init__.py. Good separation of concerns.SDK wrapping: All 32 tools correctly delegate to SDK methods. Zero raw
httpxcalls remain in the source tree. Verified by grep.Parameter translations (8 verified correct):
content->html_content(create_note, update_note)project->project_slug(create_note, update_note)tagsCSV string ->list[str](create_note, update_note)target_slugsCSV string ->list[str](update_note_links)labelsCSV string ->list[str](add_sprint_item, move_sprint_item)itemsJSON string ->list[dict](bulk_move_items)_UNSETsentinel handling forgoal,start_date,end_date(update_sprint)_UNSETsentinel handling forlabels(move_sprint_item via update_sprint_item)Error handling: Uniform try/except pattern across all tools.
_error_responsecorrectly handles thePalEDocsErrorhierarchy (base,NotFoundError,ValidationError,ServerError) and generic exceptions.New tools (7):
get_note_toc,list_blocks,get_section,update_block,create_block,delete_block-- all correctly wrap SDKBlocksMixinmethodsdelete_sprint-- correctly callsget_sdk().delete_sprint(slug)and returns_ok(None)pyproject.toml:
httpxdependency removed, replaced withpal-e-docs-sdk>=0.1.0. Forgejo PyPI index correctly configured via[tool.uv.sources]and[[tool.uv.index]].No secrets or credentials committed.
.envis in.gitignore.SOP COMPLIANCE
22-mcp-sdk-rewritereferences issue #22)tests/. The Woodpecker CI pipeline only runs ruff lint, no test step. This is consistent with the existing repo state (tests were likely never present), but worth noting.VERDICT: APPROVED
The rewrite is thorough and correct. All 32 tools properly wrap SDK methods with accurate parameter translations. The
_UNSETsentinel handling for nullable sprint fields is well-documented in comments. httpx is fully eliminated from the application code. The modular architecture (7 tool modules) is a clear improvement over whatever the previous monolithic structure was. No blockers found.