Skip to content

Image tools of the MCP server ​

The 11 tools that work on single images or on lists of images. How to connect, and how results and errors come back, is in Connecting a client. To query the images of a dataset, use dataset_images in Dataset tools.

Reading ​

image_get ​

Returns one image: its dataset, division, class, labeled flag, groups, annotations (tags), comments and file locations.

ParameterTypeRequiredMeaning
imageIdstringyes
urlsbooleannoAdd originalUrl, a URL to download the original file (null if it cannot be worked out), next to the preview URLs
fieldsarray of stringsnoReturn these stored fields instead of the summary

The strokes of the masks are left out unless fields includes masks.

image_get_by_name ​

Finds an image of a dataset by its file name; the extension is optional. Returns the same as image_get.

ParameterTypeRequired
datasetIdstringyes
namestringyes
urlsbooleanno
fieldsarray of stringsno

image_comments ​

The free-text comment and the point comments of an image.

ParameterTypeRequired
imageIdstringyes

Editing ​

image_set_division ​

Moves images to a division.

ParameterTypeRequiredMeaning
imageIdsarray of stringsyesAt least one
settrain, test, validation, predetermined or reviewyes

image_set_tag ​

Sets the class of one or more images. For datasets with one class per image: MULTICLASS and ANOMALY. Answers tag <id> not found in <dataset> if the tag does not exist.

ParameterTypeRequired
imageIdsarray of stringsyes
datasetIdstringyes
tagIdstringyes

image_set_labeled ​

Marks images as labeled or not labeled.

ParameterTypeRequiredMeaning
imageIdsarray of stringsyes
labeledbooleanyes
clearAnnotationsbooleannoOnly with labeled: false: also removes the boxes and tags of the images

image_groups_update ​

Adds images to groups, removes them from groups, or takes them out of all their groups.

ParameterTypeRequiredMeaning
imageIdsarray of stringsyes
actionadd, remove or clearyes
groupIdsarray of stringsfor add and remove

image_set_comments ​

Writes the free-text comment of an image, its point comments, or both. At least one of the two is required.

ParameterTypeRequired
imageIdstringyes
commentsstringno
pointCommentsarray of objectsno

Uploading ​

image_upload ​

Uploads one image into a dataset and creates its previews. Returns imageId.

ParameterTypeRequiredMeaning
datasetIdstringyes
fileNamestringyesFile name with extension, such as part_001.jpg
sourceobjectyesWhere the image comes from: one of url, gsUri or base64
tagIdstringnoClass of the image
sourceMeaning
{ "url": "https://…" }The server downloads the image from this URL
{ "gsUri": "gs://…" }A file in cloud storage that the project can read
{ "base64": "…" }The content of the file in base64, with or without a data: prefix

The new image starts in the PREDETERMINED division, not labeled. The call fails if the dataset already has an image with that name; the extension is not compared, so part_001.png is refused when part_001.jpg exists. With tagId, a MULTICLASS dataset creates the tag when it is missing; in the other types the tag has to exist, and if it does not the image stays uploaded without class and the answer says so.

image_upload_annotations ​

Imports box annotations for images that are already in the dataset, for detection, oriented-box and OCR datasets. The annotations of each image named in the file are replaced, tags that do not exist yet are created, and the images that receive annotations are marked as labeled.

ParameterTypeRequiredMeaning
datasetIdstringyes
fileNamestringyesName with extension. For a .txt file it must be the name of the image
contentstringyesContent of the file as text

Coordinates are fractions of the image width and height, from 0 to 1, given as two opposite corners of the box. Values outside that range, such as pixel coordinates, are rejected. The YOLO form (center, width, height) is not supported and is not always detected, so convert it first.

FileOne line per box
.txt, detection<tag> <x1> <y1> <x2> <y2>, with x2 > x1 and y2 > y1
.csv, detection[SET,]<image name>,<tag>,<x1>,<y1>,,,<x2>,<y2>
.csv, oriented boxes[SET,]<image name>,<tag> followed by the 8 corner values
.csv, OCRAs detection, with the text in the tag column

Oriented boxes can only be imported from a .csv file. Their corners may leave the 0 to 1 range when the object is cut by the border of the image, as long as the center of the box is inside the image and the box is not larger than it.

The result has images, successful and failed, and the status success, or partial when some image failed. failed lists each image with the reason: an image that is not in the dataset, or one with a box that is not valid, in which case none of its boxes is written. Segmentation masks cannot be imported with this tool: use the uploader of the application.

Deleting ​

image_delete ​

Destructive. Cloud only. Deletes up to 100 images with their files.

ParameterTypeRequired
imageIdsarray of strings, 1 to 100yes
confirmbooleanyes, true

Returns deleted, the ids deleted, and failed, each id that could not be deleted with the reason. The status is partial when some failed.