feat(mcp): h5p_play takes every attachment in files, and the card hands them to the page together
Fixes #301.
A person in ChatGPT attached nine pictures for a Course Presentation, and the model would not build it: h5p_play took one attachment. The probe (comment) measured that one call carries several attachments as a list, and that a later call can pass earlier ones again.
Changes
h5p_playtakesfiles, a list, named inopenai/fileParams, in place offile. Each item has the reference's schema. One attachment given alone, not in a list, is taken too.- Every attachment goes to the card once, by its id; still only references, never a file or its address.
- The answer says how many came, and that the card asks the person for any other.
- The instructions say to pass every attached file, from earlier in the chat too.
- The card matches the attachments to the names the play page asks for, as the page matches files: by name, then one of a kind to one of that kind, and one name to the one attachment.
- Pictures and other files are fetched one after another, with progress saying which one of how many, and handed over together in one message, after the videos' addresses.
- Given one alone, the page asked the person for the rest while they were still on their way.
- A file that does not come is named after the ones that did. An attachment the source does not name is not fetched.
- The skill's route 0 (
references/build/tools.md),design/mcp.md,design/author.mdand the README say "files". - A flaky card test checked the card's height before the chat resized its frame. It failed 1 in 2 runs on main's code too, and now waits for the resize.
Checked
pnpm testinpackages/mcp: 50 of 50 pass. The card tests ran 4 times in a row, 12 of 12 each.- New app test: three attachments with a duplicate, two of three, and one given alone.
- New card test: four attachments for four named files, matched by name and by kind; one message of files after the video's address; the unnamed attachment not fetched.
- End to end, the real card with the real play page from missing-elements.github.io (with its PR for the progress line) in a stand-in chat: three attachments for a Column of three pictures. The page went "Getting your files… 1 of 3" → building → ready and never asked the person;
IMG_9.pngtook the place ofc.png. - The builder: a Course Presentation with nine pictures builds with 9 media files.
- Not run: a Haiku run of route 0. Attachments as file objects come only from ChatGPT's
openai/fileParams, so the test is ChatGPT itself after the Worker is deployed.
Breaking
h5p_play's file is now files. A chat that kept the old tool list passes an attachment the server no longer reads. The answer then says that no attachment came, and the page asks the person. Refreshing the app takes the new list.
After merging
- The org site's play page shows which file of how many is coming (a PR in missing-elements.github.io), then the same in embed-my.org's copy.
- Release h5p-mcp (minor) and h5p-author (patch, for the skill's route 0), redeploy the Worker, and test in ChatGPT with several pictures.
Summary by cubic
Fixes #301, where nine attached pictures stopped ChatGPT from building a Course Presentation. h5p_play took one attachment, though one call carries several and a later call can pass earlier ones again, and the card now hands them to the page together.
h5p_play takes files, a list, in place of file. Every attachment goes to the card once by its id, never its address. The card matches each to the name the play page asks for, by name and then by kind, and hands all of them over together, the videos' addresses first; the one-name one-attachment match applies only the first time, and each batch is fetched with its own stop. Attachments beyond those the source names are counted in the reply but not used. The tool's instructions and the docs say to pass every attached file, from earlier in the chat too; a file that does not come is named, and the page asks the person. A flaky card test that checked the card's height before the chat resized its frame now waits for the resize.
Breaking
h5p_play's file is now files. A chat that kept the old tool list passes an attachment the server no longer reads: the answer says none came, and the page asks the person. Refreshing the app takes the new list.
After merging
Deploy the card's progress line to the org site's play page, then embed-my.org's copy. Release h5p-mcp (minor) and h5p-author (patch), redeploy the Worker, and test in ChatGPT with several pictures.