This is page 2 of 3. Use http://codebase.md/ocean-zhc/dolphinscheduler-mcp?page={x} to view the full context. # Directory Structure ``` ├── .env.example ├── .gitignore ├── CHANGELOG.md ├── docker-compose.yml ├── Dockerfile ├── docs │ ├── api.md │ └── installation.md ├── ds-restfuleapi-v1.json ├── example_mcp.py ├── examples │ ├── list_projects.py │ ├── manage_resources.py │ ├── simple_client.py │ └── start_workflow.py ├── install_dev.sh ├── mcp-openapi-split │ ├── base │ │ └── 01_base.json │ ├── paths │ │ ├── 01_azure_datafactory_api.json │ │ ├── 02_dynamic_task_type_api.json │ │ ├── 03_kubernetes_namespace_api.json │ │ ├── 04_project_worker_group_api.json │ │ ├── 05_ui_plugin_api.json │ │ ├── 06_worker_group_api.json │ │ ├── 07_project_preference_api.json │ │ ├── 08_task_definition_api.json │ │ ├── 09_task_instance_api.json │ │ ├── 10_task_analysis_api.json │ │ ├── 11_task_group_api.json │ │ ├── 12_favourite_api.json │ │ ├── 13_alert_plugin_instance_api.json │ │ ├── 14_alert_group_api.json │ │ ├── 15_schedule_api.json │ │ ├── 16_audit_log_api.json │ │ ├── 17_process_task_relation_api.json │ │ ├── 18_workflow_lineage_api.json │ │ ├── 19_datasource_api.json │ │ ├── 20_data_quality_api.json │ │ ├── 21_log_api.json │ │ ├── 22_process_definition_api.json │ │ ├── 23_process_instance_api.json │ │ ├── 24_process_execution_api.json │ │ ├── 25_environment_api.json │ │ ├── 26_login_api.json │ │ ├── 27_user_api.json │ │ ├── 28_monitor_api.json │ │ ├── 29_tenant_api.json │ │ ├── 30_token_api.json │ │ ├── 31_resource_api.json │ │ ├── 32_queue_api.json │ │ ├── 33_cluster_api.json │ │ ├── 34_project_parameter_api.json │ │ └── 35_project_api.json │ ├── schemas │ │ ├── 01_alert_schemas.json │ │ ├── 02_cluster_schemas.json │ │ ├── 03_datasource_schemas.json │ │ ├── 04_environment_schemas.json │ │ ├── 05_k8s_schemas.json │ │ ├── 06_project_schemas.json │ │ ├── 07_queue_schemas.json │ │ ├── 08_remaining_1_schemas.json │ │ ├── 09_remaining_10_schemas.json │ │ ├── 10_remaining_11_schemas.json │ │ ├── 11_remaining_12_schemas.json │ │ ├── 12_remaining_13_schemas.json │ │ ├── 13_remaining_2_schemas.json │ │ ├── 14_remaining_3_schemas.json │ │ ├── 15_remaining_4_schemas.json │ │ ├── 16_remaining_5_schemas.json │ │ ├── 17_remaining_6_schemas.json │ │ ├── 18_remaining_7_schemas.json │ │ ├── 19_remaining_8_schemas.json │ │ ├── 20_remaining_9_schemas.json │ │ ├── 21_resource_schemas.json │ │ ├── 22_result_schemas.json │ │ ├── 23_schedule_schemas.json │ │ ├── 24_task_schemas.json │ │ ├── 25_tenant_schemas.json │ │ ├── 26_user_schemas.json │ │ ├── 27_worker_schemas.json │ │ └── 28_workflow_schemas.json │ └── utils │ ├── combine_openapi.py │ └── split_openapi.py ├── pyproject.toml ├── README.md ├── requirements-dev.txt ├── run.bat ├── run.py ├── run.sh ├── src │ ├── __init__.py │ └── dolphinscheduler_mcp │ ├── __init__.py │ ├── __main__.py │ ├── cli.py │ ├── client.py │ ├── config.py │ ├── fastmcp_compat.py │ ├── server.py │ ├── tools │ ├── tools_generated │ │ ├── __init__.py │ │ ├── access_token_tools.py │ │ ├── audit_log_tools.py │ │ ├── azure_data_factory_tools.py │ │ ├── datasource_tools.py │ │ ├── dynamic_task_type_tools.py │ │ ├── environment_check_tools.py │ │ ├── environment_update_tools.py │ │ ├── k8s_namespace_tools.py │ │ ├── lineage_tools.py │ │ ├── process_task_relation_tools.py │ │ ├── project_parameter_tools.py │ │ ├── project_preference_tools.py │ │ ├── project_tools.py │ │ ├── project_worker_group_tools.py │ │ ├── README.md │ │ ├── template_tools.py │ │ ├── ui_plugin_tools.py │ │ └── worker_group_tools.py │ ├── tools_loader.py │ └── tools.py.bak ├── test_create_project.py ├── test_env_settings.py └── tests ├── __init__.py └── test_config.py ``` # Files -------------------------------------------------------------------------------- /src/dolphinscheduler_mcp/client.py: -------------------------------------------------------------------------------- ```python """DolphinScheduler API Client for MCP tools.""" import os import json import logging from typing import Dict, Any, Optional, Union, List, Tuple, BinaryIO import aiohttp from aiohttp import FormData from .config import Config class DolphinSchedulerClient: """Client for interacting with DolphinScheduler REST API.""" def __init__(self, api_url: Optional[str] = None, api_key: Optional[str] = None): """Initialize the client. Args: api_url: API URL for DolphinScheduler api_key: API key for authentication """ self.config = Config() if api_url: self.config.api_url = api_url if api_key: self.config.api_key = api_key self.session: Optional[aiohttp.ClientSession] = None self.logger = logging.getLogger("dolphinscheduler_mcp.client") async def _ensure_session(self) -> aiohttp.ClientSession: """Ensure that a session exists. Returns: An aiohttp ClientSession. """ if self.session is None: self.session = aiohttp.ClientSession() return self.session async def close(self) -> None: """Close the session.""" if self.session: await self.session.close() self.session = None async def request( self, method: str, path: str, params: Optional[Dict[str, Any]] = None, json_data: Optional[Dict[str, Any]] = None ) -> Dict[str, Any]: """Make a request to the DolphinScheduler API. Args: method: HTTP method (GET, POST, PUT, DELETE) path: API path params: Query parameters json_data: JSON data for the request body Returns: Response from the API """ session = await self._ensure_session() # Build the full URL url = f"{self.config.api_url.rstrip('/')}/{path.lstrip('/')}" # Build headers headers = {} if self.config.has_api_key(): headers["Token"] = self.config.api_key # Make the request async with session.request(method, url, params=params, json=json_data, headers=headers) as response: # Raise an exception for 4XX/5XX responses response.raise_for_status() # Parse the response return await response.json() async def request_with_files( self, method: str, endpoint: str, params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None, files: Optional[Dict[str, Tuple[str, Union[str, bytes]]]] = None, ) -> Dict[str, Any]: """ Send a multipart request with files to the DolphinScheduler API. Args: method: HTTP method (typically POST) endpoint: API endpoint params: Form parameters headers: Request headers files: Dictionary of files to upload {field_name: (filename, content)} Returns: Response JSON """ await self._ensure_session() url = f"{self.config.api_url.rstrip('/')}/{endpoint.lstrip('/')}" if not headers: headers = {} # Add token if available if self.config.has_api_key(): headers["Token"] = self.config.api_key try: # Create form data form = FormData() # Add files to form data if files: for field_name, (filename, content) in files.items(): form.add_field(field_name, content, filename=filename) # Add other parameters to form data if params: for key, value in params.items(): if isinstance(value, (dict, list)): form.add_field(key, json.dumps(value)) else: form.add_field(key, str(value)) self.logger.debug(f"Sending multipart {method} request to {url}") async with self.session.request( method=method, url=url, headers=headers, data=form ) as response: result = await response.json() if response.status >= 400: self.logger.error(f"API error: {response.status} - {result}") return { "success": False, "error": f"API error: {response.status}", "data": result } return result except Exception as e: self.logger.exception(f"Error in API request to {url}: {str(e)}") return { "success": False, "error": f"Request error: {str(e)}" } async def request_raw( self, method: str, endpoint: str, params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None, ) -> bytes: """ Send a request to the DolphinScheduler API and return raw bytes response. Useful for downloading files. Args: method: HTTP method (typically GET) endpoint: API endpoint params: URL parameters headers: Request headers Returns: Raw response bytes """ await self._ensure_session() url = f"{self.config.api_url.rstrip('/')}/{endpoint.lstrip('/')}" if not headers: headers = {} # Add token if available if self.config.has_api_key(): headers["Token"] = self.config.api_key try: self.logger.debug(f"Sending {method} request to {url} for raw response") async with self.session.request( method=method, url=url, params=params, headers=headers ) as response: if response.status >= 400: error_text = await response.text() self.logger.error(f"API error: {response.status} - {error_text}") raise Exception(f"API error: {response.status} - {error_text}") return await response.read() except Exception as e: self.logger.exception(f"Error in API request to {url}: {str(e)}") raise # Project management methods async def get_projects(self, search_val: Optional[str] = None) -> Dict[str, Any]: """Get a list of projects. Args: search_val: Optional search value to filter projects by name Returns: Response from the API """ params = {} if search_val: params["searchVal"] = search_val return await self.request("GET", "projects", params=params) async def get_project(self, project_code: int) -> Dict[str, Any]: """Get project details. Args: project_code: Project code Returns: Response from the API """ return await self.request("GET", f"projects/{project_code}") async def create_project(self, name: str, description: str = "") -> Dict[str, Any]: """Create a new project. Args: name: Project name description: Project description Returns: Response from the API """ data = { "projectName": name } if description: data["description"] = description return await self.request("POST", "projects", json_data=data) async def update_project(self, project_code: int, name: str, description: str = "") -> Dict[str, Any]: """Update a project. Args: project_code: Project code name: Project name description: Project description Returns: Response from the API """ params = { "projectName": name } if description: params["description"] = description return await self.request("PUT", f"projects/{project_code}", params=params) async def delete_project(self, project_code: int) -> Dict[str, Any]: """Delete a project. Args: project_code: Project code Returns: Response from the API """ return await self.request("DELETE", f"projects/{project_code}") ``` -------------------------------------------------------------------------------- /mcp-openapi-split/paths/03_kubernetes_namespace_api.json: -------------------------------------------------------------------------------- ```json { "paths": { "/k8s-namespace": { "get": { "tags": [ "K8S命名空间相关操作" ], "summary": "queryNamespaceListPaging", "description": "查询命名空间列表页面", "operationId": "queryNamespaceListPaging", "parameters": [ { "name": "searchVal", "in": "query", "description": "搜索值", "required": false, "schema": { "type": "string" } }, { "name": "pageSize", "in": "query", "description": "页大小", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "pageNo", "in": "query", "description": "页码号", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } }, "post": { "tags": [ "K8S命名空间相关操作" ], "summary": "createK8sNamespace", "description": "创建命名空间", "operationId": "createNamespace", "parameters": [ { "name": "namespace", "in": "query", "description": "命名空间", "required": true, "schema": { "type": "string" } }, { "name": "clusterCode", "in": "query", "description": "集群代码", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "responses": { "201": { "description": "Created", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/k8s-namespace/verify": { "post": { "tags": [ "K8S命名空间相关操作" ], "summary": "verifyNamespaceK8s", "description": "校验命名空间", "operationId": "verifyNamespace", "parameters": [ { "name": "namespace", "in": "query", "description": "命名空间", "required": true, "schema": { "type": "string" } }, { "name": "clusterCode", "in": "query", "description": "集群代码", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/k8s-namespace/delete": { "post": { "tags": [ "K8S命名空间相关操作" ], "summary": "delNamespaceById", "description": "通过ID删除命名空间", "operationId": "delNamespaceById", "parameters": [ { "name": "id", "in": "query", "description": "k8s命名空间ID", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/k8s-namespace/unauth-namespace": { "get": { "tags": [ "K8S命名空间相关操作" ], "summary": "queryUnauthorizedNamespace", "description": "查询未授权命名空间", "operationId": "queryUnauthorizedNamespace", "parameters": [ { "name": "userId", "in": "query", "description": "用户ID", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/k8s-namespace/available-list": { "get": { "tags": [ "K8S命名空间相关操作" ], "summary": "queryAvailableNamespaceList", "description": "查询可用命名空间列表", "operationId": "queryAvailableNamespaceList", "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/k8s-namespace/authed-namespace": { "get": { "tags": [ "K8S命名空间相关操作" ], "summary": "queryAuthorizedNamespace", "description": "查询授权命名空间", "operationId": "queryAuthorizedNamespace", "parameters": [ { "name": "userId", "in": "query", "description": "用户ID", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } } } } ``` -------------------------------------------------------------------------------- /mcp-openapi-split/paths/20_data_quality_api.json: -------------------------------------------------------------------------------- ```json { "paths": { "/data-quality/ruleList": { "get": { "tags": [ "数据质量相关操作" ], "summary": "queryRuleList", "description": "查询规则列表", "operationId": "queryRuleList", "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultListDqRule" } } } } } } }, "/data-quality/rule/page": { "get": { "tags": [ "数据质量相关操作" ], "summary": "queryRuleListPaging", "description": "查询规则分页列表", "operationId": "queryRuleListPaging", "parameters": [ { "name": "searchVal", "in": "query", "description": "搜索值", "required": false, "schema": { "type": "string" } }, { "name": "ruleType", "in": "query", "description": "规则类型", "required": false, "schema": { "type": "integer", "format": "int32" } }, { "name": "startDate", "in": "query", "description": "开始时间", "required": false, "schema": { "type": "string" } }, { "name": "endDate", "in": "query", "description": "结束时间", "required": false, "schema": { "type": "string" } }, { "name": "pageNo", "in": "query", "description": "页码号", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "pageSize", "in": "query", "description": "页大小", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultPageInfoDqRule" } } } } } } }, "/data-quality/result/page": { "get": { "tags": [ "数据质量相关操作" ], "summary": "queryExecuteResultListPaging", "description": "查询数据质量任务结果分页列表", "operationId": "queryExecuteResultListPaging", "parameters": [ { "name": "searchVal", "in": "query", "description": "搜索值", "required": false, "schema": { "type": "string" } }, { "name": "ruleType", "in": "query", "description": "规则类型", "required": false, "schema": { "type": "integer", "format": "int32" } }, { "name": "state", "in": "query", "description": "状态", "required": false, "schema": { "type": "integer", "format": "int32" } }, { "name": "startDate", "in": "query", "description": "开始时间", "required": false, "schema": { "type": "string" } }, { "name": "endDate", "in": "query", "description": "结束时间", "required": false, "schema": { "type": "string" } }, { "name": "pageNo", "in": "query", "description": "页码号", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "pageSize", "in": "query", "description": "页大小", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultPageInfoDqExecuteResult" } } } } } } }, "/data-quality/getRuleFormCreateJson": { "get": { "tags": [ "数据质量相关操作" ], "summary": "getRuleFormCreateJson", "description": "获取规则form-create json", "operationId": "getRuleFormCreateJsonById", "parameters": [ { "name": "ruleId", "in": "query", "description": "规则ID", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultString" } } } } } } }, "/data-quality/getDatasourceOptionsById": { "get": { "tags": [ "数据质量相关操作" ], "summary": "getDatasourceOptionsById", "description": "获取数据源OPTIONS", "operationId": "getDatasourceOptionsById", "parameters": [ { "name": "datasourceId", "in": "query", "description": "数据源ID", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultListParamsOptions" } } } } } } } } } ``` -------------------------------------------------------------------------------- /mcp-openapi-split/paths/30_token_api.json: -------------------------------------------------------------------------------- ```json { "paths": { "/access-tokens/{id}": { "put": { "tags": [ "访问token相关操作" ], "summary": "updateToken", "description": "更新指定用户的安全令牌", "operationId": "updateToken", "parameters": [ { "name": "id", "in": "path", "description": "安全令牌的ID", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "userId", "in": "query", "description": "用户ID", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "expireTime", "in": "query", "description": "安全令牌的过期时间", "required": true, "schema": { "type": "string" }, "example": "2021-12-31 00:00:00" }, { "name": "token", "in": "query", "description": "安全令牌字符串,若未显式指定将会自动生成", "required": false, "schema": { "type": "string" }, "example": "xxxx" } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultAccessToken" } } } } } }, "delete": { "tags": [ "访问token相关操作" ], "summary": "deleteToken", "description": "DELETE_TOKEN_NOTES", "operationId": "delAccessTokenById", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultBoolean" } } } } } } }, "/access-tokens": { "get": { "tags": [ "访问token相关操作" ], "summary": "queryAccessTokenList", "description": "分页查询access token列表", "operationId": "queryAccessTokenList", "parameters": [ { "name": "pageNo", "in": "query", "description": "页码号", "required": true, "schema": { "type": "integer", "format": "int32" }, "example": 1 }, { "name": "searchVal", "in": "query", "description": "搜索值", "required": false, "schema": { "type": "string" } }, { "name": "pageSize", "in": "query", "description": "页大小", "required": true, "schema": { "type": "integer", "format": "int32" }, "example": 20 } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultPageInfoAccessToken" } } } } } }, "post": { "tags": [ "访问token相关操作" ], "summary": "createToken", "description": "为指定用户创建安全令牌", "operationId": "createToken", "parameters": [ { "name": "userId", "in": "query", "description": "用户ID", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "expireTime", "in": "query", "description": "安全令牌的过期时间", "required": true, "schema": { "type": "string" }, "example": "2021-12-31 00:00:00" }, { "name": "token", "in": "query", "description": "安全令牌字符串,若未显式指定将会自动生成", "required": false, "schema": { "type": "string" }, "example": "xxxx" } ], "responses": { "201": { "description": "Created", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultAccessToken" } } } } } } }, "/access-tokens/generate": { "post": { "tags": [ "访问token相关操作" ], "operationId": "generateToken", "parameters": [ { "name": "userId", "in": "query", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "expireTime", "in": "query", "required": true, "schema": { "type": "string" } } ], "responses": { "201": { "description": "Created", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultString" } } } } } } }, "/access-tokens/user/{userId}": { "get": { "tags": [ "访问token相关操作" ], "summary": "queryAccessTokenByUser", "description": "查询指定用户的access token", "operationId": "queryAccessTokenByUser", "parameters": [ { "name": "userId", "in": "path", "description": "用户ID", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultListAccessToken" } } } } } } } } } ``` -------------------------------------------------------------------------------- /src/dolphinscheduler_mcp/tools_generated/project_parameter_tools.py: -------------------------------------------------------------------------------- ```python """Tools for project parameter operations in DolphinScheduler.""" from typing import Dict, List, Optional from ..fastmcp_compat import FastMCPTool from ..client import DolphinSchedulerClient class GetProjectsProjectParameter(FastMCPTool): """Tool to 查询项目参数""" name = "get_projects_project_parameter" description = "查询项目参数" is_async = True schema = { "type": "object", "properties": { "project_code": { "type": "integer", "format": "int64", "description": "\u9879\u76eeCode" }, "code": { "type": "integer", "format": "int64", "description": "\u9879\u76ee\u53c2\u6570code" } }, "required": [ "project_code", "code" ] } async def _run(self, project_code, code) -> Dict: """Execute the GET operation on /projects/{projectCode}/project-parameter/{code}.""" client = DolphinSchedulerClient() try: response = await client.request( "GET", f"/projects/{project_code}/project-parameter/{code}" ) return {"success": True, "data": response} finally: await client.close() class UpdateProjectsProjectParameter(FastMCPTool): """Tool to 更新项目参数""" name = "update_projects_project_parameter" description = "更新项目参数" is_async = True schema = { "type": "object", "properties": { "project_code": { "type": "integer", "format": "int64", "description": "\u9879\u76eeCode" }, "code": { "type": "integer", "format": "int64", "description": "\u9879\u76ee\u53c2\u6570code" }, "project_parameter_name": { "type": "string", "description": "\u9879\u76ee\u53c2\u6570\u540d\u79f0" }, "project_parameter_value": { "type": "string", "description": "\u9879\u76ee\u53c2\u6570\u503c" } }, "required": [ "project_code", "code", "project_parameter_name", "project_parameter_value" ] } async def _run(self, project_code, code, project_parameter_name, project_parameter_value) -> Dict: """Execute the PUT operation on /projects/{projectCode}/project-parameter/{code}.""" client = DolphinSchedulerClient() try: params = { "projectParameterName": project_parameter_name, "projectParameterValue": project_parameter_value, } response = await client.request( "PUT", f"/projects/{project_code}/project-parameter/{code}", params=params ) return {"success": True, "data": response} finally: await client.close() class GetProjectsProjectParameter2(FastMCPTool): """Tool to 分页查询项目参数""" name = "get_projects_project_parameter2" description = "分页查询项目参数" is_async = True schema = { "type": "object", "properties": { "project_code": { "type": "integer", "format": "int64", "description": "\u9879\u76eeCode" }, "search_val": { "type": "string", "description": "\u641c\u7d22\u503c" }, "page_no": { "type": "integer", "format": "int32", "description": "\u9875\u7801\u53f7" }, "page_size": { "type": "integer", "format": "int32", "description": "\u9875\u5927\u5c0f" } }, "required": [ "project_code", "page_no", "page_size" ] } async def _run(self, project_code, search_val, page_no, page_size) -> Dict: """Execute the GET operation on /projects/{projectCode}/project-parameter.""" client = DolphinSchedulerClient() try: params = { "searchVal": search_val, "pageNo": page_no, "pageSize": page_size, } response = await client.request( "GET", f"/projects/{project_code}/project-parameter", params=params ) return {"success": True, "data": response} finally: await client.close() class CreateProjectsProjectParameter(FastMCPTool): """Tool to 新增项目参数""" name = "create_projects_project_parameter" description = "新增项目参数" is_async = True schema = { "type": "object", "properties": { "project_code": { "type": "integer", "format": "int64", "description": "\u9879\u76eeCode" }, "project_parameter_name": { "type": "string", "description": "\u9879\u76ee\u53c2\u6570\u540d\u79f0" }, "project_parameter_value": { "type": "string", "description": "\u9879\u76ee\u53c2\u6570\u503c" } }, "required": [ "project_code", "project_parameter_name", "project_parameter_value" ] } async def _run(self, project_code, project_parameter_name, project_parameter_value) -> Dict: """Execute the POST operation on /projects/{projectCode}/project-parameter.""" client = DolphinSchedulerClient() try: params = { "projectParameterName": project_parameter_name, "projectParameterValue": project_parameter_value, } response = await client.request( "POST", f"/projects/{project_code}/project-parameter", params=params ) return {"success": True, "data": response} finally: await client.close() class CreateProjectsProjectParameterDelete(FastMCPTool): """Tool to 删除项目参数""" name = "create_projects_project_parameter_delete" description = "删除项目参数" is_async = True schema = { "type": "object", "properties": { "project_code": { "type": "integer", "format": "int64", "description": "\u9879\u76eeCode" }, "code": { "type": "string", "description": "\u9879\u76ee\u53c2\u6570code" } }, "required": [ "project_code", "code" ] } async def _run(self, project_code, code) -> Dict: """Execute the POST operation on /projects/{projectCode}/project-parameter/delete.""" client = DolphinSchedulerClient() try: params = { "code": code, } response = await client.request( "POST", f"/projects/{project_code}/project-parameter/delete", params=params ) return {"success": True, "data": response} finally: await client.close() class CreateProjectsProjectParameterBatchDelete(FastMCPTool): """Tool to 删除项目参数""" name = "create_projects_project_parameter_batch_delete" description = "删除项目参数" is_async = True schema = { "type": "object", "properties": { "project_code": { "type": "integer", "format": "int64", "description": "\u9879\u76eeCode" }, "codes": { "type": "string", "description": "\u9879\u76ee\u53c2\u6570code" } }, "required": [ "project_code", "codes" ] } async def _run(self, project_code, codes) -> Dict: """Execute the POST operation on /projects/{projectCode}/project-parameter/batch-delete.""" client = DolphinSchedulerClient() try: params = { "codes": codes, } response = await client.request( "POST", f"/projects/{project_code}/project-parameter/batch-delete", params=params ) return {"success": True, "data": response} finally: await client.close() def register_project_parameter_tools(mcp): """Register project parameter tools with FastMCP. Args: mcp: The FastMCP instance to register tools with. """ from ..fastmcp_compat import register_tool_class register_tool_class(mcp, CreateProjectsProjectParameter) register_tool_class(mcp, CreateProjectsProjectParameterBatchDelete) register_tool_class(mcp, CreateProjectsProjectParameterDelete) register_tool_class(mcp, GetProjectsProjectParameter) register_tool_class(mcp, GetProjectsProjectParameter2) register_tool_class(mcp, UpdateProjectsProjectParameter) ``` -------------------------------------------------------------------------------- /mcp-openapi-split/paths/33_cluster_api.json: -------------------------------------------------------------------------------- ```json { "paths": { "/cluster/verify-cluster": { "post": { "tags": [ "集群相关操作" ], "summary": "verifyCluster", "description": "校验集群", "operationId": "verifyCluster", "parameters": [ { "name": "clusterName", "in": "query", "description": "集群名称", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultBoolean" } } } } } } }, "/cluster/update": { "post": { "tags": [ "集群相关操作" ], "summary": "updateCluster", "description": "更新集群", "operationId": "updateCluster", "parameters": [ { "name": "code", "in": "query", "description": "集群代码", "required": true, "schema": { "type": "integer", "format": "int64" } }, { "name": "name", "in": "query", "description": "集群名称", "required": true, "schema": { "type": "string" } }, { "name": "config", "in": "query", "description": "集群配置", "required": true, "schema": { "type": "string" } }, { "name": "description", "in": "query", "description": "集群描述", "required": false, "schema": { "type": "string" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultCluster" } } } } } } }, "/cluster/delete": { "post": { "tags": [ "集群相关操作" ], "summary": "deleteClusterByCode", "description": "通过集群代码删除集群", "operationId": "deleteCluster", "parameters": [ { "name": "clusterCode", "in": "query", "description": "集群代码", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultBoolean" } } } } } } }, "/cluster/create": { "post": { "tags": [ "集群相关操作" ], "summary": "createCluster", "description": "创建集群", "operationId": "createCluster", "parameters": [ { "name": "name", "in": "query", "description": "集群名称", "required": true, "schema": { "type": "string" } }, { "name": "config", "in": "query", "description": "集群配置", "required": true, "schema": { "type": "string" } }, { "name": "description", "in": "query", "description": "集群描述", "required": false, "schema": { "type": "string" } } ], "responses": { "201": { "description": "Created", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultLong" } } } } } } }, "/cluster/query-cluster-list": { "get": { "tags": [ "集群相关操作" ], "summary": "queryAllClusterList", "description": "查询所有集群列表", "operationId": "queryAllClusterList", "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultListClusterDto" } } } } } } }, "/cluster/query-by-code": { "get": { "tags": [ "集群相关操作" ], "summary": "queryClusterByCode", "description": "通过集群ID查询集群", "operationId": "queryClusterByCode", "parameters": [ { "name": "clusterCode", "in": "query", "description": "集群代码", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultClusterDto" } } } } } } }, "/cluster/list-paging": { "get": { "tags": [ "集群相关操作" ], "summary": "queryClusterListPaging", "description": "查询集群分页列表", "operationId": "queryClusterListPaging", "parameters": [ { "name": "searchVal", "in": "query", "description": "搜索值", "required": false, "schema": { "type": "string" } }, { "name": "pageSize", "in": "query", "description": "页大小", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "pageNo", "in": "query", "description": "页码号", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultPageInfoClusterDto" } } } } } } } } } ``` -------------------------------------------------------------------------------- /mcp-openapi-split/utils/split_openapi.py: -------------------------------------------------------------------------------- ```python #!/usr/bin/env python3 """ Split DolphinScheduler OpenAPI specification into multiple smaller files. """ import json import os import re from collections import defaultdict # Input file INPUT_FILE = '../ds-restfuleapi-v1.json' # Output directories BASE_DIR = 'base' PATHS_DIR = 'paths' SCHEMAS_DIR = 'schemas' COMBINED_DIR = 'combined' def ensure_directories(): """Ensure all necessary directories exist.""" for directory in [BASE_DIR, PATHS_DIR, SCHEMAS_DIR, COMBINED_DIR]: os.makedirs(directory, exist_ok=True) def load_openapi(): """Load the OpenAPI JSON file.""" with open(INPUT_FILE, 'r', encoding='utf-8') as f: return json.load(f) def save_json(data, filename): """Save JSON data to a file with nice formatting.""" with open(filename, 'w', encoding='utf-8') as f: json.dump(data, f, ensure_ascii=False, indent=4) def save_base_info(openapi): """Save the base OpenAPI information.""" base_info = { "openapi": openapi["openapi"], "info": openapi["info"], "servers": openapi["servers"] } save_json(base_info, os.path.join(BASE_DIR, "01_base.json")) def group_paths_by_tag(openapi): """Group API paths by their tags.""" tag_paths = defaultdict(dict) # Group paths by the first tag for path, path_item in openapi["paths"].items(): tag = None # Find the first operation with tags for method, operation in path_item.items(): if "tags" in operation and operation["tags"]: tag = operation["tags"][0] break # If no tag found, use "misc" if not tag: tag = "misc" # Add to the appropriate tag group tag_paths[tag][path] = path_item return tag_paths def save_paths_by_tag(tag_paths): """Save path groups to separate files.""" for i, (tag, paths) in enumerate(sorted(tag_paths.items()), 1): # Create safe filename from tag safe_name = re.sub(r'[^a-zA-Z0-9]', '_', tag) filename = f"{i:02d}_{safe_name}.json" # Create the paths document paths_doc = {"paths": paths} save_json(paths_doc, os.path.join(PATHS_DIR, filename)) print(f"Created path file {filename} with {len(paths)} paths for tag '{tag}'") def group_schemas(openapi): """Group schemas into related categories.""" schemas = openapi["components"]["schemas"] # Group 1: Basic result schemas result_schemas = {k: v for k, v in schemas.items() if k.startswith("Result")} # Group 2: Data models directly related to projects project_schemas = {k: v for k, v in schemas.items() if "Project" in k or "project" in k.lower()} # Group 3: Data models for tasks and workflows task_schemas = {k: v for k, v in schemas.items() if "Task" in k or "task" in k.lower()} workflow_schemas = {k: v for k, v in schemas.items() if "Process" in k or "Workflow" in k} # Group 4: User and tenant related user_schemas = {k: v for k, v in schemas.items() if "User" in k or "user" in k.lower()} tenant_schemas = {k: v for k, v in schemas.items() if "Tenant" in k or "tenant" in k.lower()} # Group 5: Resource and data source related resource_schemas = {k: v for k, v in schemas.items() if "Resource" in k or "resource" in k.lower()} datasource_schemas = {k: v for k, v in schemas.items() if "DataSource" in k or "datasource" in k.lower()} # Group 6: Alert and monitoring related alert_schemas = {k: v for k, v in schemas.items() if "Alert" in k or "alert" in k.lower()} # Group 7: K8s related k8s_schemas = {k: v for k, v in schemas.items() if "K8s" in k or "k8s" in k.lower()} # Group 8: Queue and worker related queue_schemas = {k: v for k, v in schemas.items() if "Queue" in k or "queue" in k.lower()} worker_schemas = {k: v for k, v in schemas.items() if "Worker" in k or "worker" in k.lower()} # Group 9: Environment and cluster related env_schemas = {k: v for k, v in schemas.items() if "Environment" in k or "environment" in k.lower()} cluster_schemas = {k: v for k, v in schemas.items() if "Cluster" in k or "cluster" in k.lower()} # Group 10: Schedule related schedule_schemas = {k: v for k, v in schemas.items() if "Schedule" in k or "schedule" in k.lower()} # Collect all allocated schemas allocated_schemas = set() for schema_group in [ result_schemas, project_schemas, task_schemas, workflow_schemas, user_schemas, tenant_schemas, resource_schemas, datasource_schemas, alert_schemas, k8s_schemas, queue_schemas, worker_schemas, env_schemas, cluster_schemas, schedule_schemas ]: allocated_schemas.update(schema_group.keys()) # Remaining schemas remaining_schemas = {k: v for k, v in schemas.items() if k not in allocated_schemas} # Split remaining schemas into smaller chunks remaining_chunks = {} chunk_size = len(remaining_schemas) // 10 chunk_size = max(chunk_size, 1) chunk_id = 1 current_chunk = {} for i, (key, value) in enumerate(remaining_schemas.items(), 1): current_chunk[key] = value if i % chunk_size == 0 or i == len(remaining_schemas): remaining_chunks[f"remaining_{chunk_id}"] = current_chunk chunk_id += 1 current_chunk = {} # Prepare the final grouped schemas grouped_schemas = { "result": result_schemas, "project": project_schemas, "task": task_schemas, "workflow": workflow_schemas, "user": user_schemas, "tenant": tenant_schemas, "resource": resource_schemas, "datasource": datasource_schemas, "alert": alert_schemas, "k8s": k8s_schemas, "queue": queue_schemas, "worker": worker_schemas, "environment": env_schemas, "cluster": cluster_schemas, "schedule": schedule_schemas, } # Add the remaining chunks grouped_schemas.update(remaining_chunks) return grouped_schemas def save_schemas(grouped_schemas): """Save schema groups to separate files.""" for i, (group_name, schemas) in enumerate(sorted(grouped_schemas.items()), 1): # Create the schema document schema_doc = {"components": {"schemas": schemas}} # Save to a file filename = f"{i:02d}_{group_name}_schemas.json" save_json(schema_doc, os.path.join(SCHEMAS_DIR, filename)) print(f"Created schema file {filename} with {len(schemas)} schemas for group '{group_name}'") def create_combiner_script(): """Create a script to combine all JSON files back into a single OpenAPI spec.""" script_content = """#!/usr/bin/env python3 ''' Combine split OpenAPI files back into a single specification. ''' import json import os import glob # Output file OUTPUT_FILE = '../combined_openapi.json' def load_json(filename): '''Load JSON from a file.''' with open(filename, 'r', encoding='utf-8') as f: return json.load(f) def combine_openapi(): '''Combine all the split OpenAPI files into a single specification.''' # Start with the base information base_files = sorted(glob.glob('../base/*.json')) if not base_files: raise FileNotFoundError("No base files found!") combined = load_json(base_files[0]) combined['paths'] = {} combined['components'] = {'schemas': {}} # Add all paths path_files = sorted(glob.glob('../paths/*.json')) for path_file in path_files: paths_data = load_json(path_file) if 'paths' in paths_data: combined['paths'].update(paths_data['paths']) # Add all schemas schema_files = sorted(glob.glob('../schemas/*.json')) for schema_file in schema_files: schema_data = load_json(schema_file) if 'components' in schema_data and 'schemas' in schema_data['components']: combined['components']['schemas'].update(schema_data['components']['schemas']) # Save the combined specification with open(OUTPUT_FILE, 'w', encoding='utf-8') as f: json.dump(combined, f, ensure_ascii=False, indent=4) print(f"Combined OpenAPI specification saved to {OUTPUT_FILE}") print(f"Specification contains {len(combined['paths'])} paths and {len(combined['components']['schemas'])} schemas") if __name__ == '__main__': combine_openapi() """ with open(os.path.join("utils", "combine_openapi.py"), 'w', encoding='utf-8') as f: f.write(script_content) # Make the script executable os.chmod(os.path.join("utils", "combine_openapi.py"), 0o755) def main(): """Split the OpenAPI specification into multiple files.""" # Ensure directories exist ensure_directories() # Load the OpenAPI spec print("Loading OpenAPI specification...") openapi = load_openapi() # Save base information (already done manually, but included for completeness) # save_base_info(openapi) print("Base information already saved manually") # Group and save paths by tag print("\nSplitting API paths by tags...") tag_paths = group_paths_by_tag(openapi) save_paths_by_tag(tag_paths) # Group and save schemas print("\nSplitting schema definitions...") grouped_schemas = group_schemas(openapi) save_schemas(grouped_schemas) # Create the combiner script print("\nCreating the combiner script...") create_combiner_script() print("\nDone! The OpenAPI specification has been split into multiple files.") print(f"Paths: {sum(len(paths) for paths in tag_paths.values())} paths in {len(tag_paths)} files") print(f"Schemas: {sum(len(schemas) for schemas in grouped_schemas.values())} schemas in {len(grouped_schemas)} files") if __name__ == "__main__": main() ``` -------------------------------------------------------------------------------- /mcp-openapi-split/schemas/01_alert_schemas.json: -------------------------------------------------------------------------------- ```json { "components": { "schemas": { "AlertPluginInstance": { "type": "object", "properties": { "id": { "type": "integer", "format": "int32" }, "pluginDefineId": { "type": "integer", "format": "int32" }, "instanceName": { "type": "string" }, "pluginInstanceParams": { "type": "string" }, "instanceType": { "type": "string", "enum": [ "NORMAL", "GLOBAL" ] }, "warningType": { "type": "string", "enum": [ "NONE", "SUCCESS", "FAILURE", "ALL", "GLOBAL" ] }, "createTime": { "type": "string", "format": "date-time" }, "updateTime": { "type": "string", "format": "date-time" } } }, "ResultAlertPluginInstance": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "msg": { "type": "string" }, "data": { "$ref": "#/components/schemas/AlertPluginInstance" }, "failed": { "type": "boolean" }, "success": { "type": "boolean" } } }, "AlertGroup": { "type": "object", "properties": { "id": { "type": "integer", "format": "int32" }, "groupName": { "type": "string" }, "alertInstanceIds": { "type": "string" }, "description": { "type": "string" }, "createTime": { "type": "string", "format": "date-time" }, "updateTime": { "type": "string", "format": "date-time" }, "createUserId": { "type": "integer", "format": "int32" } } }, "ResultAlertGroup": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "msg": { "type": "string" }, "data": { "$ref": "#/components/schemas/AlertGroup" }, "failed": { "type": "boolean" }, "success": { "type": "boolean" } } }, "AlertPluginInstanceVO": { "type": "object", "properties": { "id": { "type": "integer", "format": "int32" }, "pluginDefineId": { "type": "integer", "format": "int32" }, "instanceName": { "type": "string" }, "instanceType": { "type": "string" }, "warningType": { "type": "string" }, "pluginInstanceParams": { "type": "string" }, "createTime": { "type": "string", "format": "date-time" }, "updateTime": { "type": "string", "format": "date-time" }, "alertPluginName": { "type": "string" } } }, "PageInfoAlertPluginInstanceVO": { "type": "object", "properties": { "totalList": { "type": "array", "items": { "$ref": "#/components/schemas/AlertPluginInstanceVO" } }, "total": { "type": "integer", "format": "int32" }, "totalPage": { "type": "integer", "format": "int32" }, "pageSize": { "type": "integer", "format": "int32" }, "currentPage": { "type": "integer", "format": "int32" }, "pageNo": { "type": "integer", "format": "int32" } } }, "ResultPageInfoAlertPluginInstanceVO": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "msg": { "type": "string" }, "data": { "$ref": "#/components/schemas/PageInfoAlertPluginInstanceVO" }, "failed": { "type": "boolean" }, "success": { "type": "boolean" } } }, "ResultListAlertPluginInstanceVO": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "msg": { "type": "string" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/AlertPluginInstanceVO" } }, "failed": { "type": "boolean" }, "success": { "type": "boolean" } } }, "PageInfoAlertGroup": { "type": "object", "properties": { "totalList": { "type": "array", "items": { "$ref": "#/components/schemas/AlertGroup" } }, "total": { "type": "integer", "format": "int32" }, "totalPage": { "type": "integer", "format": "int32" }, "pageSize": { "type": "integer", "format": "int32" }, "currentPage": { "type": "integer", "format": "int32" }, "pageNo": { "type": "integer", "format": "int32" } } }, "ResultPageInfoAlertGroup": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "msg": { "type": "string" }, "data": { "$ref": "#/components/schemas/PageInfoAlertGroup" }, "failed": { "type": "boolean" }, "success": { "type": "boolean" } } }, "ResultListAlertGroup": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "msg": { "type": "string" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/AlertGroup" } }, "failed": { "type": "boolean" }, "success": { "type": "boolean" } } } } } } ``` -------------------------------------------------------------------------------- /mcp-openapi-split/paths/25_environment_api.json: -------------------------------------------------------------------------------- ```json { "paths": { "/environment/verify-environment": { "post": { "tags": [ "环境相关操作" ], "summary": "verifyEnvironment", "description": "校验环境", "operationId": "verifyEnvironment", "parameters": [ { "name": "environmentName", "in": "query", "description": "环境名称", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/environment/update": { "post": { "tags": [ "环境相关操作" ], "summary": "updateEnvironment", "description": "UPDATE_ENVIRONMENT_NOTES", "operationId": "updateEnvironment", "parameters": [ { "name": "code", "in": "query", "description": "环境代码", "required": true, "schema": { "type": "integer", "format": "int64" } }, { "name": "name", "in": "query", "description": "环境名称", "required": true, "schema": { "type": "string" } }, { "name": "config", "in": "query", "description": "环境配置", "required": true, "schema": { "type": "string" } }, { "name": "description", "in": "query", "description": "环境描述", "required": false, "schema": { "type": "string" } }, { "name": "workerGroups", "in": "query", "description": "Worker工作组列表", "required": false, "schema": { "type": "string" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultEnvironment" } } } } } } }, "/environment/delete": { "post": { "tags": [ "环境相关操作" ], "summary": "deleteEnvironmentByCode", "description": "通过环境代码删除环境", "operationId": "deleteEnvironment", "parameters": [ { "name": "environmentCode", "in": "query", "description": "环境代码", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/environment/create": { "post": { "tags": [ "环境相关操作" ], "summary": "createEnvironment", "description": "创建环境", "operationId": "createEnvironment", "parameters": [ { "name": "name", "in": "query", "description": "环境名称", "required": true, "schema": { "type": "string" } }, { "name": "config", "in": "query", "description": "环境配置", "required": true, "schema": { "type": "string" } }, { "name": "description", "in": "query", "description": "环境描述", "required": false, "schema": { "type": "string" } }, { "name": "workerGroups", "in": "query", "description": "Worker工作组列表", "required": false, "schema": { "type": "string" } } ], "responses": { "201": { "description": "Created", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultLong" } } } } } } }, "/environment/query-environment-list": { "get": { "tags": [ "环境相关操作" ], "summary": "queryAllEnvironmentList", "description": "查询所有环境列表", "operationId": "queryAllEnvironmentList", "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/environment/query-by-code": { "get": { "tags": [ "环境相关操作" ], "summary": "queryEnvironmentByCode", "description": "通过环境代码查询环境", "operationId": "queryEnvironmentByCode", "parameters": [ { "name": "environmentCode", "in": "query", "description": "环境代码", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/environment/list-paging": { "get": { "tags": [ "环境相关操作" ], "summary": "queryEnvironmentListPaging", "description": "查询环境列表页面", "operationId": "queryEnvironmentListPaging", "parameters": [ { "name": "searchVal", "in": "query", "description": "搜索值", "required": false, "schema": { "type": "string" } }, { "name": "pageSize", "in": "query", "description": "页大小", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "pageNo", "in": "query", "description": "页码号", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } } } } ``` -------------------------------------------------------------------------------- /mcp-openapi-split/paths/14_alert_group_api.json: -------------------------------------------------------------------------------- ```json { "paths": { "/alert-groups/{id}": { "put": { "tags": [ "告警组相关操作" ], "summary": "updateAlertGroup", "description": "编辑(更新)告警组", "operationId": "updateAlertGroupById", "parameters": [ { "name": "id", "in": "path", "description": "告警组ID", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "groupName", "in": "query", "description": "组名称", "required": true, "schema": { "type": "string" } }, { "name": "description", "in": "query", "description": "备注(描述)", "required": false, "schema": { "type": "string" } }, { "name": "alertInstanceIds", "in": "query", "description": "告警实例ID列表(字符串格式,多个告警实例ID以\",\"分割)", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultAlertGroup" } } } } } }, "delete": { "tags": [ "告警组相关操作" ], "summary": "delAlertGroupById", "description": "通过ID删除告警组", "operationId": "deleteAlertGroupById", "parameters": [ { "name": "id", "in": "path", "description": "告警组ID", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultBoolean" } } } } } } }, "/alert-groups": { "get": { "tags": [ "告警组相关操作" ], "summary": "queryAlertGroupListPaging", "description": "分页查询告警组列表", "operationId": "listPaging_2", "parameters": [ { "name": "searchVal", "in": "query", "description": "搜索值", "required": false, "schema": { "type": "string" } }, { "name": "pageNo", "in": "query", "description": "页码号", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "pageSize", "in": "query", "description": "页大小", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultPageInfoAlertGroup" } } } } } }, "post": { "tags": [ "告警组相关操作" ], "summary": "createAlertGroup", "description": "创建告警组", "operationId": "createAlertGroup", "parameters": [ { "name": "groupName", "in": "query", "description": "组名称", "required": true, "schema": { "type": "string" } }, { "name": "description", "in": "query", "description": "备注(描述)", "required": false, "schema": { "type": "string" } }, { "name": "alertInstanceIds", "in": "query", "description": "alertInstanceIds", "required": true, "schema": { "type": "string" } } ], "responses": { "201": { "description": "Created", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultAlertGroup" } } } } } } }, "/alert-groups/query": { "post": { "tags": [ "告警组相关操作" ], "summary": "queryAlertGroupById", "description": "QUERY_ALERT_GROUP_BY_ID_NOTES", "operationId": "queryAlertGroupById", "parameters": [ { "name": "id", "in": "query", "description": "告警组ID", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultAlertGroup" } } } } } } }, "/alert-groups/verify-name": { "get": { "tags": [ "告警组相关操作" ], "summary": "verifyGroupName", "description": "检查告警组是否存在", "operationId": "verifyGroupName_1", "parameters": [ { "name": "groupName", "in": "query", "description": "组名称", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/alert-groups/normal-list": { "get": { "tags": [ "告警组相关操作" ], "summary": "listNormalAlertGroupById", "description": "告警组列表", "operationId": "normalAlertGroupList", "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultListAlertGroup" } } } } } } }, "/alert-groups/list": { "get": { "tags": [ "告警组相关操作" ], "summary": "listAlertGroupById", "description": "告警组列表", "operationId": "list", "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultListAlertGroup" } } } } } } } } } ``` -------------------------------------------------------------------------------- /mcp-openapi-split/paths/10_task_analysis_api.json: -------------------------------------------------------------------------------- ```json { "paths": { "/projects/analysis/task-state-count": { "get": { "tags": [ "任务状态分析相关操作" ], "summary": "countTaskState", "description": "任务状态统计", "operationId": "getTaskInstanceStateCount", "parameters": [ { "name": "startDate", "in": "query", "description": "开始时间", "required": false, "schema": { "type": "string" } }, { "name": "endDate", "in": "query", "description": "结束时间", "required": false, "schema": { "type": "string" } }, { "name": "projectCode", "in": "query", "description": "项目Code", "required": false, "schema": { "type": "integer", "format": "int64" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultTaskInstanceCountVO" } } } } } } }, "/projects/analysis/queue-count": { "get": { "tags": [ "任务状态分析相关操作" ], "summary": "countQueueState", "description": "统计队列里任务状态", "operationId": "countQueueState", "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultMapStringInteger" } } } } } } }, "/projects/analysis/process-state-count": { "get": { "tags": [ "任务状态分析相关操作" ], "summary": "countProcessInstanceState", "description": "统计流程实例状态", "operationId": "getWorkflowInstanceStateCount", "parameters": [ { "name": "startDate", "in": "query", "description": "开始时间", "required": false, "schema": { "type": "string" } }, { "name": "endDate", "in": "query", "description": "结束时间", "required": false, "schema": { "type": "string" } }, { "name": "projectCode", "in": "query", "description": "项目Code", "required": false, "schema": { "type": "integer", "format": "int64" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultWorkflowInstanceCountVO" } } } } } } }, "/projects/analysis/listErrorCommand": { "get": { "tags": [ "任务状态分析相关操作" ], "summary": "listErrorCommand", "description": "LIST_ERROR_COMMAND_LIST_PAGING_NOTES", "operationId": "listErrorCommand", "parameters": [ { "name": "projectCode", "in": "query", "required": false, "schema": { "type": "integer", "format": "int64" } }, { "name": "pageNo", "in": "query", "description": "页码号", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "pageSize", "in": "query", "description": "页大小", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "searchVal", "description": "搜索值", "schema": { "type": "string" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultPageInfoErrorCommand" } } } } } } }, "/projects/analysis/listCommand": { "get": { "tags": [ "任务状态分析相关操作" ], "summary": "listPendingCommands", "description": "LIST_PENDING_COMMANDS", "operationId": "listPaging", "parameters": [ { "name": "projectCode", "in": "query", "required": false, "schema": { "type": "integer", "format": "int64" } }, { "name": "pageNo", "in": "query", "description": "页码号", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "pageSize", "in": "query", "description": "页大小", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "searchVal", "description": "搜索值", "schema": { "type": "string" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultPageInfoCommand" } } } } } } }, "/projects/analysis/define-user-count": { "get": { "tags": [ "任务状态分析相关操作" ], "summary": "countDefinitionByUser", "description": "统计用户创建的流程定义", "operationId": "countDefinitionByUser", "parameters": [ { "name": "projectCode", "in": "query", "description": "项目Code", "required": false, "schema": { "type": "integer", "format": "int64" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultWorkflowDefinitionCountVO" } } } } } } }, "/projects/analysis/command-state-count": { "get": { "tags": [ "任务状态分析相关操作" ], "summary": "countCommandState", "description": "统计命令状态", "operationId": "countCommandState", "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultListCommandStateCount" } } } } } } } } } ``` -------------------------------------------------------------------------------- /mcp-openapi-split/paths/34_project_parameter_api.json: -------------------------------------------------------------------------------- ```json { "paths": { "/projects/{projectCode}/project-parameter/{code}": { "get": { "tags": [ "项目参数相关操作" ], "summary": "queryProjectParameterByCode", "description": "查询项目参数", "operationId": "queryProjectParameterByCode", "parameters": [ { "name": "projectCode", "in": "path", "description": "项目Code", "required": true, "schema": { "type": "integer", "format": "int64" } }, { "name": "code", "in": "path", "description": "项目参数code", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } }, "put": { "tags": [ "项目参数相关操作" ], "summary": "updateProjectParameter", "description": "更新项目参数", "operationId": "updateProjectParameter", "parameters": [ { "name": "projectCode", "in": "path", "description": "项目Code", "required": true, "schema": { "type": "integer", "format": "int64" } }, { "name": "code", "in": "path", "description": "项目参数code", "required": true, "schema": { "type": "integer", "format": "int64" } }, { "name": "projectParameterName", "in": "query", "description": "项目参数名称", "required": true, "schema": { "type": "string" } }, { "name": "projectParameterValue", "in": "query", "description": "项目参数值", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/projects/{projectCode}/project-parameter": { "get": { "tags": [ "项目参数相关操作" ], "summary": "queryProjectParameterListPaging", "description": "分页查询项目参数", "operationId": "queryProjectParameterListPaging", "parameters": [ { "name": "projectCode", "in": "path", "description": "项目Code", "required": true, "schema": { "type": "integer", "format": "int64" } }, { "name": "searchVal", "in": "query", "description": "搜索值", "required": false, "schema": { "type": "string" } }, { "name": "pageNo", "in": "query", "description": "页码号", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "pageSize", "in": "query", "description": "页大小", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } }, "post": { "tags": [ "项目参数相关操作" ], "summary": "createProjectParameter", "description": "新增项目参数", "operationId": "createProjectParameter", "parameters": [ { "name": "projectCode", "in": "path", "description": "项目Code", "required": true, "schema": { "type": "integer", "format": "int64" } }, { "name": "projectParameterName", "in": "query", "description": "项目参数名称", "required": true, "schema": { "type": "string" } }, { "name": "projectParameterValue", "in": "query", "description": "项目参数值", "required": true, "schema": { "type": "string" } } ], "responses": { "201": { "description": "Created", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/projects/{projectCode}/project-parameter/delete": { "post": { "tags": [ "项目参数相关操作" ], "summary": "deleteProjectParametersByCode", "description": "删除项目参数", "operationId": "deleteProjectParametersByCode", "parameters": [ { "name": "projectCode", "in": "path", "description": "项目Code", "required": true, "schema": { "type": "integer", "format": "int64" } }, { "name": "code", "in": "query", "description": "项目参数code", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/projects/{projectCode}/project-parameter/batch-delete": { "post": { "tags": [ "项目参数相关操作" ], "summary": "batchDeleteProjectParametersByCodes", "description": "删除项目参数", "operationId": "batchDeleteProjectParametersByCodes", "parameters": [ { "name": "projectCode", "in": "path", "description": "项目Code", "required": true, "schema": { "type": "integer", "format": "int64" } }, { "name": "codes", "in": "query", "description": "项目参数code", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } } } } ``` -------------------------------------------------------------------------------- /mcp-openapi-split/schemas/24_task_schemas.json: -------------------------------------------------------------------------------- ```json { "components": { "schemas": { "ProcessTaskRelation": { "type": "object", "properties": { "id": { "type": "integer", "format": "int32" }, "name": { "type": "string" }, "processDefinitionVersion": { "type": "integer", "format": "int32" }, "projectCode": { "type": "integer", "format": "int64" }, "processDefinitionCode": { "type": "integer", "format": "int64" }, "preTaskCode": { "type": "integer", "format": "int64" }, "preTaskVersion": { "type": "integer", "format": "int32" }, "postTaskCode": { "type": "integer", "format": "int64" }, "postTaskVersion": { "type": "integer", "format": "int32" }, "conditionType": { "type": "string", "enum": [ "NONE", "JUDGE", "DELAY" ] }, "conditionParams": { "type": "string" }, "createTime": { "type": "string", "format": "date-time" }, "updateTime": { "type": "string", "format": "date-time" } } }, "TaskDefinition": { "type": "object", "properties": { "id": { "type": "integer", "format": "int32" }, "code": { "type": "integer", "format": "int64" }, "name": { "type": "string" }, "version": { "type": "integer", "format": "int32" }, "description": { "type": "string" }, "projectCode": { "type": "integer", "format": "int64" }, "userId": { "type": "integer", "format": "int32" }, "taskType": { "type": "string" }, "taskParams": { "type": "string" }, "taskParamList": { "type": "array", "items": { "$ref": "#/components/schemas/Property" } }, "taskParamMap": { "type": "object", "additionalProperties": { "type": "string" } }, "flag": { "type": "string", "enum": [ "NO", "YES" ] }, "isCache": { "type": "string", "enum": [ "NO", "YES" ] }, "taskPriority": { "type": "string", "enum": [ "HIGHEST", "HIGH", "MEDIUM", "LOW", "LOWEST" ] }, "userName": { "type": "string" }, "projectName": { "type": "string" }, "workerGroup": { "type": "string" }, "environmentCode": { "type": "integer", "format": "int64" }, "failRetryTimes": { "type": "integer", "format": "int32" }, "failRetryInterval": { "type": "integer", "format": "int32" }, "timeoutFlag": { "type": "string", "enum": [ "CLOSE", "OPEN" ] }, "timeoutNotifyStrategy": { "type": "string", "enum": [ "WARN", "FAILED", "WARNFAILED" ] }, "timeout": { "type": "integer", "format": "int32" }, "delayTime": { "type": "integer", "format": "int32" }, "resourceIds": { "type": "string", "deprecated": true }, "createTime": { "type": "string", "format": "date-time" }, "updateTime": { "type": "string", "format": "date-time" }, "modifyBy": { "type": "string" }, "taskGroupId": { "type": "integer", "format": "int32" }, "taskGroupPriority": { "type": "integer", "format": "int32" }, "cpuQuota": { "type": "integer", "format": "int32" }, "memoryMax": { "type": "integer", "format": "int32" }, "taskExecuteType": { "type": "string", "enum": [ "BATCH", "STREAM" ] }, "dependence": { "type": "string" } } }, "ResultTaskInstanceCountVO": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "msg": { "type": "string" }, "data": { "$ref": "#/components/schemas/TaskInstanceCountVO" }, "failed": { "type": "boolean" }, "success": { "type": "boolean" } } }, "TaskInstanceCountVO": { "type": "object", "properties": { "totalCount": { "type": "integer", "format": "int32" }, "taskInstanceStatusCounts": { "type": "array", "items": { "$ref": "#/components/schemas/TaskInstanceStatusCountDto" } } } }, "TaskInstanceStatusCountDto": { "type": "object", "properties": { "state": { "type": "string", "enum": [ "TaskExecutionStatus{code=0, desc='submit success'}", "TaskExecutionStatus{code=1, desc='running'}", "TaskExecutionStatus{code=3, desc='pause'}", "TaskExecutionStatus{code=5, desc='stop'}", "TaskExecutionStatus{code=6, desc='failure'}", "TaskExecutionStatus{code=7, desc='success'}", "TaskExecutionStatus{code=8, desc='need fault tolerance'}", "TaskExecutionStatus{code=9, desc='kill'}", "TaskExecutionStatus{code=12, desc='delay execution'}", "TaskExecutionStatus{code=13, desc='forced success'}", "TaskExecutionStatus{code=17, desc='dispatch'}" ] }, "count": { "type": "integer", "format": "int32" } } }, "ResponseTaskLog": { "type": "object", "properties": { "lineNum": { "type": "integer", "format": "int32" }, "message": { "type": "string" } } }, "ResultResponseTaskLog": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "msg": { "type": "string" }, "data": { "$ref": "#/components/schemas/ResponseTaskLog" }, "failed": { "type": "boolean" }, "success": { "type": "boolean" } } }, "TaskInstanceRemoveCacheResponse": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "msg": { "type": "string" }, "data": { "type": "object" }, "cacheKey": { "type": "string" }, "failed": { "type": "boolean" }, "success": { "type": "boolean" } } } } } } ``` -------------------------------------------------------------------------------- /mcp-openapi-split/paths/13_alert_plugin_instance_api.json: -------------------------------------------------------------------------------- ```json { "paths": { "/alert-plugin-instances/{id}": { "get": { "tags": [ "告警插件实例相关操作" ], "summary": "getAlertPluginInstance", "description": "查询告警插件实例", "operationId": "getAlertPluginInstance", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultAlertPluginInstance" } } } } } }, "put": { "tags": [ "告警插件实例相关操作" ], "summary": "updateAlertPluginInstance", "description": "更新告警插件实例", "operationId": "updateAlertPluginInstanceById", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "instanceName", "in": "query", "description": "告警插件实例名称", "required": true, "schema": { "type": "string" } }, { "name": "warningType", "in": "query", "required": true, "schema": { "type": "string", "enum": [ "NONE", "SUCCESS", "FAILURE", "ALL", "GLOBAL" ] } }, { "name": "pluginInstanceParams", "in": "query", "description": "告警插件实例参数", "required": true, "schema": { "type": "string" } }, { "name": "alertPluginInstanceId", "description": "告警插件实例ID", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultAlertPluginInstance" } } } } } }, "delete": { "tags": [ "告警插件实例相关操作" ], "summary": "deleteAlertPluginInstance", "description": "删除告警插件实例", "operationId": "deleteAlertPluginInstance", "parameters": [ { "name": "id", "in": "path", "description": "告警插件ID", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultBoolean" } } } } } } }, "/alert-plugin-instances": { "get": { "tags": [ "告警插件实例相关操作" ], "summary": "queryAlertPluginInstanceListPaging", "description": "分页查询告警实例列表", "operationId": "listPaging_1", "parameters": [ { "name": "searchVal", "in": "query", "description": "搜索值", "required": false, "schema": { "type": "string" } }, { "name": "pageNo", "in": "query", "description": "页码号", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "pageSize", "in": "query", "description": "页大小", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultPageInfoAlertPluginInstanceVO" } } } } } }, "post": { "tags": [ "告警插件实例相关操作" ], "summary": "createAlertPluginInstance", "description": "创建告警插件实例", "operationId": "createAlertPluginInstance", "parameters": [ { "name": "pluginDefineId", "in": "query", "description": "告警插件定义ID", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "instanceName", "in": "query", "description": "告警插件实例名称", "required": true, "schema": { "type": "string" } }, { "name": "instanceType", "in": "query", "required": true, "schema": { "type": "string", "enum": [ "NORMAL", "GLOBAL" ] } }, { "name": "warningType", "in": "query", "required": true, "schema": { "type": "string", "enum": [ "NONE", "SUCCESS", "FAILURE", "ALL", "GLOBAL" ] } }, { "name": "pluginInstanceParams", "in": "query", "description": "告警插件实例参数", "required": true, "schema": { "type": "string" } } ], "responses": { "201": { "description": "Created", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultAlertPluginInstance" } } } } } } }, "/alert-plugin-instances/test-send": { "post": { "tags": [ "告警插件实例相关操作" ], "summary": "testSendAlertPluginInstance", "description": "TEST_SEND_ALERT_PLUGIN_INSTANCE", "operationId": "testSendAlertPluginInstance", "parameters": [ { "name": "pluginDefineId", "in": "query", "description": "告警插件定义ID", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "pluginInstanceParams", "in": "query", "description": "告警插件实例参数", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultBoolean" } } } } } } }, "/alert-plugin-instances/verify-name": { "get": { "tags": [ "告警插件实例相关操作" ], "summary": "verifyAlertInstanceName", "description": "验证告警插件名称", "operationId": "verifyGroupName", "parameters": [ { "name": "alertInstanceName", "in": "query", "description": "告警插件名称", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/alert-plugin-instances/list": { "get": { "tags": [ "告警插件实例相关操作" ], "summary": "queryAlertPluginInstanceList", "description": "查询所有告警实例列表", "operationId": "getAlertPluginInstance_1", "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultListAlertPluginInstanceVO" } } } } } } } } } ``` -------------------------------------------------------------------------------- /mcp-openapi-split/paths/09_task_instance_api.json: -------------------------------------------------------------------------------- ```json { "paths": { "/projects/{projectCode}/task-instances/{id}/stop": { "post": { "tags": [ "任务实例相关操作" ], "summary": "stop", "description": "停止任务实例", "operationId": "stopTask", "parameters": [ { "name": "projectCode", "in": "path", "description": "项目Code", "required": true, "schema": { "type": "integer", "format": "int64" } }, { "name": "id", "in": "path", "description": "任务实例ID", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultObject" } } } } } } }, "/projects/{projectCode}/task-instances/{id}/savepoint": { "post": { "tags": [ "任务实例相关操作" ], "summary": "savepoint", "description": "任务SavePoint", "operationId": "taskSavePoint", "parameters": [ { "name": "projectCode", "in": "path", "description": "项目Code", "required": true, "schema": { "type": "integer", "format": "int64" } }, { "name": "id", "in": "path", "description": "任务实例ID", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultObject" } } } } } } }, "/projects/{projectCode}/task-instances/{id}/force-success": { "post": { "tags": [ "任务实例相关操作" ], "summary": "force-success", "description": "强制TASK成功", "operationId": "forceTaskSuccess", "parameters": [ { "name": "projectCode", "in": "path", "required": true, "schema": { "type": "integer", "format": "int64" } }, { "name": "id", "in": "path", "description": "任务实例ID", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultVoid" } } } } } } }, "/projects/{projectCode}/task-instances": { "get": { "tags": [ "任务实例相关操作" ], "summary": "queryTaskListPaging", "description": "分页查询任务实例列表", "operationId": "queryTaskListPaging", "parameters": [ { "name": "projectCode", "in": "path", "description": "项目Code", "required": true, "schema": { "type": "integer", "format": "int64" } }, { "name": "processInstanceId", "in": "query", "description": "流程实例ID", "required": false, "schema": { "type": "integer", "format": "int32" } }, { "name": "processInstanceName", "in": "query", "description": "流程实例名称", "required": false, "schema": { "type": "string" } }, { "name": "processDefinitionName", "in": "query", "required": false, "schema": { "type": "string" } }, { "name": "searchVal", "in": "query", "description": "搜索值", "required": false, "schema": { "type": "string" } }, { "name": "taskName", "in": "query", "description": "任务实例名", "required": false, "schema": { "type": "string" } }, { "name": "taskCode", "in": "query", "description": "TASK_CODE", "required": false, "schema": { "type": "integer", "format": "int64" } }, { "name": "executorName", "in": "query", "description": "流程名称", "required": false, "schema": { "type": "string" } }, { "name": "stateType", "in": "query", "description": "工作流和任务节点的运行状态", "required": false, "schema": { "type": "string", "enum": [ "TaskExecutionStatus{code=0, desc='submit success'}", "TaskExecutionStatus{code=1, desc='running'}", "TaskExecutionStatus{code=3, desc='pause'}", "TaskExecutionStatus{code=5, desc='stop'}", "TaskExecutionStatus{code=6, desc='failure'}", "TaskExecutionStatus{code=7, desc='success'}", "TaskExecutionStatus{code=8, desc='need fault tolerance'}", "TaskExecutionStatus{code=9, desc='kill'}", "TaskExecutionStatus{code=12, desc='delay execution'}", "TaskExecutionStatus{code=13, desc='forced success'}", "TaskExecutionStatus{code=17, desc='dispatch'}" ] } }, { "name": "host", "in": "query", "description": "运行任务的主机IP地址", "required": false, "schema": { "type": "string" } }, { "name": "startDate", "in": "query", "description": "开始时间", "required": false, "schema": { "type": "string" } }, { "name": "endDate", "in": "query", "description": "结束时间", "required": false, "schema": { "type": "string" } }, { "name": "taskExecuteType", "in": "query", "description": "任务执行类型", "required": false, "schema": { "type": "string", "enum": [ "BATCH", "STREAM" ] } }, { "name": "pageNo", "in": "query", "description": "页码号", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "pageSize", "in": "query", "description": "页大小", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/projects/{projectCode}/task-instances/{id}/remove-cache": { "delete": { "tags": [ "任务实例相关操作" ], "summary": "remove-task-instance-cache", "description": "REMOVE_TASK_INSTANCE_CACHE", "operationId": "removeTaskInstanceCache", "parameters": [ { "name": "projectCode", "in": "path", "description": "项目Code", "required": true, "schema": { "type": "integer", "format": "int64" } }, { "name": "id", "in": "path", "description": "任务实例ID", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/TaskInstanceRemoveCacheResponse" } } } } } } } } } ``` -------------------------------------------------------------------------------- /mcp-openapi-split/paths/17_process_task_relation_api.json: -------------------------------------------------------------------------------- ```json { "paths": { "/projects/{projectCode}/process-task-relation": { "post": { "tags": [ "工作流关系相关操作" ], "summary": "save", "description": "创建工作流任务关系", "operationId": "createProcessTaskRelation", "parameters": [ { "name": "projectCode", "in": "path", "description": "项目Code", "required": true, "schema": { "type": "integer", "format": "int64" } }, { "name": "processDefinitionCode", "in": "query", "description": "流程定义编码", "required": true, "schema": { "type": "integer", "format": "int64" } }, { "name": "preTaskCode", "in": "query", "description": "PRE_TASK_CODE", "required": true, "schema": { "type": "integer", "format": "int64" } }, { "name": "postTaskCode", "in": "query", "description": "POST_TASK_CODE", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "responses": { "201": { "description": "Created", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/projects/{projectCode}/process-task-relation/{taskCode}/upstream": { "get": { "tags": [ "工作流关系相关操作" ], "summary": "queryUpstreamRelation", "description": "查询上游工作流任务关系", "operationId": "queryUpstreamRelation", "parameters": [ { "name": "projectCode", "in": "path", "description": "项目Code", "required": true, "schema": { "type": "integer", "format": "int64" } }, { "name": "taskCode", "in": "path", "description": "TASK_CODE", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } }, "delete": { "tags": [ "工作流关系相关操作" ], "summary": "deleteUpstreamRelation", "description": "删除上游工作流任务关系", "operationId": "deleteUpstreamRelation", "parameters": [ { "name": "projectCode", "in": "path", "description": "项目Code", "required": true, "schema": { "type": "integer", "format": "int64" } }, { "name": "preTaskCodes", "in": "query", "description": "PRE_TASK_CODES", "required": true, "schema": { "type": "string" } }, { "name": "taskCode", "in": "path", "description": "TASK_CODE", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/projects/{projectCode}/process-task-relation/{taskCode}/downstream": { "get": { "tags": [ "工作流关系相关操作" ], "summary": "queryDownstreamRelation", "description": "查询下游工作流任务关系", "operationId": "queryDownstreamRelation", "parameters": [ { "name": "projectCode", "in": "path", "description": "项目Code", "required": true, "schema": { "type": "integer", "format": "int64" } }, { "name": "taskCode", "in": "path", "description": "TASK_CODE", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } }, "delete": { "tags": [ "工作流关系相关操作" ], "summary": "deleteDownstreamRelation", "description": "删除下游工作流任务关系", "operationId": "deleteDownstreamRelation", "parameters": [ { "name": "projectCode", "in": "path", "description": "项目Code", "required": true, "schema": { "type": "integer", "format": "int64" } }, { "name": "postTaskCodes", "in": "query", "description": "POST_TASK_CODES", "required": true, "schema": { "type": "string" } }, { "name": "taskCode", "in": "path", "description": "TASK_CODE", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/projects/{projectCode}/process-task-relation/{taskCode}": { "delete": { "tags": [ "工作流关系相关操作" ], "summary": "deleteRelation", "description": "删除工作流任务关系", "operationId": "deleteTaskProcessRelation", "parameters": [ { "name": "projectCode", "in": "path", "description": "项目Code", "required": true, "schema": { "type": "integer", "format": "int64" } }, { "name": "processDefinitionCode", "in": "query", "description": "流程定义编码", "required": true, "schema": { "type": "integer", "format": "int64" } }, { "name": "taskCode", "in": "path", "description": "TASK_CODE", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/projects/{projectCode}/process-task-relation/{processDefinitionCode}/{preTaskCode}/{postTaskCode}": { "delete": { "tags": [ "工作流关系相关操作" ], "summary": "deleteEdge", "description": "删除工作流任务连接线", "operationId": "deleteEdge", "parameters": [ { "name": "projectCode", "in": "path", "description": "项目Code", "required": true, "schema": { "type": "integer", "format": "int64" } }, { "name": "processDefinitionCode", "in": "path", "description": "流程定义编码", "required": true, "schema": { "type": "integer", "format": "int64" } }, { "name": "preTaskCode", "in": "path", "description": "PRE_TASK_CODE", "required": true, "schema": { "type": "integer", "format": "int64" } }, { "name": "postTaskCode", "in": "path", "description": "POST_TASK_CODE", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } } } } ``` -------------------------------------------------------------------------------- /src/dolphinscheduler_mcp/tools_generated/project_tools.py: -------------------------------------------------------------------------------- ```python """Tools for project operations in DolphinScheduler.""" from typing import Dict, List, Optional from ..fastmcp_compat import FastMCPTool from ..client import DolphinSchedulerClient class GetProjects(FastMCPTool): """Tool to 通过项目id查询项目信息""" name = "get_projects" description = "通过项目ID查询项目信息" is_async = True schema = { "type": "object", "properties": { "code": { "type": "integer", "format": "int64", "description": "\u9879\u76eeCode" } }, "required": [ "code" ] } async def _run(self, code) -> Dict: """Execute the GET operation on /projects/{code}.""" client = DolphinSchedulerClient() try: response = await client.request( "GET", f"/projects/{code}" ) return {"success": True, "data": response} finally: await client.close() class UpdateProjects(FastMCPTool): """Tool to 更新项目""" name = "update_projects" description = "更新项目" is_async = True schema = { "type": "object", "properties": { "code": { "type": "integer", "format": "int64", "description": "\u9879\u76eeCode" }, "projectName": { "type": "string", "description": "\u9879\u76ee\u540d\u79f0" }, "description": { "type": "string", "description": "\u9879\u76ee\u63cf\u8ff0" } }, "required": [ "code", "projectName" ] } async def _run(self, code, projectName, description) -> Dict: """Execute the PUT operation on /projects/{code}.""" client = DolphinSchedulerClient() try: params = { "projectName": projectName, "description": description, } response = await client.request( "PUT", f"/projects/{code}", params=params ) return {"success": True, "data": response} finally: await client.close() class DeleteProjects(FastMCPTool): """Tool to 通过id删除项目""" name = "delete_projects" description = "通过ID删除项目" is_async = True schema = { "type": "object", "properties": { "code": { "type": "integer", "format": "int64", "description": "\u9879\u76eeCode" } }, "required": [ "code" ] } async def _run(self, code) -> Dict: """Execute the DELETE operation on /projects/{code}.""" client = DolphinSchedulerClient() try: response = await client.request( "DELETE", f"/projects/{code}" ) return {"success": True, "data": response} finally: await client.close() class GetProjects36(FastMCPTool): """Tool to 分页查询项目列表""" name = "get_projects36" description = "分页查询项目列表" is_async = True schema = { "type": "object", "properties": { "searchVal": { "type": "string", "description": "\u641c\u7d22\u503c" }, "pageSize": { "type": "integer", "format": "int32", "description": "\u9875\u5927\u5c0f" }, "pageNo": { "type": "integer", "format": "int32", "description": "\u9875\u7801\u53f7" } }, "required": [ "pageSize", "pageNo" ] } async def _run(self, searchVal, pageSize, pageNo) -> Dict: """Execute the GET operation on /projects.""" client = DolphinSchedulerClient() try: params = { "searchVal": searchVal, "pageSize": pageSize, "pageNo": pageNo, } response = await client.request( "GET", f"/projects", params=params ) return {"success": True, "data": response} finally: await client.close() class CreateProjects(FastMCPTool): """Tool to 创建项目""" name = "create_projects" description = "创建项目" is_async = True schema = { "type": "object", "properties": { "projectName": { "type": "string", "description": "\u9879\u76ee\u540d\u79f0" }, "description": { "type": "string", "description": "\u9879\u76ee\u63cf\u8ff0" } }, "required": [ "projectName" ] } async def _run(self, projectName, description) -> Dict: """Execute the POST operation on /projects.""" client = DolphinSchedulerClient() try: params = { "projectName": projectName, "description": description, } response = await client.request( "POST", f"/projects", params=params ) return {"success": True, "data": response} finally: await client.close() class GetProjectsUnauthProject(FastMCPTool): """Tool to 查询未授权的项目""" name = "get_projects_unauth_project" description = "查询未授权的项目" is_async = True schema = { "type": "object", "properties": { "userId": { "type": "integer", "format": "int32", "description": "\u7528\u6237ID" } }, "required": [ "userId" ] } async def _run(self, userId) -> Dict: """Execute the GET operation on /projects/unauth-project.""" client = DolphinSchedulerClient() try: params = { "userId": userId, } response = await client.request( "GET", f"/projects/unauth-project", params=params ) return {"success": True, "data": response} finally: await client.close() class GetProjectsProjectWithAuthorizedLevel(FastMCPTool): """Tool to query_project_authorized_level""" name = "get_projects_project_with_authorized_level" description = "QUERY_PROJECT_AUTHORIZED_LEVEL" is_async = True schema = { "type": "object", "properties": { "user_id": { "type": "integer", "format": "int32", "description": "\u7528\u6237ID" } }, "required": [ "user_id" ] } async def _run(self, user_id) -> Dict: """Execute the GET operation on /projects/project-with-authorized-level.""" client = DolphinSchedulerClient() try: params = { "userId": user_id, } response = await client.request( "GET", f"/projects/project-with-authorized-level", params=params ) return {"success": True, "data": response} finally: await client.close() class GetProjectsProjectWithAuthorizedLevelListPaging(FastMCPTool): """Tool to query_project_with_auth_level_list_paging_notes""" name = "get_projects_project_with_authorized_level_list_paging" description = "QUERY_PROJECT_WITH_AUTH_LEVEL_LIST_PAGING_NOTES" is_async = True schema = { "type": "object", "properties": { "user_id": { "type": "integer", "format": "int32", "description": "\u7528\u6237ID" }, "search_val": { "type": "string", "description": "\u641c\u7d22\u503c" }, "page_size": { "type": "integer", "format": "int32", "description": "\u9875\u5927\u5c0f" }, "page_no": { "type": "integer", "format": "int32", "description": "\u9875\u7801\u53f7" } }, "required": [ "user_id", "page_size", "page_no" ] } async def _run(self, user_id, search_val, page_size, page_no) -> Dict: """Execute the GET operation on /projects/project-with-authorized-level-list-paging.""" client = DolphinSchedulerClient() try: params = { "userId": user_id, "searchVal": search_val, "pageSize": page_size, "pageNo": page_no, } response = await client.request( "GET", f"/projects/project-with-authorized-level-list-paging", params=params ) return {"success": True, "data": response} finally: await client.close() class ListProjectsList(FastMCPTool): """Tool to 查询所有项目""" name = "list_projects_list" description = "查询所有项目" is_async = True async def _run(self) -> Dict: """Execute the GET operation on /projects/list.""" client = DolphinSchedulerClient() try: response = await client.request( "GET", f"/projects/list" ) return {"success": True, "data": response} finally: await client.close() class GetProjectsListDependent(FastMCPTool): """Tool to 查询dependent节点所有项目""" name = "get_projects_list_dependent" description = "查询Dependent节点所有项目" is_async = True async def _run(self) -> Dict: """Execute the GET operation on /projects/list-dependent.""" client = DolphinSchedulerClient() try: response = await client.request( "GET", f"/projects/list-dependent" ) return {"success": True, "data": response} finally: await client.close() class GetProjectsCreatedAndAuthed(FastMCPTool): """Tool to 查询授权和用户创建的项目""" name = "get_projects_created_and_authed" description = "查询授权和用户创建的项目" is_async = True async def _run(self) -> Dict: """Execute the GET operation on /projects/created-and-authed.""" client = DolphinSchedulerClient() try: response = await client.request( "GET", f"/projects/created-and-authed" ) return {"success": True, "data": response} finally: await client.close() class GetProjectsAuthedUser(FastMCPTool): """Tool to 查询拥有项目授权的用户""" name = "get_projects_authed_user" description = "查询拥有项目授权的用户" is_async = True schema = { "type": "object", "properties": { "project_code": { "type": "integer", "format": "int64", "description": "\u9879\u76eeCode" } }, "required": [ "project_code" ] } async def _run(self, project_code) -> Dict: """Execute the GET operation on /projects/authed-user.""" client = DolphinSchedulerClient() try: params = { "projectCode": project_code, } response = await client.request( "GET", f"/projects/authed-user", params=params ) return {"success": True, "data": response} finally: await client.close() class GetProjectsAuthedProject(FastMCPTool): """Tool to 查询授权项目""" name = "get_projects_authed_project" description = "查询授权项目" is_async = True schema = { "type": "object", "properties": { "user_id": { "type": "integer", "format": "int32", "description": "\u7528\u6237ID" } }, "required": [ "user_id" ] } async def _run(self, user_id) -> Dict: """Execute the GET operation on /projects/authed-project.""" client = DolphinSchedulerClient() try: params = { "userId": user_id, } response = await client.request( "GET", f"/projects/authed-project", params=params ) return {"success": True, "data": response} finally: await client.close() def register_project_tools(mcp): """Register project tools with FastMCP. Args: mcp: The FastMCP instance to register tools with. """ from ..fastmcp_compat import register_tool_class register_tool_class(mcp, CreateProjects) register_tool_class(mcp, DeleteProjects) register_tool_class(mcp, GetProjects) register_tool_class(mcp, GetProjects36) register_tool_class(mcp, GetProjectsAuthedProject) register_tool_class(mcp, GetProjectsAuthedUser) register_tool_class(mcp, GetProjectsCreatedAndAuthed) register_tool_class(mcp, GetProjectsListDependent) register_tool_class(mcp, GetProjectsProjectWithAuthorizedLevel) register_tool_class(mcp, GetProjectsProjectWithAuthorizedLevelListPaging) register_tool_class(mcp, GetProjectsUnauthProject) register_tool_class(mcp, ListProjectsList) register_tool_class(mcp, UpdateProjects) ``` -------------------------------------------------------------------------------- /mcp-openapi-split/paths/35_project_api.json: -------------------------------------------------------------------------------- ```json { "paths": { "/projects/{code}": { "get": { "tags": [ "项目相关操作" ], "summary": "queryProjectByCode", "description": "通过项目ID查询项目信息", "operationId": "queryProjectByCode", "parameters": [ { "name": "code", "in": "path", "description": "项目Code", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } }, "put": { "tags": [ "项目相关操作" ], "summary": "update", "description": "更新项目", "operationId": "updateProject", "parameters": [ { "name": "code", "in": "path", "description": "项目Code", "required": true, "schema": { "type": "integer", "format": "int64" } }, { "name": "projectName", "in": "query", "description": "项目名称", "required": true, "schema": { "type": "string" } }, { "name": "description", "in": "query", "description": "项目描述", "required": false, "schema": { "type": "string" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } }, "delete": { "tags": [ "项目相关操作" ], "summary": "delete", "description": "通过ID删除项目", "operationId": "deleteProject", "parameters": [ { "name": "code", "in": "path", "description": "项目Code", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/projects": { "get": { "tags": [ "项目相关操作" ], "summary": "queryProjectListPaging", "description": "分页查询项目列表", "operationId": "queryProjectListPaging", "parameters": [ { "name": "searchVal", "in": "query", "description": "搜索值", "required": false, "schema": { "type": "string" } }, { "name": "pageSize", "in": "query", "description": "页大小", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "pageNo", "in": "query", "description": "页码号", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } }, "post": { "tags": [ "项目相关操作" ], "summary": "create", "description": "创建项目", "operationId": "createProject", "parameters": [ { "name": "projectName", "in": "query", "description": "项目名称", "required": true, "schema": { "type": "string" } }, { "name": "description", "in": "query", "description": "项目描述", "required": false, "schema": { "type": "string" } } ], "responses": { "201": { "description": "Created", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/projects/unauth-project": { "get": { "tags": [ "项目相关操作" ], "summary": "queryUnauthorizedProject", "description": "查询未授权的项目", "operationId": "queryUnauthorizedProject", "parameters": [ { "name": "userId", "in": "query", "description": "用户ID", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/projects/project-with-authorized-level": { "get": { "tags": [ "项目相关操作" ], "summary": "queryProjectWithAuthorizedLevel", "description": "QUERY_PROJECT_AUTHORIZED_LEVEL", "operationId": "queryProjectWithAuthorizedLevel", "parameters": [ { "name": "userId", "in": "query", "description": "用户ID", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/projects/project-with-authorized-level-list-paging": { "get": { "tags": [ "项目相关操作" ], "summary": "queryProjectWithAuthorizedLevelListPaging", "description": "QUERY_PROJECT_WITH_AUTH_LEVEL_LIST_PAGING_NOTES", "operationId": "queryProjectWithAuthorizedLevelListPaging", "parameters": [ { "name": "userId", "in": "query", "description": "用户ID", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "searchVal", "in": "query", "description": "搜索值", "required": false, "schema": { "type": "string" } }, { "name": "pageSize", "in": "query", "description": "页大小", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "pageNo", "in": "query", "description": "页码号", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/projects/list": { "get": { "tags": [ "项目相关操作" ], "summary": "queryAllProjectList", "description": "查询所有项目", "operationId": "queryAllProjectList", "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/projects/list-dependent": { "get": { "tags": [ "项目相关操作" ], "summary": "queryAllProjectListForDependent", "description": "查询Dependent节点所有项目", "operationId": "queryAllProjectListForDependent", "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/projects/created-and-authed": { "get": { "tags": [ "项目相关操作" ], "summary": "queryProjectCreatedAndAuthorizedByUser", "description": "查询授权和用户创建的项目", "operationId": "queryProjectCreatedAndAuthorizedByUser", "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/projects/authed-user": { "get": { "tags": [ "项目相关操作" ], "summary": "queryAuthorizedUser", "description": "查询拥有项目授权的用户", "operationId": "queryAuthorizedUser", "parameters": [ { "name": "projectCode", "in": "query", "description": "项目Code", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/projects/authed-project": { "get": { "tags": [ "项目相关操作" ], "summary": "queryAuthorizedProject", "description": "查询授权项目", "operationId": "queryAuthorizedProject", "parameters": [ { "name": "userId", "in": "query", "description": "用户ID", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } } } } ``` -------------------------------------------------------------------------------- /src/dolphinscheduler_mcp/tools_generated/datasource_tools.py: -------------------------------------------------------------------------------- ```python """Tools for data source operations in DolphinScheduler.""" from typing import Dict, List, Optional from ..fastmcp_compat import FastMCPTool from ..client import DolphinSchedulerClient class GetDatasources(FastMCPTool): """Tool to 查询数据源通过id""" name = "get_datasources" description = "查询数据源通过ID" is_async = True schema = { "type": "object", "properties": { "id": { "type": "integer", "format": "int32", "description": "\u6570\u636e\u6e90ID" } }, "required": [ "id" ] } async def _run(self, id) -> Dict: """Execute the GET operation on /datasources/{id}.""" client = DolphinSchedulerClient() try: response = await client.request( "GET", f"/datasources/{id}" ) return {"success": True, "data": response} finally: await client.close() class UpdateDatasources(FastMCPTool): """Tool to 更新数据源""" name = "update_datasources" description = "更新数据源" is_async = True schema = { "type": "object", "properties": { "id": { "type": "integer", "format": "int32", "description": "\u6570\u636e\u6e90ID" }, "data_source_param": { "type": "object", "description": "\u6570\u636e\u6e90\u53c2\u6570" } }, "required": [ "id", "data_source_param" ] } async def _run(self, id, data_source_param) -> Dict: """Execute the PUT operation on /datasources/{id}.""" client = DolphinSchedulerClient() try: response = await client.request( "PUT", f"/datasources/{id}" ) return {"success": True, "data": response} finally: await client.close() class DeleteDatasources(FastMCPTool): """Tool to 删除数据源""" name = "delete_datasources" description = "删除数据源" is_async = True schema = { "type": "object", "properties": { "id": { "type": "integer", "format": "int32", "description": "\u6570\u636e\u6e90ID" } }, "required": [ "id" ] } async def _run(self, id) -> Dict: """Execute the DELETE operation on /datasources/{id}.""" client = DolphinSchedulerClient() try: response = await client.request( "DELETE", f"/datasources/{id}" ) return {"success": True, "data": response} finally: await client.close() class GetDatasources2(FastMCPTool): """Tool to 分页查询数据源列表""" name = "get_datasources2" description = "分页查询数据源列表" is_async = True schema = { "type": "object", "properties": { "search_val": { "type": "string", "description": "\u641c\u7d22\u503c" }, "page_no": { "type": "integer", "format": "int32", "description": "\u9875\u7801\u53f7" }, "page_size": { "type": "integer", "format": "int32", "description": "\u9875\u5927\u5c0f" } }, "required": [ "page_no", "page_size" ] } async def _run(self, search_val, page_no, page_size) -> Dict: """Execute the GET operation on /datasources.""" client = DolphinSchedulerClient() try: params = { "searchVal": search_val, "pageNo": page_no, "pageSize": page_size, } response = await client.request( "GET", f"/datasources", params=params ) return {"success": True, "data": response} finally: await client.close() class CreateDatasources(FastMCPTool): """Tool to 创建数据源""" name = "create_datasources" description = "创建数据源" is_async = True async def _run(self) -> Dict: """Execute the POST operation on /datasources.""" client = DolphinSchedulerClient() try: response = await client.request( "POST", f"/datasources" ) return {"success": True, "data": response} finally: await client.close() class CreateDatasourcesConnect(FastMCPTool): """Tool to 连接数据源""" name = "create_datasources_connect" description = "连接数据源" is_async = True async def _run(self) -> Dict: """Execute the POST operation on /datasources/connect.""" client = DolphinSchedulerClient() try: response = await client.request( "POST", f"/datasources/connect" ) return {"success": True, "data": response} finally: await client.close() class GetDatasourcesConnectTest(FastMCPTool): """Tool to 连接数据源测试""" name = "get_datasources_connect_test" description = "连接数据源测试" is_async = True schema = { "type": "object", "properties": { "id": { "type": "integer", "format": "int32", "description": "\u6570\u636e\u6e90ID" } }, "required": [ "id" ] } async def _run(self, id) -> Dict: """Execute the GET operation on /datasources/{id}/connect-test.""" client = DolphinSchedulerClient() try: response = await client.request( "GET", f"/datasources/{id}/connect-test" ) return {"success": True, "data": response} finally: await client.close() class GetDatasourcesVerifyName(FastMCPTool): """Tool to 验证数据源""" name = "get_datasources_verify_name" description = "验证数据源" is_async = True schema = { "type": "object", "properties": { "name": { "type": "string", "description": "\u6570\u636e\u6e90\u540d\u79f0" } }, "required": [ "name" ] } async def _run(self, name) -> Dict: """Execute the GET operation on /datasources/verify-name.""" client = DolphinSchedulerClient() try: params = { "name": name, } response = await client.request( "GET", f"/datasources/verify-name", params=params ) return {"success": True, "data": response} finally: await client.close() class GetDatasourcesUnauthDatasource(FastMCPTool): """Tool to 未授权的数据源""" name = "get_datasources_unauth_datasource" description = "未授权的数据源" is_async = True schema = { "type": "object", "properties": { "user_id": { "type": "integer", "format": "int32", "description": "\u7528\u6237ID" } }, "required": [ "user_id" ] } async def _run(self, user_id) -> Dict: """Execute the GET operation on /datasources/unauth-datasource.""" client = DolphinSchedulerClient() try: params = { "userId": user_id, } response = await client.request( "GET", f"/datasources/unauth-datasource", params=params ) return {"success": True, "data": response} finally: await client.close() class ListDatasourcesTables(FastMCPTool): """Tool to 获取数据源表列表""" name = "list_datasources_tables" description = "获取数据源表列表" is_async = True schema = { "type": "object", "properties": { "datasource_id": { "type": "integer", "format": "int32", "description": "\u6570\u636e\u6e90ID" }, "database": { "type": "string", "description": "DATABASE" } }, "required": [ "datasource_id", "database" ] } async def _run(self, datasource_id, database) -> Dict: """Execute the GET operation on /datasources/tables.""" client = DolphinSchedulerClient() try: params = { "datasourceId": datasource_id, "database": database, } response = await client.request( "GET", f"/datasources/tables", params=params ) return {"success": True, "data": response} finally: await client.close() class ListDatasourcesTablecolumns(FastMCPTool): """Tool to 获取数据源表列名""" name = "list_datasources_tablecolumns" description = "获取数据源表列名" is_async = True schema = { "type": "object", "properties": { "datasource_id": { "type": "integer", "format": "int32", "description": "\u6570\u636e\u6e90ID" }, "table_name": { "type": "string", "description": "\u8868\u540d" }, "database": { "type": "string", "description": "DATABASE" } }, "required": [ "datasource_id", "table_name", "database" ] } async def _run(self, datasource_id, table_name, database) -> Dict: """Execute the GET operation on /datasources/tableColumns.""" client = DolphinSchedulerClient() try: params = { "datasourceId": datasource_id, "tableName": table_name, "database": database, } response = await client.request( "GET", f"/datasources/tableColumns", params=params ) return {"success": True, "data": response} finally: await client.close() class ListDatasourcesList(FastMCPTool): """Tool to 通过数据源类型查询数据源列表""" name = "list_datasources_list" description = "通过数据源类型查询数据源列表" is_async = True schema = { "type": "object", "properties": { "type": { "type": "string", "enum": [ "MYSQL", "POSTGRESQL", "HIVE", "SPARK", "CLICKHOUSE", "ORACLE", "SQLSERVER", "DB2", "PRESTO", "H2", "REDSHIFT", "ATHENA", "TRINO", "STARROCKS", "AZURESQL", "DAMENG", "OCEANBASE", "SSH", "KYUUBI", "DATABEND", "SNOWFLAKE", "VERTICA", "HANA", "DORIS", "ZEPPELIN", "SAGEMAKER" ], "description": "\u6570\u636e\u6e90\u7c7b\u578b" } }, "required": [ "type" ] } async def _run(self, type) -> Dict: """Execute the GET operation on /datasources/list.""" client = DolphinSchedulerClient() try: params = { "type": type, } response = await client.request( "GET", f"/datasources/list", params=params ) return {"success": True, "data": response} finally: await client.close() class GetDatasourcesKerberosStartupState(FastMCPTool): """Tool to 获取用户信息""" name = "get_datasources_kerberos_startup_state" description = "获取用户信息" is_async = True async def _run(self) -> Dict: """Execute the GET operation on /datasources/kerberos-startup-state.""" client = DolphinSchedulerClient() try: response = await client.request( "GET", f"/datasources/kerberos-startup-state" ) return {"success": True, "data": response} finally: await client.close() class ListDatasourcesDatabases(FastMCPTool): """Tool to get_datasource_database_notes""" name = "list_datasources_databases" description = "GET_DATASOURCE_DATABASE_NOTES" is_async = True schema = { "type": "object", "properties": { "datasource_id": { "type": "integer", "format": "int32", "description": "\u6570\u636e\u6e90ID" } }, "required": [ "datasource_id" ] } async def _run(self, datasource_id) -> Dict: """Execute the GET operation on /datasources/databases.""" client = DolphinSchedulerClient() try: params = { "datasourceId": datasource_id, } response = await client.request( "GET", f"/datasources/databases", params=params ) return {"success": True, "data": response} finally: await client.close() class GetDatasourcesAuthedDatasource(FastMCPTool): """Tool to 授权的数据源""" name = "get_datasources_authed_datasource" description = "授权的数据源" is_async = True schema = { "type": "object", "properties": { "user_id": { "type": "integer", "format": "int32", "description": "\u7528\u6237ID" } }, "required": [ "user_id" ] } async def _run(self, user_id) -> Dict: """Execute the GET operation on /datasources/authed-datasource.""" client = DolphinSchedulerClient() try: params = { "userId": user_id, } response = await client.request( "GET", f"/datasources/authed-datasource", params=params ) return {"success": True, "data": response} finally: await client.close() def register_datasource_tools(mcp): """Register datasource tools with FastMCP. Args: mcp: The FastMCP instance to register tools with. """ from ..fastmcp_compat import register_tool_class register_tool_class(mcp, CreateDatasources) register_tool_class(mcp, CreateDatasourcesConnect) register_tool_class(mcp, DeleteDatasources) register_tool_class(mcp, GetDatasources) register_tool_class(mcp, GetDatasources2) register_tool_class(mcp, GetDatasourcesAuthedDatasource) register_tool_class(mcp, GetDatasourcesConnectTest) register_tool_class(mcp, GetDatasourcesKerberosStartupState) register_tool_class(mcp, GetDatasourcesUnauthDatasource) register_tool_class(mcp, GetDatasourcesVerifyName) register_tool_class(mcp, ListDatasourcesDatabases) register_tool_class(mcp, ListDatasourcesList) register_tool_class(mcp, ListDatasourcesTablecolumns) register_tool_class(mcp, ListDatasourcesTables) register_tool_class(mcp, UpdateDatasources) ``` -------------------------------------------------------------------------------- /mcp-openapi-split/paths/11_task_group_api.json: -------------------------------------------------------------------------------- ```json { "paths": { "/task-group/update": { "post": { "tags": [ "任务组相关操作" ], "summary": "update", "description": "更新任务组", "operationId": "updateTaskGroup", "parameters": [ { "name": "id", "in": "query", "description": "任务组ID", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "name", "in": "query", "description": "任务组名称", "required": true, "schema": { "type": "string" } }, { "name": "description", "in": "query", "description": "任务组描述", "required": true, "schema": { "type": "string" } }, { "name": "groupSize", "in": "query", "description": "任务组大小", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "201": { "description": "Created", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/task-group/start-task-group": { "post": { "tags": [ "任务组相关操作" ], "summary": "startTaskGroup", "description": "启动任务组", "operationId": "startTaskGroup", "parameters": [ { "name": "id", "in": "query", "description": "任务组ID", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "201": { "description": "Created", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/task-group/modifyPriority": { "post": { "tags": [ "任务组相关操作" ], "summary": "modifyPriority", "description": "修改任务组优先级", "operationId": "modifyPriority", "parameters": [ { "name": "queueId", "in": "query", "description": "任务组队列ID", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "priority", "in": "query", "description": "任务队列优先级", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "201": { "description": "Created", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/task-group/forceStart": { "post": { "tags": [ "任务组相关操作" ], "summary": "forceStart", "description": "强制启动任务组", "operationId": "forceStart", "parameters": [ { "name": "queueId", "in": "query", "description": "任务组队列ID", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "201": { "description": "Created", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/task-group/create": { "post": { "tags": [ "任务组相关操作" ], "summary": "create", "description": "创建任务组", "operationId": "createTaskGroup", "parameters": [ { "name": "name", "in": "query", "description": "NAME", "required": true, "schema": { "type": "string" } }, { "name": "projectCode", "in": "query", "description": "项目Code", "required": false, "schema": { "type": "integer", "format": "int64" } }, { "name": "description", "in": "query", "description": "任务组描述", "required": true, "schema": { "type": "string" } }, { "name": "groupSize", "in": "query", "description": "任务组大小", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "201": { "description": "Created", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/task-group/close-task-group": { "post": { "tags": [ "任务组相关操作" ], "summary": "closeTaskGroup", "description": "关闭任务组", "operationId": "closeTaskGroup", "parameters": [ { "name": "id", "in": "query", "description": "ID", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "201": { "description": "Created", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/task-group/query-list-by-status": { "get": { "tags": [ "任务组相关操作" ], "summary": "queryTaskGroupByStatus", "description": "通过状态查询任务组", "operationId": "queryTaskGroupByStatus", "parameters": [ { "name": "pageNo", "in": "query", "description": "页码号", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "status", "in": "query", "description": "任务组状态", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "pageSize", "in": "query", "description": "页大小", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/task-group/query-list-by-projectCode": { "get": { "tags": [ "任务组相关操作" ], "summary": "queryTaskGroupByName", "description": "通过项目ID查询工作组列表", "operationId": "queryTaskGroupByCode", "parameters": [ { "name": "pageNo", "in": "query", "description": "页码号", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "projectCode", "in": "query", "description": "项目Code", "required": true, "schema": { "type": "string" } }, { "name": "pageSize", "in": "query", "description": "页大小", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/task-group/query-list-by-group-id": { "get": { "tags": [ "任务组相关操作" ], "summary": "queryTaskGroupQueuesByGroupId", "description": "QUERY_TASKS_GROUP_GROUP_QUEUES", "operationId": "queryTaskGroupQueues", "parameters": [ { "name": "groupId", "in": "query", "description": "GROUP_ID", "required": false, "schema": { "type": "integer", "format": "int32" } }, { "name": "taskInstanceName", "in": "query", "description": "任务实例名称", "required": false, "schema": { "type": "string" } }, { "name": "processInstanceName", "in": "query", "description": "流程实例名称", "required": false, "schema": { "type": "string" } }, { "name": "status", "in": "query", "description": "任务组状态", "required": false, "schema": { "type": "integer", "format": "int32" } }, { "name": "pageNo", "in": "query", "description": "页码号", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "pageSize", "in": "query", "description": "页大小", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } }, "/task-group/list-paging": { "get": { "tags": [ "任务组相关操作" ], "summary": "list-paging", "description": "查询所有任务组", "operationId": "queryAllTaskGroup", "parameters": [ { "name": "name", "in": "query", "description": "任务组名称", "required": false, "schema": { "type": "string" } }, { "name": "status", "in": "query", "required": false, "schema": { "type": "integer", "format": "int32" } }, { "name": "pageNo", "in": "query", "description": "页码号", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "pageSize", "in": "query", "description": "页大小", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/Result" } } } } } } } } } ``` -------------------------------------------------------------------------------- /mcp-openapi-split/paths/19_datasource_api.json: -------------------------------------------------------------------------------- ```json { "paths": { "/datasources/{id}": { "get": { "tags": [ "数据源相关操作" ], "summary": "queryDataSource", "description": "查询数据源通过ID", "operationId": "queryDataSource", "parameters": [ { "name": "id", "in": "path", "description": "数据源ID", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultObject" } } } } } }, "put": { "tags": [ "数据源相关操作" ], "summary": "updateDataSource", "description": "更新数据源", "operationId": "updateDataSource", "parameters": [ { "name": "id", "in": "path", "description": "数据源ID", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "dataSourceParam", "description": "数据源参数", "required": true, "schema": { "$ref": "#/components/schemas/BaseDataSourceParamDTO" } } ], "requestBody": { "content": { "application/json": { "schema": { "type": "string" } } }, "required": true }, "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultDataSource" } } } } } }, "delete": { "tags": [ "数据源相关操作" ], "summary": "deleteDataSource", "description": "删除数据源", "operationId": "deleteDataSource", "parameters": [ { "name": "id", "in": "path", "description": "数据源ID", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultBoolean" } } } } } } }, "/datasources": { "get": { "tags": [ "数据源相关操作" ], "summary": "queryDataSourceListPaging", "description": "分页查询数据源列表", "operationId": "queryDataSourceListPaging", "parameters": [ { "name": "searchVal", "in": "query", "description": "搜索值", "required": false, "schema": { "type": "string" } }, { "name": "pageNo", "in": "query", "description": "页码号", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "pageSize", "in": "query", "description": "页大小", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultObject" } } } } } }, "post": { "tags": [ "数据源相关操作" ], "summary": "createDataSource", "description": "创建数据源", "operationId": "createDataSource", "requestBody": { "content": { "application/json": { "schema": { "type": "string", "description": "数据源参数" } } }, "required": true }, "responses": { "201": { "description": "Created", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultDataSource" } } } } } } }, "/datasources/connect": { "post": { "tags": [ "数据源相关操作" ], "summary": "connectDataSource", "description": "连接数据源", "operationId": "connectDataSource", "requestBody": { "description": "dataSourceParam", "content": { "application/json": { "schema": { "type": "string" } } }, "required": true }, "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultBoolean" } } } } } } }, "/datasources/{id}/connect-test": { "get": { "tags": [ "数据源相关操作" ], "summary": "connectionTest", "description": "连接数据源测试", "operationId": "connectionTest", "parameters": [ { "name": "id", "in": "path", "description": "数据源ID", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultBoolean" } } } } } } }, "/datasources/verify-name": { "get": { "tags": [ "数据源相关操作" ], "summary": "verifyDataSourceName", "description": "验证数据源", "operationId": "verifyDataSourceName", "parameters": [ { "name": "name", "in": "query", "description": "数据源名称", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultBoolean" } } } } } } }, "/datasources/unauth-datasource": { "get": { "tags": [ "数据源相关操作" ], "summary": "unauthorizedDatasource", "description": "未授权的数据源", "operationId": "unAuthDatasource", "parameters": [ { "name": "userId", "in": "query", "description": "用户ID", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultObject" } } } } } } }, "/datasources/tables": { "get": { "tags": [ "数据源相关操作" ], "summary": "tables", "description": "获取数据源表列表", "operationId": "getTables", "parameters": [ { "name": "datasourceId", "in": "query", "description": "数据源ID", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "database", "in": "query", "description": "DATABASE", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultObject" } } } } } } }, "/datasources/tableColumns": { "get": { "tags": [ "数据源相关操作" ], "summary": "tableColumns", "description": "获取数据源表列名", "operationId": "getTableColumns", "parameters": [ { "name": "datasourceId", "in": "query", "description": "数据源ID", "required": true, "schema": { "type": "integer", "format": "int32" } }, { "name": "tableName", "in": "query", "description": "表名", "required": true, "schema": { "type": "string" } }, { "name": "database", "in": "query", "description": "DATABASE", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultObject" } } } } } } }, "/datasources/list": { "get": { "tags": [ "数据源相关操作" ], "summary": "queryDataSourceList", "description": "通过数据源类型查询数据源列表", "operationId": "queryDataSourceList", "parameters": [ { "name": "type", "in": "query", "description": "数据源类型", "required": true, "schema": { "type": "string", "enum": [ "MYSQL", "POSTGRESQL", "HIVE", "SPARK", "CLICKHOUSE", "ORACLE", "SQLSERVER", "DB2", "PRESTO", "H2", "REDSHIFT", "ATHENA", "TRINO", "STARROCKS", "AZURESQL", "DAMENG", "OCEANBASE", "SSH", "KYUUBI", "DATABEND", "SNOWFLAKE", "VERTICA", "HANA", "DORIS", "ZEPPELIN", "SAGEMAKER" ] } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultObject" } } } } } } }, "/datasources/kerberos-startup-state": { "get": { "tags": [ "数据源相关操作" ], "summary": "getKerberosStartupState", "description": "获取用户信息", "operationId": "getKerberosStartupState", "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultObject" } } } } } } }, "/datasources/databases": { "get": { "tags": [ "数据源相关操作" ], "summary": "databases", "description": "GET_DATASOURCE_DATABASE_NOTES", "operationId": "getDatabases", "parameters": [ { "name": "datasourceId", "in": "query", "description": "数据源ID", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultObject" } } } } } } }, "/datasources/authed-datasource": { "get": { "tags": [ "数据源相关操作" ], "summary": "authedDatasource", "description": "授权的数据源", "operationId": "authedDatasource", "parameters": [ { "name": "userId", "in": "query", "description": "用户ID", "required": true, "schema": { "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/ResultObject" } } } } } } } } } ``` -------------------------------------------------------------------------------- /src/dolphinscheduler_mcp/tools_generated/process_task_relation_tools.py: -------------------------------------------------------------------------------- ```python """Process Task Relation related operations for DolphinScheduler MCP. This module provides tools for managing workflow task relationships in DolphinScheduler. """ from typing import Dict, List, Optional, Any import logging from ..fastmcp_compat import FastMCPTool from ..client import DolphinSchedulerClient # Set up logger logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) logger.info("Loading process_task_relation tools module") class CreateProcessTaskRelation(FastMCPTool): """创建工作流任务关系""" name = "create-process-task-relation" description = "创建工作流任务关系" is_async = True schema = { "type": "object", "properties": { "projectCode": { "type": "integer", "format": "int64", "description": "项目Code" }, "processDefinitionCode": { "type": "integer", "format": "int64", "description": "流程定义编码" }, "preTaskCode": { "type": "integer", "format": "int64", "description": "上游任务编码" }, "postTaskCode": { "type": "integer", "format": "int64", "description": "下游任务编码" } }, "required": [ "projectCode", "processDefinitionCode", "preTaskCode", "postTaskCode" ] } async def _run(self, projectCode, processDefinitionCode, preTaskCode, postTaskCode) -> Dict: """执行创建工作流任务关系API请求 Args: projectCode: 项目Code processDefinitionCode: 流程定义编码 preTaskCode: 上游任务编码 postTaskCode: 下游任务编码 Returns: API响应 """ client = DolphinSchedulerClient() try: # 确保路径参数正确处理 projectCode = int(projectCode) if projectCode is not None else None if projectCode is None: return { "success": False, "error": "Missing required parameter: projectCode" } # 确保query参数正确处理 processDefinitionCode = int(processDefinitionCode) if processDefinitionCode is not None else None preTaskCode = int(preTaskCode) if preTaskCode is not None else None postTaskCode = int(postTaskCode) if postTaskCode is not None else None if processDefinitionCode is None: return { "success": False, "error": "Missing required parameter: processDefinitionCode" } if preTaskCode is None: return { "success": False, "error": "Missing required parameter: preTaskCode" } if postTaskCode is None: return { "success": False, "error": "Missing required parameter: postTaskCode" } # 构建请求参数 (query parameters) params = { "processDefinitionCode": processDefinitionCode, "preTaskCode": preTaskCode, "postTaskCode": postTaskCode } response = await client.request( "POST", f"/projects/{projectCode}/process-task-relation", params=params # 这些是query参数 ) return {"success": True, "data": response} except ValueError: return { "success": False, "error": "Invalid parameter format" } except Exception as e: return { "success": False, "error": str(e) } finally: await client.close() class QueryUpstreamRelation(FastMCPTool): """查询上游工作流任务关系""" name = "query-upstream-relation" description = "查询上游工作流任务关系" is_async = True schema = { "type": "object", "properties": { "projectCode": { "type": "integer", "format": "int64", "description": "项目Code" }, "taskCode": { "type": "integer", "format": "int64", "description": "任务编码" } }, "required": [ "projectCode", "taskCode" ] } async def _run(self, projectCode, taskCode) -> Dict: """执行查询上游工作流任务关系API请求 Args: projectCode: 项目Code taskCode: 任务编码 Returns: API响应 """ client = DolphinSchedulerClient() try: # 确保path参数正确处理 projectCode = int(projectCode) if projectCode is not None else None taskCode = int(taskCode) if taskCode is not None else None if projectCode is None: return { "success": False, "error": "Missing required parameter: projectCode" } if taskCode is None: return { "success": False, "error": "Missing required parameter: taskCode" } # 所有参数都在URL路径中,不需要额外的query参数 response = await client.request( "GET", f"/projects/{projectCode}/process-task-relation/{taskCode}/upstream" ) return {"success": True, "data": response} except ValueError: return { "success": False, "error": "Invalid parameter format" } except Exception as e: return { "success": False, "error": str(e) } finally: await client.close() class DeleteUpstreamRelation(FastMCPTool): """删除上游工作流任务关系""" name = "delete-upstream-relation" description = "删除上游工作流任务关系" is_async = True schema = { "type": "object", "properties": { "projectCode": { "type": "integer", "format": "int64", "description": "项目Code" }, "taskCode": { "type": "integer", "format": "int64", "description": "任务编码" }, "preTaskCodes": { "type": "string", "description": "上游任务编码列表,多个用逗号分隔" } }, "required": [ "projectCode", "taskCode", "preTaskCodes" ] } async def _run(self, projectCode, taskCode, preTaskCodes) -> Dict: """执行删除上游工作流任务关系API请求 Args: projectCode: 项目Code taskCode: 任务编码 preTaskCodes: 上游任务编码列表,多个用逗号分隔 Returns: API响应 """ client = DolphinSchedulerClient() try: # 确保path参数正确处理 projectCode = int(projectCode) if projectCode is not None else None taskCode = int(taskCode) if taskCode is not None else None if projectCode is None: return { "success": False, "error": "Missing required parameter: projectCode" } if taskCode is None: return { "success": False, "error": "Missing required parameter: taskCode" } # 确保query参数正确处理 if preTaskCodes is None: return { "success": False, "error": "Missing required parameter: preTaskCodes" } # 构建请求参数 (query parameters) params = { "preTaskCodes": preTaskCodes } response = await client.request( "DELETE", f"/projects/{projectCode}/process-task-relation/{taskCode}/upstream", params=params # 这些是query参数 ) return {"success": True, "data": response} except ValueError: return { "success": False, "error": "Invalid parameter format" } except Exception as e: return { "success": False, "error": str(e) } finally: await client.close() class QueryDownstreamRelation(FastMCPTool): """查询下游工作流任务关系""" name = "query-downstream-relation" description = "查询下游工作流任务关系" is_async = True schema = { "type": "object", "properties": { "projectCode": { "type": "integer", "format": "int64", "description": "项目Code" }, "taskCode": { "type": "integer", "format": "int64", "description": "任务编码" } }, "required": [ "projectCode", "taskCode" ] } async def _run(self, projectCode, taskCode) -> Dict: """执行查询下游工作流任务关系API请求 Args: projectCode: 项目Code taskCode: 任务编码 Returns: API响应 """ client = DolphinSchedulerClient() try: # 确保path参数正确处理 projectCode = int(projectCode) if projectCode is not None else None taskCode = int(taskCode) if taskCode is not None else None if projectCode is None: return { "success": False, "error": "Missing required parameter: projectCode" } if taskCode is None: return { "success": False, "error": "Missing required parameter: taskCode" } # 所有参数都在URL路径中,不需要额外的query参数 response = await client.request( "GET", f"/projects/{projectCode}/process-task-relation/{taskCode}/downstream" ) return {"success": True, "data": response} except ValueError: return { "success": False, "error": "Invalid parameter format" } except Exception as e: return { "success": False, "error": str(e) } finally: await client.close() class DeleteDownstreamRelation(FastMCPTool): """删除下游工作流任务关系""" name = "delete-downstream-relation" description = "删除下游工作流任务关系" is_async = True schema = { "type": "object", "properties": { "projectCode": { "type": "integer", "format": "int64", "description": "项目Code" }, "taskCode": { "type": "integer", "format": "int64", "description": "任务编码" }, "postTaskCodes": { "type": "string", "description": "下游任务编码列表,多个用逗号分隔" } }, "required": [ "projectCode", "taskCode", "postTaskCodes" ] } async def _run(self, projectCode, taskCode, postTaskCodes) -> Dict: """执行删除下游工作流任务关系API请求 Args: projectCode: 项目Code taskCode: 任务编码 postTaskCodes: 下游任务编码列表,多个用逗号分隔 Returns: API响应 """ client = DolphinSchedulerClient() try: # 确保path参数正确处理 projectCode = int(projectCode) if projectCode is not None else None taskCode = int(taskCode) if taskCode is not None else None if projectCode is None: return { "success": False, "error": "Missing required parameter: projectCode" } if taskCode is None: return { "success": False, "error": "Missing required parameter: taskCode" } # 确保query参数正确处理 if postTaskCodes is None: return { "success": False, "error": "Missing required parameter: postTaskCodes" } # 构建请求参数 (query parameters) params = { "postTaskCodes": postTaskCodes } response = await client.request( "DELETE", f"/projects/{projectCode}/process-task-relation/{taskCode}/downstream", params=params # 这些是query参数 ) return {"success": True, "data": response} except ValueError: return { "success": False, "error": "Invalid parameter format" } except Exception as e: return { "success": False, "error": str(e) } finally: await client.close() class DeleteTaskProcessRelation(FastMCPTool): """删除工作流任务关系""" name = "delete-task-process-relation" description = "删除工作流任务关系" is_async = True schema = { "type": "object", "properties": { "projectCode": { "type": "integer", "format": "int64", "description": "项目Code" }, "taskCode": { "type": "integer", "format": "int64", "description": "任务编码" }, "processDefinitionCode": { "type": "integer", "format": "int64", "description": "流程定义编码" } }, "required": [ "projectCode", "taskCode", "processDefinitionCode" ] } async def _run(self, projectCode, taskCode, processDefinitionCode) -> Dict: """执行删除工作流任务关系API请求 Args: projectCode: 项目Code taskCode: 任务编码 processDefinitionCode: 流程定义编码 Returns: API响应 """ client = DolphinSchedulerClient() try: # 确保path参数正确处理 projectCode = int(projectCode) if projectCode is not None else None taskCode = int(taskCode) if taskCode is not None else None if projectCode is None: return { "success": False, "error": "Missing required parameter: projectCode" } if taskCode is None: return { "success": False, "error": "Missing required parameter: taskCode" } # 确保query参数正确处理 processDefinitionCode = int(processDefinitionCode) if processDefinitionCode is not None else None if processDefinitionCode is None: return { "success": False, "error": "Missing required parameter: processDefinitionCode" } # 构建请求参数 (query parameters) params = { "processDefinitionCode": processDefinitionCode } response = await client.request( "DELETE", f"/projects/{projectCode}/process-task-relation/{taskCode}", params=params # 这些是query参数 ) return {"success": True, "data": response} except ValueError: return { "success": False, "error": "Invalid parameter format" } except Exception as e: return { "success": False, "error": str(e) } finally: await client.close() class DeleteEdge(FastMCPTool): """删除工作流任务连接线""" name = "delete-edge" description = "删除工作流任务连接线" is_async = True schema = { "type": "object", "properties": { "projectCode": { "type": "integer", "format": "int64", "description": "项目Code" }, "processDefinitionCode": { "type": "integer", "format": "int64", "description": "流程定义编码" }, "preTaskCode": { "type": "integer", "format": "int64", "description": "上游任务编码" }, "postTaskCode": { "type": "integer", "format": "int64", "description": "下游任务编码" } }, "required": [ "projectCode", "processDefinitionCode", "preTaskCode", "postTaskCode" ] } async def _run(self, projectCode, processDefinitionCode, preTaskCode, postTaskCode) -> Dict: """执行删除工作流任务连接线API请求 Args: projectCode: 项目Code processDefinitionCode: 流程定义编码 preTaskCode: 上游任务编码 postTaskCode: 下游任务编码 Returns: API响应 """ client = DolphinSchedulerClient() try: # 确保path参数正确处理 projectCode = int(projectCode) if projectCode is not None else None processDefinitionCode = int(processDefinitionCode) if processDefinitionCode is not None else None preTaskCode = int(preTaskCode) if preTaskCode is not None else None postTaskCode = int(postTaskCode) if postTaskCode is not None else None if projectCode is None: return { "success": False, "error": "Missing required parameter: projectCode" } if processDefinitionCode is None: return { "success": False, "error": "Missing required parameter: processDefinitionCode" } if preTaskCode is None: return { "success": False, "error": "Missing required parameter: preTaskCode" } if postTaskCode is None: return { "success": False, "error": "Missing required parameter: postTaskCode" } # 所有参数都在URL路径中,不需要额外的query参数 response = await client.request( "DELETE", f"/projects/{projectCode}/process-task-relation/{processDefinitionCode}/{preTaskCode}/{postTaskCode}" ) return {"success": True, "data": response} except ValueError: return { "success": False, "error": "Invalid parameter format" } except Exception as e: return { "success": False, "error": str(e) } finally: await client.close() def register_process_task_relation_tools(mcp): """Register process_task_relation tools with FastMCP. Args: mcp: The FastMCP instance to register tools with. """ from ..fastmcp_compat import register_tool_class logger.info("Registering process_task_relation tools") register_tool_class(mcp, CreateProcessTaskRelation) register_tool_class(mcp, QueryUpstreamRelation) register_tool_class(mcp, DeleteUpstreamRelation) register_tool_class(mcp, QueryDownstreamRelation) register_tool_class(mcp, DeleteDownstreamRelation) register_tool_class(mcp, DeleteTaskProcessRelation) register_tool_class(mcp, DeleteEdge) logger.info("Successfully registered 7 process_task_relation tools") ```