Tool: predict
Perform online predictions for a wide range of machine learning models. Use this to get real-time inference results from your deployed models on Vertex AI.
The following sample demonstrate how to use curl to invoke the predict MCP tool.
| Curl Request |
|---|
curl --location 'https://aiplatform.googleapis.com/mcp/generate' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "predict", "arguments": { // provide these details according to the tool's MCP specification } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
Request message for PredictionService.Predict.
PredictRequest
| JSON representation |
|---|
{ "endpoint": string, "instances": [ value ], "parameters": value, "labels": { string: string, ... } } |
| Fields | |
|---|---|
endpoint |
Required. The name of the Endpoint requested to serve the prediction. Format: |
instances[] |
Required. The instances that are the input to the prediction call. A DeployedModel may have an upper limit on the number of instances it supports per request, and when it is exceeded the prediction call errors in case of AutoML Models, or, in case of customer created Models, the behaviour is as documented by that Model. The schema of any single instance may be specified via Endpoint's DeployedModels' |
parameters |
The parameters that govern the prediction. The schema of the parameters may be specified via Endpoint's DeployedModels' |
labels |
Optional. The user labels for Imagen billing usage only. Only Imagen supports labels. For other use cases, it will be ignored. An object containing a list of |
Value
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field kind. The kind of value. kind can be only one of the following: |
|
nullValue |
Represents a JSON |
numberValue |
Represents a JSON number. Must not be |
stringValue |
Represents a JSON string. |
boolValue |
Represents a JSON boolean ( |
structValue |
Represents a JSON object. |
listValue |
Represents a JSON array. |
Struct
| JSON representation |
|---|
{ "fields": { string: value, ... } } |
| Fields | |
|---|---|
fields |
Unordered map of dynamically typed values. An object containing a list of |
FieldsEntry
| JSON representation |
|---|
{ "key": string, "value": value } |
| Fields | |
|---|---|
key |
|
value |
|
ListValue
| JSON representation |
|---|
{ "values": [ value ] } |
| Fields | |
|---|---|
values[] |
Repeated field of dynamically typed values. |
LabelsEntry
| JSON representation |
|---|
{ "key": string, "value": string } |
| Fields | |
|---|---|
key |
|
value |
|
Output Schema
Response message for PredictionService.Predict.
PredictResponse
| JSON representation |
|---|
{ "predictions": [ value ], "deployedModelId": string, "model": string, "modelVersionId": string, "modelDisplayName": string, "metadata": value } |
| Fields | |
|---|---|
predictions[] |
The predictions that are the output of the predictions call. The schema of any single prediction may be specified via Endpoint's DeployedModels' |
deployedModelId |
ID of the Endpoint's DeployedModel that served this prediction. |
model |
Output only. The resource name of the Model which is deployed as the DeployedModel that this prediction hits. |
modelVersionId |
Output only. The version ID of the Model which is deployed as the DeployedModel that this prediction hits. |
modelDisplayName |
Output only. The |
metadata |
Output only. Request-level metadata returned by the model. The metadata type will be dependent upon the model implementation. |
Value
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field kind. The kind of value. kind can be only one of the following: |
|
nullValue |
Represents a JSON |
numberValue |
Represents a JSON number. Must not be |
stringValue |
Represents a JSON string. |
boolValue |
Represents a JSON boolean ( |
structValue |
Represents a JSON object. |
listValue |
Represents a JSON array. |
Struct
| JSON representation |
|---|
{ "fields": { string: value, ... } } |
| Fields | |
|---|---|
fields |
Unordered map of dynamically typed values. An object containing a list of |
FieldsEntry
| JSON representation |
|---|
{ "key": string, "value": value } |
| Fields | |
|---|---|
key |
|
value |
|
ListValue
| JSON representation |
|---|
{ "values": [ value ] } |
| Fields | |
|---|---|
values[] |
Repeated field of dynamically typed values. |
Tool Annotations
Destructive Hint: ❌ | Idempotent Hint: ✅ | Read Only Hint: ✅ | Open World Hint: ✅