Input Determination
Determine the publish type based on the materials provided by the user:
- A video file is provided → video note
- Images are provided → image-text note
- Only text is provided → prompt the user to provide at least images or a video
Constraints
- The title can contain at most 20 Chinese characters or English words (Xiaohongshu platform limit; anything longer will be truncated)
- An image-text note must have at least 1 image (Xiaohongshu does not allow text-only notes)
- Video notes only support absolute local video file paths (the MCP service needs to read local files)
- Images and videos cannot be mixed; only one of the two can be chosen (Xiaohongshu platform limit)
- Do not include # tags in the body text (tags are passed separately via the
tagsparameter; the MCP service will automatically handle the format) - Show the complete content to the user for confirmation before publishing (it cannot be withdrawn after publishing)
Execution Flow
1. Collect publishing information
Ensure the following content is complete:
title(required) — Titlecontent(required) — Body text- Image list or video path (one of them is required)
tags(optional) — Topic tagsschedule_at(optional) — Scheduled publishing, ISO8601 formatis_original(optional, image-text only) — Declare originalvisibility(optional) — Publicly visible | Visible only to me | Visible only to mutual followers
When the information is incomplete, ask the user for the missing parts.
2. Content Validation
- Check the title length (≤20 Chinese characters)
- Check whether the image/video file paths are absolute paths
- If the user provides URL content, first use WebFetch to extract the text and images
3. Confirm Publishing
Show the user a complete preview of the publishing content:
- Title, body text, tags
- Image list or video path
- Scheduled time, visibility scope (if any)
Wait for user confirmation before executing the publish.
4. Publish
Image-text note — Call publish_content:
title(string, required)content(string, required)images(string[], required) — Image path or URLtags(string[], optional)schedule_at(string, optional)is_original(bool, optional)visibility(string, optional)
Video note — Call publish_with_video:
title(string, required)content(string, required)video(string, required) — Absolute path to the local videotags(string[], optional)schedule_at(string, optional)visibility(string, optional)
5. Report the Result
After successful publishing, inform the user of the note ID and publishing status.
Failure Handling
| Scenario | Handling |
|---|---|
| Not logged in | Guide to use xhs-login |
| Title too long | Prompt the user to shorten the title |
| Invalid image path | Prompt to check whether the path is correct |
| The video uses a relative path | Prompt to change to an absolute path |
| Publish failed | Display the error message, suggest checking the content or retrying |