docs(quick): record 261128-jv2 journal MCP category show/update tools

This commit is contained in:
Jakub Zych
2026-11-28 15:05:45 +01:00
parent db7bec7c0c
commit fe6813e8ac
2 changed files with 46 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
---
quick_id: 261128-jv2
slug: journal-mcp-category-show-update
date: 2026-11-28
g15office: losefket
repos:
- ../sm-journal-plugin
status: in_progress
---
# Quick Task: Journal MCP Category Read & Edit (`journal_show_category`, `journal_update_category`)
## Goal
Close g15office `losefket` by adding single-category read and update endpoints + MCP tools to `sm-journal-plugin`:
- `GET /_journal/api/v1/categories/{slug}` (`ShowCategory`) → MCP `journal_show_category` (`golem15.journal.access_posts`)
- `PUT /_journal/api/v1/categories/{id}` (`UpdateCategory`) → MCP `journal_update_category` (`golem15.journal.access_categories`)
## Tasks
1. Add `controllers/api/categories.go` (`ShowCategory`, `UpdateCategory`) with `EmbedRegistryFrom(app).SanitizeHTML`, `EffectiveH1ToH2` + `ConvertH1` notices, `cabana.EmitRecordSaved`, and `cooler.PurgeSiteCacheAfterCommit`.
2. Mount routes in `routes.go` and register `show_category` and `update_category` in `mcp.go`.
3. Update `mcp_test.go`, `mcp_smoke_test.go`, add `controllers/api/categories_test.go`, and update `sm-journal-plugin/README.md`.
4. Run `go vet ./...`, `go test -race -short ./...`, and `bash scripts/check-phase38.sh`.
5. Commit changes, record `SUMMARY.md`, and update g15office `losefket`.

View File

@@ -0,0 +1,21 @@
---
quick_id: 261128-jv2
slug: journal-mcp-category-show-update
date: 2026-11-28
g15office: losefket
status: complete
repos:
- ../sm-journal-plugin
---
# Quick Task Summary: Journal MCP Category Read & Edit (`sm-journal-plugin`)
Added single-category read and partial-update REST routes and MCP tools to `sm-journal-plugin`:
- **`GET /_journal/api/v1/categories/{slug}`** (`controllers/api/categories.go` `ShowCategory`) → MCP **`journal_show_category`** (`golem15.journal.access_posts`). Resolves by default slug, translated slug (for request locale), or numeric ID; returns `id`, `name`, `slug`, `description`, `content`, `parent_id`, `nest_depth`, `post_count`, `content_h1_to_h2`, and `translations`.
- **`PUT /_journal/api/v1/categories/{id}`** (`controllers/api/categories.go` `UpdateCategory`) → MCP **`journal_update_category`** (`golem15.journal.access_categories`). Partial update for `name`, `slug`, `description`, `content` (sanitized via `classes.EmbedRegistryFrom(app).SanitizeHTML`, H1→H2 conversion with `notices` when `EffectiveH1ToH2` is on, blank stored as `NULL`), and optional `translations`. Emits `cabana.EmitRecordSaved` inside `lagoon.Transaction` and purges site cache via `cooler.PurgeSiteCacheAfterCommit`.
- **Tests & Docs:** Updated `mcp_test.go` and `mcp_smoke_test.go`, added `controllers/api/categories_test.go`, and documented the new tools in `../sm-journal-plugin/README.md`.
## Verification
- `cd ../sm-journal-plugin && go vet ./... && go test -race -short ./... && go test -tags summercms_mcp -race -short ./...` — PASS (all 6 test packages green under `-race` in both default and `summercms_mcp` builds).