Custom Image Tagger
When to use
Use this skill when the user wants selected construction images analyzed and tagged in the current SharePoint image library. It supports one or more selected image files and writes concise metadata into library columns for primary objects, background objects, scene content, and description.
Use it for image metadata tagging in construction image libraries, not for general document tagging or non-image files.
Inputs
- One or more selected image files in the current SharePoint document library.
- Current site, library URL, library path, and list ID from SharePoint context.
- Target columns, resolved from schema when present:
Primary Objects/primaryObjectsBackground Objects/backgroundObjectsScene content/sceneContentDescription/_ExtendedDescription
Steps
- Confirm selected files are images by extension or file metadata. If no selected image is available, say so plainly and stop.
- Use
analyze_image({listFullUrl, relativePaths, question})once for all selected images. Ask for per-image output with:- primary objects as a single comma-delimited line
- background objects as a single comma-delimited line
- scene content as one concise sentence
- optional tags as a concise comma-delimited line
- Use
get_list_schema({listId, webUrl, includeFields: true, includeContentTypes: false, includeHidden: false, includeReadOnly: false})to resolve available target columns and exact internal names. - If
Primary Objects/primaryObjectsorBackground Objects/backgroundObjectsis missing, usecreate_or_update_liston the current library before updating items:- Keep the existing library settings.
- Add a single-line text column titled
Primary Objectswith internal nameprimaryObjectswhen missing. - Add a single-line text column titled
Background Objectswith internal namebackgroundObjectswhen missing. - Do not recreate or modify these columns if they already exist.
- After creating columns, use the expected internal names
primaryObjectsandbackgroundObjects; re-read schema only if the create/update result does not confirm the fields.
- Use
list_items({listId, webUrl, filter, viewFields: ["ID", "FileLeafRef"], itemType: "files", recursive: true})to find the list item IDs for the selected file names. UseFileLeafRefin CAML filters, notTitle. - Build one
update_list_items_v2({items, listUrl, webUrl})call for all matched images. Update only target columns that exist or were just created:primaryObjects= primary objects linebackgroundObjects= background objects linesceneContent= concise scene sentence, only when the column exists_ExtendedDescription=Tags: <tag line>or a concise description if tags are not requested, only when the column exists
- Keep each value under 255 characters for single-line text columns. Prefer fewer, high-confidence terms over long tag lists.
- If image analysis returns empty or uncertain content for an image, write
Not foundonly when appropriate and do not invent objects. - Return a concise per-image summary and confirm how many SharePoint items were updated. If object columns were created, mention that once. If any selected file could not be matched to a list item, name it in the response.
Output format
Return a concise result:
markdownUpdated <N> image(s). Created missing columns: <Primary Objects, Background Objects | none>. - <filename>: Primary: <comma-delimited objects>; Background: <comma-delimited objects>; Scene: <sentence>
If an update fails, include the plain-language failure and do not claim the item was updated.
Example
User: "Tag these images"
Expected behavior:
- Analyze all selected images with
analyze_image. - Resolve columns with
get_list_schema. - Create
Primary Objectsand/orBackground Objectsas single-line text columns if missing. - Find selected files with
list_itemsusingFileLeafRef. - Batch update metadata with
update_list_items_v2. - Report the updated filenames, extracted metadata, and whether columns were created.


