Skip to content

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.

[#8063] feat(mcp-server): Support job related read operations for MCP server. (#8067)

Mini Yu7c004c19534c
diff --git a/mcp-server/mcp_server/client/__init__.py b/mcp-server/mcp_server/client/__init__.py
index 01aba796f8..6fbdc469b7 100644
--- a/mcp-server/mcp_server/client/__init__.py
+++ b/mcp-server/mcp_server/client/__init__.py
@@ -17,6 +17,7 @@
from mcp_server.client.catalog_operation import CatalogOperation
from mcp_server.client.gravitino_operation import GravitinoOperation
+from mcp_server.client.job_operation import JobOperation
from mcp_server.client.model_operation import ModelOperation
from mcp_server.client.schema_operation import SchemaOperation
from mcp_server.client.table_operation import TableOperation
diff --git a/mcp-server/mcp_server/client/gravitino_operation.py b/mcp-server/mcp_server/client/gravitino_operation.py
index e8ca7fa5be..010c31189c 100644
--- a/mcp-server/mcp_server/client/gravitino_operation.py
+++ b/mcp-server/mcp_server/client/gravitino_operation.py
@@ -19,6 +19,7 @@ from abc import ABC, abstractmethod
from mcp_server.client.catalog_operation import CatalogOperation
from mcp_server.client.fileset_operation import FilesetOperation
+from mcp_server.client.job_operation import JobOperation
from mcp_server.client.model_operation import ModelOperation
from mcp_server.client.schema_operation import SchemaOperation
from mcp_server.client.table_operation import TableOperation
@@ -99,3 +100,13 @@ class GravitinoOperation(ABC):
TagOperation: Interface for performing tag-level operations
"""
pass
+
+ @abstractmethod
+ def as_job_operation(self) -> JobOperation:
+ """
+ Access the job operation interface of this Gravitino operation.
+
+ Returns:
+ JobOperation: Interface for performing job-level operations
+ """
+ pass
diff --git a/mcp-server/mcp_server/client/job_operation.py b/mcp-server/mcp_server/client/job_operation.py
new file mode 100644
index 0000000000..c83f750bfc
--- /dev/null
+++ b/mcp-server/mcp_server/client/job_operation.py
@@ -0,0 +1,102 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from abc import ABC, abstractmethod
+
+
+class JobOperation(ABC):
+ """
+ Abstract base class for Gravitino job operations.
+ """
+
+ @abstractmethod
+ async def get_job_by_id(self, job_id: str) -> str:
+ """
+ Load a job by its ID.
+
+ Args:
+ job_id: ID of the job to get
+
+ Returns:
+ str: JSON-formatted string containing the job information
+ """
+ pass
+
+ @abstractmethod
+ async def get_list_of_jobs(self, job_template_name: str) -> str:
+ """
+ Retrieve the list of jobs within the metalake
+
+ Args:
+ job_template_name: Name of the job template to filter jobs if needed.
+ The parameter can be an empty string/None to retrieve all jobs.
+
+ Returns:
+ str: JSON-formatted string containing job list information
+ """
+ pass
+
+ @abstractmethod
+ async def get_list_of_job_templates(self) -> str:
+ """
+ Retrieve the list of job templates within the metalake
+
+ Returns:
+ str: JSON-formatted string containing job template list information
+ """
+ pass
+
+ @abstractmethod
+ async def get_job_template_by_name(self, name: str) -> str:
+ """
+ Load a job template by its name.
+
+ Args:
+ name: Name of the job template to get
+
+ Returns:
+ str: JSON-formatted string containing the job template information
+ """
+ pass
+
+ @abstractmethod
+ async def run_job(self, job_template_name: str, job_config: dict) -> str:
+ """
+ Run a job based on the specified job template and parameters.
+
+ Args:
+ job_template_name: Name of the job template to run.
+ job_config: Dictionary of parameters to configure the job run.
+
+ Returns:
+ str: JSON-formatted string containing the result ID of the job to run.
+ """
+ pass
+
+ @abstractmethod
+ async def cancel_job(self, job_id: str) -> str:
+ """
+ Cancel a running job by its ID. The ID should be the one returned by
+ the `run_job` method.
+
+ Args:
+ job_id: ID of the job to cancel.
+
+ Returns:
+ str: JSON-formatted string containing the result of the cancellation.
+ """
+ pass
diff --git a/mcp-server/mcp_server/client/plain/plain_rest_client_job_operation.py b/mcp-server/mcp_server/client/plain/plain_rest_client_job_operation.py
new file mode 100644
index 0000000000..687c974976
--- /dev/null
+++ b/mcp-server/mcp_server/client/plain/plain_rest_client_job_operation.py
@@ -0,0 +1,75 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from httpx import AsyncClient
+
+from mcp_server.client.job_operation import JobOperation
+from mcp_server.client.plain.exception import GravitinoException
+from mcp_server.client.plain.utils import extract_content_from_response
+
+
+class PlainRESTClientJobOperation(JobOperation):
+ def __init__(self, metalake_name: str, rest_client: AsyncClient):
+ self.metalake_name = metalake_name
+ self.rest_client = rest_client
+
+ async def get_job_by_id(self, job_id: str) -> str:
+ response = await self.rest_client.get(
+ f"/api/metalakes/{self.metalake_name}/jobs/runs/{job_id}"
+ )
+ return extract_content_from_response(response, "job", {})
+
+ async def get_list_of_jobs(self, job_template_name: str) -> str:
+ url = f"/api/metalakes/{self.metalake_name}/jobs/runs"
+ if job_template_name:
+ url += f"?jobTemplateName={job_template_name}"
+
+ response = await self.rest_client.get(url)
+ return extract_content_from_response(response, "jobs", [])
+
+ async def get_job_template_by_name(self, name: str) -> str:
+ response = await self.rest_client.get(
+ f"/api/metalakes/{self.metalake_name}/jobs/templates/{name}"
+ )
+ return extract_content_from_response(response, "jobTemplate", {})
+
+ async def get_list_of_job_templates(self) -> str:
+ response = await self.rest_client.get(
+ f"/api/metalakes/{self.metalake_name}/jobs/templates?details=true"
+ )
+ return extract_content_from_response(response, "jobTemplates", [])
+
+ async def run_job(self, job_template_name: str, job_config: dict) -> str:
+ response = await self.rest_client.post(
+ f"/api/metalakes/{self.metalake_name}/jobs/runs",
+ json={
+ "jobTemplateName": job_template_name,
+ "jobConf": job_config,
+ },
+ )
+ return extract_content_from_response(response, "job", {})
+
+ async def cancel_job(self, job_id: str) -> str:
+ response = await self.rest_client.post(
+ f"/api/metalakes/{self.metalake_name}/jobs/runs/{job_id}"
+ )
+ if response.status_code != 200:
+ raise GravitinoException(
+ f"Failed to cancel job {job_id}: {response.text}"
+ )
+
+ return extract_content_from_response(response, "job", {})
diff --git a/mcp-server/mcp_server/client/plain/plain_rest_client_operation.py b/mcp-server/mcp_server/client/plain/plain_rest_client_operation.py
index f95aebda9f..c21b8898cc 100644
--- a/mcp-server/mcp_server/client/plain/plain_rest_client_operation.py
+++ b/mcp-server/mcp_server/client/plain/plain_rest_client_operation.py
@@ -24,12 +24,16 @@ from mcp_server.client import (
TableOperation,
TagOperation,
)
+from mcp_server.client.job_operation import JobOperation
from mcp_server.client.plain.plain_rest_client_catalog_operation import (
PlainRESTClientCatalogOperation,
)
from mcp_server.client.plain.plain_rest_client_fileset_operation import (
PlainRESTClientFilesetOperation,
)
+from mcp_server.client.plain.plain_rest_client_job_operation import (
+ PlainRESTClientJobOperation,
+)
from mcp_server.client.plain.plain_rest_client_model_operation import (
PlainRESTClientModelOperation,
)
@@ -87,3 +91,8 @@ class PlainRESTClientOperation(GravitinoOperation):
return PlainRESTClientTagOperation(
metalake_name=self.metalake_name, rest_client=self.rest_client
)
+
+ def as_job_operation(self) -> JobOperation:
+ return PlainRESTClientJobOperation(
+ metalake_name=self.metalake_name, rest_client=self.rest_client
+ )
diff --git a/mcp-server/mcp_server/tools/__init__.py b/mcp-server/mcp_server/tools/__init__.py
index 6e900fc225..73ece0e368 100644
--- a/mcp-server/mcp_server/tools/__init__.py
+++ b/mcp-server/mcp_server/tools/__init__.py
@@ -19,6 +19,7 @@ from fastmcp import FastMCP
from mcp_server.tools.catalog import load_catalog_tools
from mcp_server.tools.fileset import load_fileset_tools
+from mcp_server.tools.job import load_job_tool
from mcp_server.tools.metadata import load_metadata_tool
from mcp_server.tools.model import load_model_tools
from mcp_server.tools.schema import load_schema_tools
@@ -28,6 +29,7 @@ from mcp_server.tools.topic import load_topic_tools
def load_tools(mcp: FastMCP):
+ load_job_tool(mcp)
load_catalog_tools(mcp)
load_schema_tools(mcp)
load_table_tools(mcp)
diff --git a/mcp-server/mcp_server/tools/job.py b/mcp-server/mcp_server/tools/job.py
new file mode 100644
index 0000000000..d1e5e24414
--- /dev/null
+++ b/mcp-server/mcp_server/tools/job.py
@@ -0,0 +1,253 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from fastmcp import Context, FastMCP
+
+
+def load_job_tool(mcp: FastMCP):
+ @mcp.tool(tags={"job"})
+ async def get_list_of_jobs(
+ ctx: Context,
+ job_template_name: str = None,
+ ) -> str:
+ """
+ Get a list of jobs in the metalake. If `job_template_name` is provided,
+ the method will only return jobs that created from that specific job template.
+ If no job template name is provided, all jobs will be returned.
+
+ Parameters:
+ ctx (Context): The context object containing Gravitino context.
+ job_template_name (str): The name of the job template to filter jobs by.
+ If empty or not provided, all jobs are returned.
+ returns:
+ str: A JSON string representing an array of job objects with the following structure:
+ [
+ {
+ "jobId": "job-3210182983329751377",
+ "jobTemplateName": "shell_test",
+ "status": "succeeded",
+ "audit": {
+ "creator": "anonymous",
+ "createTime": "2025-08-13T11:50:27.019723Z",
+ "lastModifier": "anonymous",
+ "lastModifiedTime": "2025-08-13T11:51:43.038661Z"
+ }
+ }
+ ]
+
+ jobId: The unique identifier of the job.
+ jobTemplateName: The name of the job template used to create the job.
+ status: The current status of the job (e.g., "succeeded", "failed").
+ audit: An object containing audit information, including creator and creation time.
+ """
+ client = ctx.request_context.lifespan_context.rest_client()
+ return await client.as_job_operation().get_list_of_jobs(
+ job_template_name
+ )
+
+ @mcp.tool(tags={"job"})
+ async def get_job_by_id(
+ ctx: Context,
+ job_id: str,
+ ) -> str:
+ """
+ Get a job by its ID.
+ Parameters:
+ ctx (Context): The context object containing Gravitino context.
+ job_id (str): The ID of the job to retrieve.
+
+ Returns:
+ str: A JSON string representing the job object with the following structure:
+ {
+ "jobId": "job-3210182983329751377",
+ "jobTemplateName": "shell_test",
+ "status": "succeeded",
+ "audit": {
+ "creator": "anonymous",
+ "createTime": "2025-08-13T11:50:27.019723Z",
+ "lastModifier": "anonymous",
+ "lastModifiedTime": "2025-08-13T11:51:43.038661Z"
+ }
+ }
+
+ jobId: The unique identifier of the job.
+ jobTemplateName: The name of the job template used to create the job.
+ status: The current status of the job (e.g., "succeeded", "failed").
+ audit: An object containing audit information, including creator and creation time.
+ """
+ client = ctx.request_context.lifespan_context.rest_client()
+ return await client.as_job_operation().get_job_by_id(job_id)
+
+ @mcp.tool(tags={"job"})
+ async def get_list_of_job_templates(
+ ctx: Context,
+ ) -> str:
+ """
+ Get a list of job templates in the metalake.
+
+ Parameters:
+ ctx (Context): The context object containing Gravitino context.
+
+ Returns:
+ str: A JSON string representing an array of job template objects with the following structure:
+ [
+ {
+ "jobType": "shell",
+ "name": "shell_test",
+ "comment": "this is a shell test",
+ "executable": "/tmp/test/test.sh",
+ "arguments": [],
+ "environments": {},
+ "customFields": {},
+ "audit": {
+ "creator": "anonymous",
+ "createTime": "2025-08-13T11:45:50.124843Z"
+ },
+ "scripts": []
+ }
+ ]
+
+ name: The name of the job template to get.
+ jobType: The type of the job (e.g., "shell").
+ comment: A comment describing the job template.
+ executable: The path to the executable script for the job.
+ arguments: A list of arguments for the job.
+ environments: A dictionary of environment variables for the job.
+ customFields: A dictionary of custom fields for the job.
+ audit: An object containing audit information, including creator and creation time.
+ scripts: A list of scripts associated with the job template and can be called by the executable.
+ """
+ client = ctx.request_context.lifespan_context.rest_client()
+ return await client.as_job_operation().get_list_of_job_templates()
+
+ @mcp.tool(tags={"job"})
+ async def get_job_template_by_name(
+ ctx: Context,
+ name: str,
+ ) -> str:
+ """
+ Get a job template by its name.
+
+ Parameters:
+ ctx (Context): The context object containing Gravitino context.
+ name (str): The name of the job template to retrieve.
+
+ Returns:
+ str: A JSON string representing the job template object with the following structure:
+ {
+ "jobType": "shell",
+ "name": "shell_test",
+ "comment": "this is a shell test",
+ "executable": "/tmp/test/test.sh",
+ "arguments": [],
+ "environments": {},
+ "customFields": {},
+ "audit": {
+ "creator": "anonymous",
+ "createTime": "2025-08-13T11:45:50.124843Z"
+ },
+ "scripts": []
+ }
+
+ name: The name of the job template to get.
+ jobType: The type of the job (e.g., "shell").
+ comment: A comment describing the job template.
+ executable: The path to the executable script for the job.
+ arguments: A list of arguments for the job.
+ environments: A dictionary of environment variables for the job.
+ customFields: A dictionary of custom fields for the job.
+ audit: An object containing audit information, including creator and creation time.
+ scripts: A list of scripts associated with the job template and can be called by the executable.
+ """
+ client = ctx.request_context.lifespan_context.rest_client()
+ return await client.as_job_operation().get_job_template_by_name(name)
+
+ @mcp.tool(tags={"job"})
+ async def run_job(
+ ctx: Context,
+ job_template_name: str,
+ job_config: dict,
+ ) -> str:
+ """
+ Run a job using a specified job template and configuration.
+
+ Parameters:
+ ctx (Context): The context object containing Gravitino context.
+ job_template_name (str): The name of the job template to use for running the job.
+ job_config (dict): A dictionary containing the configuration for the job.
+
+ Returns:
+ str: A JSON string representing the created job object.
+
+ Example Return Value:
+ {
+ "jobId": "job-3650896936678278254",
+ "jobTemplateName": "shell_test",
+ "status": "queued",
+ "audit": {
+ "creator": "anonymous",
+ "createTime": "2025-08-14T08:50:33.098029Z"
+ }
+ }
+ jobId: The unique identifier of the job.
+ jobTemplateName: The name of the job template used to create the job.
+ status: The current status of the job (e.g., "queued", "running").
+ audit: An object containing audit information, including creator and creation time.
+ """
+ client = ctx.request_context.lifespan_context.rest_client()
+ return await client.as_job_operation().run_job(
+ job_template_name, job_config
+ )
+
+ @mcp.tool(tags={"job"})
+ async def cancel_job(
+ ctx: Context,
+ job_id: str,
+ ) -> str:
+ """
+ Cancel a job by its ID. The ID should be the one returned by the `run_job` method.
+
+ Parameters:
+ ctx (Context): The context object containing Gravitino context.
+ job_id (str): The ID of the job to cancel.
+
+ Returns:
+ str: A JSON string representing the current status of the job to be cancelled.
+
+ Example Return Value:
+ {
+ "jobId": "job-3650896936678278254",
+ "jobTemplateName": "shell_test",
+ "status": "succeeded",
+ "audit": {
+ "creator": "anonymous",
+ "createTime": "2025-08-14T08:50:33.098029Z",
+ "lastModifier": "anonymous",
+ "lastModifiedTime": "2025-08-14T08:52:10.965113Z"
+ }
+ }
+ jobId: The unique identifier of the job.
+ jobTemplateName: The name of the job template used to create the job.
+ status: The current status of the job (e.g., "succeeded", "failed", "cancelled").
+ If the job was successfully cancelled, the status will be "cancelled". If the
+ job was already completed, the status will reflect that.
+ audit: An object containing audit information, including creator, creation time,
+ last modifier, and last modified time.
+
+ """
+ client = ctx.request_context.lifespan_context.rest_client()
+ return await client.as_job_operation().cancel_job(job_id)
diff --git a/mcp-server/tests/unit/tools/mock_operation.py b/mcp-server/tests/unit/tools/mock_operation.py
index 27b7bfc030..db8258ef51 100644
--- a/mcp-server/tests/unit/tools/mock_operation.py
+++ b/mcp-server/tests/unit/tools/mock_operation.py
@@ -21,10 +21,11 @@ from mcp_server.client import (
ModelOperation,
SchemaOperation,
TableOperation,
+ TagOperation,
TopicOperation,
)
from mcp_server.client.fileset_operation import FilesetOperation
-from mcp_server.client.tag_operation import TagOperation
+from mcp_server.client.job_operation import JobOperation
class MockOperation(GravitinoOperation):
@@ -52,6 +53,9 @@ class MockOperation(GravitinoOperation):
def as_tag_operation(self) -> TagOperation:
return MockTagOperation()
+ def as_job_operation(self) -> JobOperation:
+ return MockJobOperation()
+
class MockCatalogOperation(CatalogOperation):
async def get_list_of_catalogs(self) -> str:
@@ -172,3 +176,23 @@ class MockTagOperation(TagOperation):
async def list_metadata_by_tag(self, tag_name: str) -> str:
return f"mock_metadata_by_tag: {tag_name}"
+
+
+class MockJobOperation(JobOperation):
+ async def get_list_of_jobs(self, job_template_name: str = "") -> str:
+ return "mock_jobs"
+
+ async def get_job_by_id(self, job_id: str) -> str:
+ return f"mock_job: {job_id}"
+
+ async def get_list_of_job_templates(self) -> str:
+ return "mock_job_templates"
+
+ async def get_job_template_by_name(self, name: str) -> str:
+ return f"mock_job_template: {name}"
+
+ async def run_job(self, job_template_name: str, job_config: dict) -> str:
+ return f"mock_job_run: {job_template_name} with parameters {job_config}"
+
+ async def cancel_job(self, job_id: str) -> str:
+ return f"mock_job_cancelled: {job_id}"
diff --git a/mcp-server/tests/unit/tools/test_job.py b/mcp-server/tests/unit/tools/test_job.py
new file mode 100644
index 0000000000..22132b7f29
--- /dev/null
+++ b/mcp-server/tests/unit/tools/test_job.py
@@ -0,0 +1,102 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import asyncio
+import unittest
+
+from fastmcp import Client
+
+from mcp_server.client.factory import RESTClientFactory
+from mcp_server.core import Setting
+from mcp_server.server import GravitinoMCPServer
+from tests.unit.tools.mock_operation import MockOperation
+
+
+class TestJobTool(unittest.TestCase):
+ def setUp(self):
+ RESTClientFactory.set_rest_client(MockOperation)
+ server = GravitinoMCPServer(Setting("mock_job"))
+ self.mcp = server.mcp
+
+ def test_list_job_templates(self):
+ async def _test_list_job_templates(mcp_server):
+ async with Client(mcp_server) as client:
+ result = await client.call_tool("get_list_of_job_templates")
+ self.assertEqual("mock_job_templates", result.content[0].text)
+
+ asyncio.run(_test_list_job_templates(self.mcp))
+
+ def test_get_job_template_by_name(self):
+ async def _test_get_job_template_by_name(mcp_server):
+ async with Client(mcp_server) as client:
+ result = await client.call_tool(
+ "get_job_template_by_name", {"name": "mock_job"}
+ )
+ self.assertEqual(
+ "mock_job_template: mock_job", result.content[0].text
+ )
+
+ asyncio.run(_test_get_job_template_by_name(self.mcp))
+
+ def test_get_job_by_id(self):
+ async def _test_get_job_by_id(mcp_server):
+ async with Client(mcp_server) as client:
+ result = await client.call_tool(
+ "get_job_by_id", {"job_id": "mock_job_id"}
+ )
+ self.assertEqual(
+ "mock_job: mock_job_id", result.content[0].text
+ )
+
+ asyncio.run(_test_get_job_by_id(self.mcp))
+
+ def test_get_list_of_jobs(self):
+ async def _test_get_list_of_jobs(mcp_server):
+ async with Client(mcp_server) as client:
+ result = await client.call_tool("get_list_of_jobs")
+ self.assertEqual("mock_jobs", result.content[0].text)
+
+ asyncio.run(_test_get_list_of_jobs(self.mcp))
+
+ def test_run_job(self):
+ async def _test_run_job(mcp_server):
+ async with Client(mcp_server) as client:
+ result = await client.call_tool(
+ "run_job",
+ {
+ "job_template_name": "mock_job_template",
+ "job_config": {},
+ },
+ )
+ self.assertEqual(
+ "mock_job_run: mock_job_template with parameters {}",
+ result.content[0].text,
+ )
+
+ asyncio.run(_test_run_job(self.mcp))
+
+ def test_cancel_job(self):
+ async def _test_cancel_job(mcp_server):
+ async with Client(mcp_server) as client:
+ result = await client.call_tool(
+ "cancel_job", {"job_id": "mock_job_id"}
+ )
+ self.assertEqual(
+ "mock_job_cancelled: mock_job_id", result.content[0].text
+ )
+
+ asyncio.run(_test_cancel_job(self.mcp))