MCP scenarios and API selection

Updated at:

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

ListDeployments, StartJobWithParams, StopJob, HotUpdateJob, ListSessionClusters

Includes write operations

Require user confirmation before the agent makes changes

Data queries and analysis

GetCatalogs, GetDatabases, GetTables, StartSqlExecution, FetchSqlExecutionResult

Query and execution

For data retrieval and analytical Q&A

Cluster and resource observation

ListSessionClusters, GetSessionCluster, ListDeploymentTargets, GetAutopilotPolicy, ListAutopilotTuningHistories

Read-only

For resource usage and tuning analysis

Note

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

ListDeployments

Lists deployments

Browse and filter target jobs

GetDeploymentsByName

Searches for a deployment by name

Locate the exact job

ListJobs

Lists job instances

Confirm instance status, start time, and failure time

GetJob

Queries the details of a job instance

Check the current status and exception information

GetJobDiagnosis

Queries diagnosis details

Core tool: intelligent diagnosis that returns diagnosis items

GetLatestJobStartLog

Queries the startup log of the latest instance

Troubleshoot startup failures

GetEvents

Queries runtime events

Restore the failover event timeline

ListAutopilotTuningHistories

Queries Autopilot tuning history

Check whether instance changes were caused by scaling

ListSavepoints

Lists savepoints and system checkpoints

Assess the recovery point and checkpoint health

Note

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

ListDeployments / GetDeploymentsByName

Locate the target job

2

ListJobs

Instance status and time of failure

3

GetJobDiagnosis

Diagnosis items such as back pressure, insufficient resources, and code exceptions

4

GetLatestJobStartLog (if the job failed to start)

Exception stack traces in the startup log

5

GetEvents

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 /Draft Development in an AI Native Ops conversation to create a job in one sentence, or reference a job with @ and run /Job Diagnosis

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

ChatAiAgent

Starts an AI Intelligent Assistant conversation (streaming): natural language input, multi-turn sessions (sessionId), job and skill references (refs), and tool calls and HITL approval events returned as a stream

Conversation/execution

ListPatrolReports

Queries inspection reports by time, status, scope, and trigger type

Read-only

GetPatrolReportDetail

Queries the details of an inspection report

Read-only

GetPatrolConfig

Queries the inspection configuration, including the schedule, time zone, and scope

Read-only

TriggerPatrol

Triggers one inspection for all jobs (ALL), by tag (TAGS), or for specified jobs (DEPLOYMENTS)

Write

UpdatePatrolConfig

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

GetFlinkAiService

Queries the status of the Flink AI service

Read-only

GetFlinkAiServiceFreeQuota

Queries the usage of the free quota

Read-only

OpenFlinkAiService

Enables the Flink AI service

Write

CloseFlinkAiService

Disables the Flink AI service

Write

ModifyAiServiceProtection

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.

Related information