Prompt
Look in exports/ for today's MP4. Write a TikTok caption about what it shows (read exports/notes.txt), with a hook and 4 hashtags. Upload the video to /v1/media and create the TikTok draft. How to do it
- Connect TikTok and mint a key In https://app.socialhandoff.com, open Connections, connect TikTok, then open TikTok settings on the account and choose visibility, comment/duet/stitch, and commercial disclosure. Then create an agent key named Gemini CLI scoped to TikTok with draft and schedule permission.
- Add the server to settings.json In ~/.gemini/settings.json or the project .gemini/settings.json, add an mcpServers entry with httpUrl set to https://app.socialhandoff.com/mcp and a headers object carrying the bearer key.
- Attach media from the workspace Gemini CLI calls attach_media for the video or up to 35 photos: a public url, or the file as base64 data (up to 8 MB) with its mime type and alt text. Larger files go to POST https://app.socialhandoff.com/v1/media as multipart. The ids go into draft_post as mediaIds.
- Ask for the draft Run gemini in the project folder. It reads the notes, writes the caption, uploads the MP4 with curl, and calls draft_post with the id in mediaIds.
- Approve with the consent text The approval screen shows the visibility and interaction settings chosen in Connections and TikTok's consent text. Approve, and it publishes; a video is sent to TikTok in chunks.
Example draft
We taught our robot arm to sort LEGO by color. It gets about 9 out of 10 right. The 10th goes on the floor. #robotics #engineering #maker #lego [Video: today's MP4 from exports/, 27 seconds, vertical]
Gotchas
- Photo posts are fetched by URL, so the domain serving your media must be verified in the TikTok developer portal. Videos upload as bytes and skip this.
- Gemini CLI reads project settings over user settings. A stale .gemini/settings.json in the repo can point at the wrong instance.
- TikTok refuses text-only posts. The agent can draft the caption first, but approval and scheduling are refused until a video or photos are attached.
- Media: Every post needs one video or up to 35 photos. Text-only posts are not possible.
- Video upload: Videos upload in chunks of 5 to 64 MB; smaller files go in one piece. Maximum duration depends on the creator account.
- Photo posts: Up to 35 JPEG or WebP images, a title up to 90 characters, and a description up to 4,000 characters.
- Required choices: TikTok requires a visibility setting with no default, comment/duet/stitch toggles, and a commercial content disclosure.
Frequently asked questions
What does the reviewer see before approving?
The approval screen shows the caption, the media, the account's chosen settings, and TikTok's consent text, so the person approving knows exactly what will be posted.
Which key does Gemini CLI use for the URL?
httpUrl for streamable HTTP. The url key means SSE and will not connect to the /mcp endpoint.
Where do I choose who can see the video?
In Connections, TikTok settings reads the creator's live options and asks for visibility, comment, duet, stitch, and commercial content disclosure. Those choices apply to every post from that account.