MCP scenarios and API selection
This topic describes the scenario packages and API selection guidance, the job diagnosis package APIs, and the MCP instruction templates of the MCP service of Realtime Compute for Apache Flink, together with the call chains for job diagnosis and AI intelligent O&M. Tuning is supported only by the Custom edition.
Prerequisites
-
The MCP endpoint is obtained. See MCP service overview.
-
For the Custom edition, OpenAPI MCP Server is activated and you have permissions to create an MCP server.
Scenario packages and API selection
The API operations you select determine which tools the agent can call. Create one server per scenario to keep permissions isolated and tool lists focused. For the list of capability domains, see MCP service overview. The job diagnosis package used in this topic is described in Job diagnosis package APIs and MCP instructions below.
|
Package |
Operations to select |
Read or write |
Description |
|
Job diagnosis (used in this topic) |
See Job diagnosis package APIs below |
Read-only |
Safe default for first-time access and demos |
|
Job operations |
|
Includes write operations |
Require user confirmation before the agent makes changes |
|
Data queries and analysis |
|
Query and execution |
For data retrieval and analytical Q&A |
|
Cluster and resource observation |
|
Read-only |
For resource usage and tuning analysis |
Important For packages that contain write operations, create a separate MCP server and approve its permissions separately in RAM. Do not mix them with read-only diagnosis capabilities.
Job diagnosis package APIs
The job diagnosis package recommended by Alibaba Cloud contains nine read-only operations. Together they cover the full chain of locating the job, checking instance status, diagnosing the root cause, and restoring the event timeline.
|
API operation |
Description |
Role in the diagnosis flow |
|
|
Lists deployments |
Browse and filter target jobs |
|
|
Searches for a deployment by name |
Locate the exact job |
|
|
Lists job instances |
Confirm instance status, start time, and failure time |
|
|
Queries the details of a job instance |
Check the current status and exception information |
|
|
Queries diagnosis details |
Core tool: intelligent diagnosis that returns diagnosis items |
|
|
Queries the startup log of the latest instance |
Troubleshoot startup failures |
|
|
Queries runtime events |
Restore the failover event timeline |
|
|
Queries Autopilot tuning history |
Check whether instance changes were caused by scaling |
|
|
Lists savepoints and system checkpoints |
Assess the recovery point and checkpoint health |
Note Selected operations are exposed as tools named <product code>-<API version without hyphens>-<operation name>. This package returns nine tools such as ververica-20220718-ListDeployments and ververica-20220718-GetJobDiagnosis. The tool list in the client uses these names.
MCP instructions
MCP instructions guide the model to call tools in a defined workflow. The client must support the Instructions field of the MCP standard. Paste the following template into the MCP instructions field when you create the server.
You are a job diagnosis assistant for Realtime Compute for Apache Flink. When diagnosing a job issue, follow this workflow:
1) Locate the target job with ListDeployments or GetDeploymentsByName.
2) List job instances with ListJobs to identify the failed instance and the time of failure.
3) Call GetJobDiagnosis on the failed instance and read the diagnosis items, such as back pressure, insufficient resources, code exceptions, and network issues.
4) If the job failed to start, call GetLatestJobStartLog to read the exception stack traces in the startup log.
5) Restore the failover process with the event timeline from GetEvents. Refer to ListAutopilotTuningHistories when needed to determine whether Autopilot scaling is involved.
6) Output the conclusion: root cause category, evidence (quoting diagnosis items or key log lines), and recommended action.
This MCP server provides read-only capabilities only. It does not perform changes such as start and stop operations.
Job diagnosis
Use case: locate the root cause of job failures, frequent failovers and restarts, startup failures, and performance degradation.
Example prompt: "One of my Flink jobs has been restarting frequently since this morning. Help me find out why."
The diagnosis chain is as follows.
|
Step |
Tool called |
Information obtained |
|
1 |
|
Locate the target job |
|
2 |
|
Instance status and time of failure |
|
3 |
|
Diagnosis items such as back pressure, insufficient resources, and code exceptions |
|
4 |
|
Exception stack traces in the startup log |
|
5 |
|
Failover event timeline |
The diagnosis result contains the following parts.
-
Root cause category: back pressure, insufficient resources, code exception, or external dependency, taken from the diagnosis items returned by
GetJobDiagnosis. -
Evidence: diagnosis item descriptions, key lines in the startup log, or the event timeline. Each item must be traceable to a tool response.
-
Recommended action: use the fix suggestion returned with each diagnosis item, and check the recovery point and checkpoint health with
ListSavepoints.
If the evidence is insufficient, ask the model to call ListSavepoints or ListAutopilotTuningHistories to restore the full context.
AI intelligent O&M
The AI Intelligent Assistant and intelligent inspection capabilities of Flink are available through OpenAPI. You can expose them as MCP tools in the same way and integrate them into your own agents and workflows. Both capabilities are also available in the console without any integration.
|
Capability |
Description |
Typical usage |
|
AI Intelligent Assistant |
Handles the full job lifecycle in natural language: generate and deploy Flink SQL in one sentence, diagnose job exceptions through multi-step reasoning including external dependencies, and answer questions about product knowledge and connector usage |
Use |
|
Intelligent inspection |
Runs unattended inspections on a schedule or on demand, for all jobs, jobs by tag, or specified jobs. Reports are generated and delivered automatically, and abnormal health score trends raise early warnings |
Configure "inspect all jobs every day at 06:00" in one sentence, and review archived reports at any time |
The management-side ververica operations cover both AI Intelligent Assistant conversations and intelligent inspection.
|
API operation |
Description |
Read or write |
|
Starts an AI Intelligent Assistant conversation (streaming): natural language input, multi-turn sessions ( |
Conversation/execution |
|
|
Queries inspection reports by time, status, scope, and trigger type |
Read-only |
|
|
Queries the details of an inspection report |
Read-only |
|
|
Queries the inspection configuration, including the schedule, time zone, and scope |
Read-only |
|
|
Triggers one inspection for all jobs ( |
Write |
|
|
Updates the inspection configuration, including the schedule, time zone, and scope |
Write |
Flink AI service is the prerequisite for both capabilities. Its status, deletion protection, and free quota are exposed through the sales-side foasconsole operations.
|
API operation |
Description |
Read or write |
|
Queries the status of the Flink AI service |
Read-only |
|
|
Queries the usage of the free quota |
Read-only |
|
|
Enables the Flink AI service |
Write |
|
|
Disables the Flink AI service |
Write |
|
|
Modifies the deletion protection setting of the Flink AI service |
Write |
The two paths are complementary: MCP exposure fits AI O&M capabilities into your own agents and observability stack, while the console entry ships with expert knowledge and built-in skills and works out of the box.
The AI Intelligent Assistant and intelligent inspection are billed by token usage, with a free trial quota before commercial launch. Quotas and billing details are shown on the AI Service page in the console.