# BookStack MCP Schema Fix Summary
This note captures the changes that resolved the "invalid schema" errors raised by the MCP Inspector for the BookStack tools.
## What Was Going Wrong
- **Named list fields** (`filters`, `tags`, `items`, etc.) were described via `Sequence`/`TypedDict` hints that rendered as `"type": "array"` without item metadata. The inspector rejected these because it could not infer the structure of each item.
- **Cover image updates** relied on a JSON `image_id` field. BookStack ignores that field unless the request is multipart with an actual `image` upload, so calls appeared to succeed but did nothing.
## Fixes Applied
- Replaced abstract typing hints with concrete `list[dict]` + `json_schema_extra` blocks, so the generated JSON schema now describes each object shape precisely (for example, keys `name`/`value` for tags and `key`/`value` for filters).
- Added `_prepare_cover_image_from_gallery` and routed `image_id` through it. The helper fetches the gallery image, downloads the bytes, and replays the multipart upload so the BookStack API actually updates the cover.
- Allowed `bookstack_manage_content` + `bookstack_batch_operations` to pass `cover_image` through their pipelines, mirroring the behaviour already added for uploads.
- Tightened `bookstack_manage_images` create/update paths to insist on `uploaded_to` and generate correct multipart payloads, matching the official API expectations.
## Verification
- Added regression tests that simulate gallery-backed cover updates and book creation: `test_update_book_cover_from_gallery_image` and `test_create_book_with_gallery_image`.
- Re-ran the targeted suite: `python3 -m pytest fastmcp_server/tests/test_manage_content.py fastmcp_server/tests/test_manage_images.py fastmcp_server/tests/test_batch_operations.py`.
- Confirmed live BookStack calls now update covers when `image_id` is supplied.
With these changes the schemas validate cleanly, and cover updates function whether callers send a new image payload or reference an existing gallery upload.