Dataset tools of the MCP server
The 21 tools that work on datasets, their tags and their groups. How to connect, and how results and errors come back, is in Connecting a client.
Shared values:
- Dataset types:
MULTICLASS,ANOMALY,MULTILABEL,imageObjectDetection,imageObjectDetectionOBB,OCR. - Divisions:
train,test,validation,predetermined,review. - Most tools that take a
datasetIdanswerdataset <id> not foundwhen it does not exist.
Reading
dataset_list
Lists the datasets of the project, newest first, as summaries: id, name, type, description, archived flag, dates and the counters of tags, images and models.
| Parameter | Type | Required | Meaning |
|---|---|---|---|
limit | integer, 1 to 100 | no | How many to return. Default 20 |
type | dataset type | no | Only datasets of this type |
name | string | no | Text contained in the name or the id, in any letter case |
includeArchived | boolean | no | Also return archived datasets |
archived | boolean | no | true: only archived datasets |
order | asc or desc | no | Default desc, newest first |
dataset_get
Returns one dataset with its tags.
| Parameter | Type | Required | Meaning |
|---|---|---|---|
datasetId | string | yes | |
tagStats | boolean | no | Add the image count of each tag |
divisions | boolean | no | Add the image count of each division |
models | boolean | no | Add the models of the dataset, summarized |
fields | array of strings | no | Return only these top-level fields |
dataset_images
Queries the images of a dataset, page by page. Returns count, total, pagination and images.
| Parameter | Type | Required | Meaning |
|---|---|---|---|
datasetId | string | yes | |
page | integer, from 0 | no | Page number. The first page is 0 |
perPage | integer, 1 to 100 | no | Default 20 |
division | division | no | Only images of this division |
byTag | string | no | Only images that contain this tag id |
byTagExclude | boolean | no | Inverts byTag: images that do not contain the tag |
byGroup | string | no | A group id, or none for images without group |
name | string | no | Text contained in the image name |
withComments | boolean | no | Only images with comments |
order | date, name or updatedAt | no | Sort field. Default date |
direction | asc or desc | no | Sort direction. Default desc |
fields | array of strings | no | Return these stored fields of each image instead of the summary, for example tags, masks, imageData |
The summary of an image has its id, name, file name, division (set), class (tag), labeled flag, groups, file location, preview URLs, the number of annotations, the tags it contains, the masks with the number of strokes of each, whether it has comments, and its dates. The strokes of the masks are large and come only when fields asks for masks.
Some combinations of filter and order need a database index that the project may not have. The call then fails with the error the database gives, which names the missing index.
Results are cached for a minute, so a change made in the application can take that long to show.
dataset_tag_stats
Image count per tag, plus the totals of labeled and not labeled images.
| Parameter | Type | Required |
|---|---|---|
datasetId | string | yes |
dataset_division_stats
Image count per division.
| Parameter | Type | Required | Meaning |
|---|---|---|---|
datasetId | string | yes | |
byTag | string | no | Count only images with this tag |
byGroup | string | no | Count only images of this group |
dataset_annotation_counts
Number of annotations (boxes, masks, instances) of each tag across the images of the dataset, as an object { tagId: count }.
| Parameter | Type | Required |
|---|---|---|
datasetId | string | yes |
dataset_tags
The tags of a dataset with their color, description and system flags.
| Parameter | Type | Required | Meaning |
|---|---|---|---|
datasetId | string | yes | |
includeSystem | boolean | no | false leaves out the unclassified tag and, in segmentation datasets, the normal tag. Default true |
dataset_groups
The groups of a dataset.
| Parameter | Type | Required | Meaning |
|---|---|---|---|
datasetId | string | yes | |
stats | boolean | no | Add the image count of each group. The result is then { groups, stats } |
dataset_random_images
A random sample taken from the most recent images of a dataset, for a quick look at what it holds. Returns image summaries.
| Parameter | Type | Required | Meaning |
|---|---|---|---|
datasetId | string | yes | |
count | integer, 1 to 20 | no | How many images. Default 1 |
sampleSize | integer, 1 to 500 | no | How many of the most recent images to pick from. Default 50 |
dataset_prompts
The prompts for vision-language models stored on a dataset.
| Parameter | Type | Required |
|---|---|---|
datasetId | string | yes |
Datasets
dataset_create
Creates a dataset and the system tags of its type. The name is normalized (lower case, without accents, spaces as _, other symbols removed, at most 32 characters) and the id is rp-<type prefix>-<name>, returned as datasetId: a detection dataset named Bottles gets the name bottles and the id rp-obj-bottles. The call fails if that id is taken.
| Parameter | Type | Required | Meaning |
|---|---|---|---|
name | string | yes | |
type | dataset type | yes | |
description | string | no |
dataset_update
Changes the name, the description or the archived flag. Answers nothing to update when none of the three is given.
| Parameter | Type | Required |
|---|---|---|
datasetId | string | yes |
name | string | no |
description | string | no |
archived | boolean | no |
dataset_delete
Destructive. Deletes the dataset with all its images and their files, its tags and groups, its models, their evaluation results and their share links. Returns the counters of what was deleted.
| Parameter | Type | Required |
|---|---|---|
datasetId | string | yes |
confirm | boolean | yes, true |
On a dataset with many images, connect through the usapi URL so the call has time to finish; a deletion that is cut short can be repeated.
dataset_convert
Cloud only. Converts a dataset into another type, for example detection into classification. The conversion runs in the training service and creates a new dataset; the original stays.
| Parameter | Type | Required | Meaning |
|---|---|---|---|
datasetId | string | yes | Dataset to convert |
targetType | dataset type | yes | Type of the new dataset |
newDatasetName | string | yes | Name of the new dataset |
parameters | object | no | Parameters of the conversion |
dataset_operation_create
Cloud only. Moves or copies images into a dataset. The call returns when the transfer is done, with the answer of the HTTP route in data: processed, skipped, failed (the ids that failed, the first 100), failedCount and requested. The rules of a transfer are the ones of the HTTP route: see Move or copy images.
The transfer itself runs in the long-running function. A client connected through the api URL still stops waiting after 60 seconds, while the transfer goes on: for large transfers connect through the usapi URL.
| Parameter | Type | Required | Meaning |
|---|---|---|---|
datasetId | string | yes | Destination dataset |
type | string | yes | move or copy |
images | array of strings | yes | Ids of the images to transfer. The call fails without them |
keepDate | boolean | no | copy only: give each copy the date of its original |
originType | string | no | Type of the dataset the images come from. Only used for an image whose own dataset no longer exists |
Tags
dataset_tag_create
Creates a tag. Answers tag <id> already exists if the id is taken. Returns tagId and the tag.
| Parameter | Type | Required | Meaning |
|---|---|---|---|
datasetId | string | yes | |
tagId | string | yes | Id of the tag, also its name when name is not given |
name | string | no | |
color | string | no | Hex color such as #2563EB. Assigned automatically when omitted |
description | string | no |
dataset_tag_update
Changes the name, the color or the description of a tag. A new name renames the tag: every image passes to the new id, the name with / replaced by _, and the call fails if a tag with that id already exists. Changing only the color or the description keeps the id. System tags keep their name.
| Parameter | Type | Required |
|---|---|---|
datasetId | string | yes |
tagId | string | yes |
name | string | no |
color | string | no |
description | string | no |
dataset_tag_delete
Destructive. Deletes a tag and removes it from every image, with the mask files of its annotations. System tags cannot be deleted.
| Parameter | Type | Required |
|---|---|---|
datasetId | string | yes |
tagId | string | yes |
confirm | boolean | yes, true |
dataset_tags_combine
Destructive. Merges several tags into one: the images and annotations pass to mainTagId and the merged tags are deleted. mainTagId is created if it does not exist. System tags can only be the target.
| Parameter | Type | Required | Meaning |
|---|---|---|---|
datasetId | string | yes | |
mainTagId | string | yes | Tag that stays |
tagIds | array of strings | yes | Tags to merge into it. All must exist |
confirm | boolean | yes, true |
If some image could not be rewritten, the three tools that rewrite tags answer N images could not be updated; run it again and keep the tags. Repeat a deletion or a merge as it was. A rename cut halfway leaves both tags and cannot be repeated: finish it with dataset_tags_combine.
Groups
dataset_group_create
Creates a group of images. Returns groupId and the group.
| Parameter | Type | Required |
|---|---|---|
datasetId | string | yes |
name | string | yes |
color | string | no |
dataset_group_delete
Destructive. Deletes a group and takes its images out of it. The images are not deleted. Answers group <id> not found if it does not exist. The result carries the answer of the HTTP route in data.
| Parameter | Type | Required |
|---|---|---|
datasetId | string | yes |
groupId | string | yes |
confirm | boolean | yes, true |