This is page 2 of 5. Use http://codebase.md/ocean-zhc/dolphinscheduler-mcp?lines=true&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 -------------------------------------------------------------------------------- /mcp-openapi-split/schemas/02_cluster_schemas.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "components": { 3 | "schemas": { 4 | "Cluster": { 5 | "type": "object", 6 | "properties": { 7 | "id": { 8 | "type": "integer", 9 | "format": "int32" 10 | }, 11 | "code": { 12 | "type": "integer", 13 | "format": "int64" 14 | }, 15 | "name": { 16 | "type": "string" 17 | }, 18 | "config": { 19 | "type": "string" 20 | }, 21 | "description": { 22 | "type": "string" 23 | }, 24 | "operator": { 25 | "type": "integer", 26 | "format": "int32" 27 | }, 28 | "createTime": { 29 | "type": "string", 30 | "format": "date-time" 31 | }, 32 | "updateTime": { 33 | "type": "string", 34 | "format": "date-time" 35 | } 36 | } 37 | }, 38 | "ResultCluster": { 39 | "type": "object", 40 | "properties": { 41 | "code": { 42 | "type": "integer", 43 | "format": "int32" 44 | }, 45 | "msg": { 46 | "type": "string" 47 | }, 48 | "data": { 49 | "$ref": "#/components/schemas/Cluster" 50 | }, 51 | "failed": { 52 | "type": "boolean" 53 | }, 54 | "success": { 55 | "type": "boolean" 56 | } 57 | } 58 | }, 59 | "ClusterDto": { 60 | "type": "object", 61 | "properties": { 62 | "id": { 63 | "type": "integer", 64 | "format": "int32" 65 | }, 66 | "code": { 67 | "type": "integer", 68 | "format": "int64" 69 | }, 70 | "name": { 71 | "type": "string" 72 | }, 73 | "config": { 74 | "type": "string" 75 | }, 76 | "description": { 77 | "type": "string" 78 | }, 79 | "processDefinitions": { 80 | "type": "array", 81 | "items": { 82 | "type": "string" 83 | } 84 | }, 85 | "operator": { 86 | "type": "integer", 87 | "format": "int32" 88 | }, 89 | "createTime": { 90 | "type": "string", 91 | "format": "date-time" 92 | }, 93 | "updateTime": { 94 | "type": "string", 95 | "format": "date-time" 96 | } 97 | } 98 | }, 99 | "ResultListClusterDto": { 100 | "type": "object", 101 | "properties": { 102 | "code": { 103 | "type": "integer", 104 | "format": "int32" 105 | }, 106 | "msg": { 107 | "type": "string" 108 | }, 109 | "data": { 110 | "type": "array", 111 | "items": { 112 | "$ref": "#/components/schemas/ClusterDto" 113 | } 114 | }, 115 | "failed": { 116 | "type": "boolean" 117 | }, 118 | "success": { 119 | "type": "boolean" 120 | } 121 | } 122 | }, 123 | "ResultClusterDto": { 124 | "type": "object", 125 | "properties": { 126 | "code": { 127 | "type": "integer", 128 | "format": "int32" 129 | }, 130 | "msg": { 131 | "type": "string" 132 | }, 133 | "data": { 134 | "$ref": "#/components/schemas/ClusterDto" 135 | }, 136 | "failed": { 137 | "type": "boolean" 138 | }, 139 | "success": { 140 | "type": "boolean" 141 | } 142 | } 143 | }, 144 | "PageInfoClusterDto": { 145 | "type": "object", 146 | "properties": { 147 | "totalList": { 148 | "type": "array", 149 | "items": { 150 | "$ref": "#/components/schemas/ClusterDto" 151 | } 152 | }, 153 | "total": { 154 | "type": "integer", 155 | "format": "int32" 156 | }, 157 | "totalPage": { 158 | "type": "integer", 159 | "format": "int32" 160 | }, 161 | "pageSize": { 162 | "type": "integer", 163 | "format": "int32" 164 | }, 165 | "currentPage": { 166 | "type": "integer", 167 | "format": "int32" 168 | }, 169 | "pageNo": { 170 | "type": "integer", 171 | "format": "int32" 172 | } 173 | } 174 | }, 175 | "ResultPageInfoClusterDto": { 176 | "type": "object", 177 | "properties": { 178 | "code": { 179 | "type": "integer", 180 | "format": "int32" 181 | }, 182 | "msg": { 183 | "type": "string" 184 | }, 185 | "data": { 186 | "$ref": "#/components/schemas/PageInfoClusterDto" 187 | }, 188 | "failed": { 189 | "type": "boolean" 190 | }, 191 | "success": { 192 | "type": "boolean" 193 | } 194 | } 195 | } 196 | } 197 | } 198 | } ``` -------------------------------------------------------------------------------- /src/dolphinscheduler_mcp/tools_generated/worker_group_tools.py: -------------------------------------------------------------------------------- ```python 1 | """Tools for worker group operations in DolphinScheduler.""" 2 | 3 | from typing import Dict, List, Optional 4 | 5 | from ..fastmcp_compat import FastMCPTool 6 | 7 | from ..client import DolphinSchedulerClient 8 | 9 | 10 | class GetWorkerGroups(FastMCPTool): 11 | """Tool to worker分组管理""" 12 | 13 | name = "get_worker_groups" 14 | description = "Worker分组管理" 15 | is_async = True 16 | schema = { 17 | "type": "object", 18 | "properties": { 19 | "page_no": { 20 | "type": "integer", 21 | "format": "int32", 22 | "description": "\u9875\u7801\u53f7" 23 | }, 24 | "page_size": { 25 | "type": "integer", 26 | "format": "int32", 27 | "description": "\u9875\u5927\u5c0f" 28 | }, 29 | "search_val": { 30 | "type": "string", 31 | "description": "\u641c\u7d22\u503c" 32 | } 33 | }, 34 | "required": [ 35 | "page_no", 36 | "page_size" 37 | ] 38 | } 39 | 40 | async def _run(self, page_no, page_size, search_val) -> Dict: 41 | """Execute the GET operation on /worker-groups.""" 42 | client = DolphinSchedulerClient() 43 | try: 44 | params = { 45 | "pageNo": page_no, 46 | "pageSize": page_size, 47 | "searchVal": search_val, 48 | } 49 | response = await client.request( 50 | "GET", 51 | f"/worker-groups", params=params 52 | ) 53 | return {"success": True, "data": response} 54 | finally: 55 | await client.close() 56 | 57 | 58 | class CreateWorkerGroups(FastMCPTool): 59 | """Tool to 创建worker分组""" 60 | 61 | name = "create_worker_groups" 62 | description = "创建Worker分组" 63 | is_async = True 64 | schema = { 65 | "type": "object", 66 | "properties": { 67 | "id": { 68 | "type": "integer", 69 | "format": "int32", 70 | "description": "Worker Server\u5206\u7ec4ID" 71 | }, 72 | "name": { 73 | "type": "string", 74 | "description": "Worker\u5206\u7ec4\u540d\u79f0" 75 | }, 76 | "addr_list": { 77 | "type": "string", 78 | "description": "worker\u5730\u5740\u5217\u8868" 79 | }, 80 | "description": { 81 | "type": "string", 82 | "description": "WORKER_DESC" 83 | }, 84 | "other_params_json": { 85 | "type": "string", 86 | "description": "WORKER_PARAMS_JSON" 87 | } 88 | }, 89 | "required": [ 90 | "name", 91 | "addr_list" 92 | ] 93 | } 94 | 95 | async def _run(self, id, name, addr_list, description, other_params_json) -> Dict: 96 | """Execute the POST operation on /worker-groups.""" 97 | client = DolphinSchedulerClient() 98 | try: 99 | params = { 100 | "id": id, 101 | "name": name, 102 | "addrList": addr_list, 103 | "description": description, 104 | "otherParamsJson": other_params_json, 105 | } 106 | response = await client.request( 107 | "POST", 108 | f"/worker-groups", params=params 109 | ) 110 | return {"success": True, "data": response} 111 | finally: 112 | await client.close() 113 | 114 | 115 | class GetWorkerGroupsWorkerAddressList(FastMCPTool): 116 | """Tool to 查询worker地址列表""" 117 | 118 | name = "get_worker_groups_worker_address_list" 119 | description = "查询worker地址列表" 120 | is_async = True 121 | 122 | async def _run(self) -> Dict: 123 | """Execute the GET operation on /worker-groups/worker-address-list.""" 124 | client = DolphinSchedulerClient() 125 | try: 126 | response = await client.request( 127 | "GET", 128 | f"/worker-groups/worker-address-list" 129 | ) 130 | return {"success": True, "data": response} 131 | finally: 132 | await client.close() 133 | 134 | 135 | class GetWorkerGroupsAll(FastMCPTool): 136 | """Tool to 查询worker group分组""" 137 | 138 | name = "get_worker_groups_all" 139 | description = "查询worker group分组" 140 | is_async = True 141 | 142 | async def _run(self) -> Dict: 143 | """Execute the GET operation on /worker-groups/all.""" 144 | client = DolphinSchedulerClient() 145 | try: 146 | response = await client.request( 147 | "GET", 148 | f"/worker-groups/all" 149 | ) 150 | return {"success": True, "data": response} 151 | finally: 152 | await client.close() 153 | 154 | 155 | class DeleteWorkerGroups(FastMCPTool): 156 | """Tool to 通过id删除worker group""" 157 | 158 | name = "delete_worker_groups" 159 | description = "通过ID删除worker group" 160 | is_async = True 161 | schema = { 162 | "type": "object", 163 | "properties": { 164 | "id": { 165 | "type": "integer", 166 | "format": "int32", 167 | "description": "Worker Server\u5206\u7ec4ID" 168 | } 169 | }, 170 | "required": [ 171 | "id" 172 | ] 173 | } 174 | 175 | async def _run(self, id) -> Dict: 176 | """Execute the DELETE operation on /worker-groups/{id}. 177 | 178 | Args: 179 | id: Worker分组ID 180 | 181 | Returns: 182 | API响应 183 | """ 184 | client = DolphinSchedulerClient() 185 | try: 186 | # 确保路径参数正确处理 187 | worker_group_id = int(id) if id is not None else None 188 | if worker_group_id is None: 189 | return { 190 | "success": False, 191 | "error": "Missing required parameter: id" 192 | } 193 | 194 | response = await client.request( 195 | "DELETE", 196 | f"/worker-groups/{worker_group_id}" 197 | ) 198 | return {"success": True, "data": response} 199 | except ValueError: 200 | return { 201 | "success": False, 202 | "error": f"Invalid ID format: {id}" 203 | } 204 | except Exception as e: 205 | return { 206 | "success": False, 207 | "error": str(e) 208 | } 209 | finally: 210 | await client.close() 211 | 212 | 213 | def register_worker_group_tools(mcp): 214 | """Register worker group tool with FastMCP. 215 | 216 | Args: 217 | mcp: The FastMCP instance to register tools with. 218 | """ 219 | from ..fastmcp_compat import register_tool_class 220 | 221 | register_tool_class(mcp, CreateWorkerGroups) 222 | register_tool_class(mcp, DeleteWorkerGroups) 223 | register_tool_class(mcp, GetWorkerGroups) 224 | register_tool_class(mcp, GetWorkerGroupsAll) 225 | register_tool_class(mcp, GetWorkerGroupsWorkerAddressList) 226 | ``` -------------------------------------------------------------------------------- /mcp-openapi-split/paths/21_log_api.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "paths": { 3 | "/log/{projectCode}/download-log": { 4 | "get": { 5 | "tags": [ 6 | "日志相关操作" 7 | ], 8 | "summary": "downloadTaskLogInSpecifiedProject", 9 | "description": "下载指定项目的任务实例日志", 10 | "operationId": "downloadTaskLog", 11 | "parameters": [ 12 | { 13 | "name": "projectCode", 14 | "in": "path", 15 | "description": "项目Code", 16 | "required": true, 17 | "schema": { 18 | "type": "integer", 19 | "format": "int64" 20 | } 21 | }, 22 | { 23 | "name": "taskInstanceId", 24 | "in": "query", 25 | "description": "任务实例ID", 26 | "required": true, 27 | "schema": { 28 | "type": "integer", 29 | "format": "int32" 30 | } 31 | } 32 | ], 33 | "responses": { 34 | "200": { 35 | "description": "OK", 36 | "content": { 37 | "*/*": { 38 | "schema": { 39 | "type": "string" 40 | } 41 | } 42 | } 43 | } 44 | } 45 | } 46 | }, 47 | "/log/{projectCode}/detail": { 48 | "get": { 49 | "tags": [ 50 | "日志相关操作" 51 | ], 52 | "summary": "queryLogInSpecifiedProject", 53 | "description": "查询指定项目的任务实例日志", 54 | "operationId": "queryLog", 55 | "parameters": [ 56 | { 57 | "name": "projectCode", 58 | "in": "path", 59 | "description": "项目Code", 60 | "required": true, 61 | "schema": { 62 | "type": "integer", 63 | "format": "int64" 64 | } 65 | }, 66 | { 67 | "name": "taskInstanceId", 68 | "in": "query", 69 | "description": "任务实例ID", 70 | "required": true, 71 | "schema": { 72 | "type": "integer", 73 | "format": "int32" 74 | } 75 | }, 76 | { 77 | "name": "skipLineNum", 78 | "in": "query", 79 | "description": "忽略行数", 80 | "required": true, 81 | "schema": { 82 | "type": "integer", 83 | "format": "int32" 84 | } 85 | }, 86 | { 87 | "name": "limit", 88 | "in": "query", 89 | "description": "显示多少条", 90 | "required": true, 91 | "schema": { 92 | "type": "integer", 93 | "format": "int32" 94 | } 95 | } 96 | ], 97 | "responses": { 98 | "200": { 99 | "description": "OK", 100 | "content": { 101 | "*/*": { 102 | "schema": { 103 | "$ref": "#/components/schemas/ResultString" 104 | } 105 | } 106 | } 107 | } 108 | } 109 | } 110 | }, 111 | "/log/download-log": { 112 | "get": { 113 | "tags": [ 114 | "日志相关操作" 115 | ], 116 | "summary": "downloadTaskLog", 117 | "description": "下载任务实例日志", 118 | "operationId": "downloadTaskLog_1", 119 | "parameters": [ 120 | { 121 | "name": "taskInstanceId", 122 | "in": "query", 123 | "description": "任务实例ID", 124 | "required": true, 125 | "schema": { 126 | "type": "integer", 127 | "format": "int32" 128 | } 129 | } 130 | ], 131 | "responses": { 132 | "200": { 133 | "description": "OK", 134 | "content": { 135 | "*/*": { 136 | "schema": { 137 | "type": "string" 138 | } 139 | } 140 | } 141 | } 142 | } 143 | } 144 | }, 145 | "/log/detail": { 146 | "get": { 147 | "tags": [ 148 | "日志相关操作" 149 | ], 150 | "summary": "queryLog", 151 | "description": "查询任务实例日志", 152 | "operationId": "queryLog_1", 153 | "parameters": [ 154 | { 155 | "name": "taskInstanceId", 156 | "in": "query", 157 | "description": "任务实例ID", 158 | "required": true, 159 | "schema": { 160 | "type": "integer", 161 | "format": "int32" 162 | } 163 | }, 164 | { 165 | "name": "skipLineNum", 166 | "in": "query", 167 | "description": "忽略行数", 168 | "required": true, 169 | "schema": { 170 | "type": "integer", 171 | "format": "int32" 172 | } 173 | }, 174 | { 175 | "name": "limit", 176 | "in": "query", 177 | "description": "显示多少条", 178 | "required": true, 179 | "schema": { 180 | "type": "integer", 181 | "format": "int32" 182 | } 183 | } 184 | ], 185 | "responses": { 186 | "200": { 187 | "description": "OK", 188 | "content": { 189 | "*/*": { 190 | "schema": { 191 | "$ref": "#/components/schemas/ResultResponseTaskLog" 192 | } 193 | } 194 | } 195 | } 196 | } 197 | } 198 | } 199 | } 200 | } ``` -------------------------------------------------------------------------------- /mcp-openapi-split/paths/06_worker_group_api.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "paths": { 3 | "/worker-groups": { 4 | "get": { 5 | "tags": [ 6 | "Worker分组管理" 7 | ], 8 | "summary": "queryAllWorkerGroupsPaging", 9 | "description": "Worker分组管理", 10 | "operationId": "queryAllWorkerGroupsPaging", 11 | "parameters": [ 12 | { 13 | "name": "pageNo", 14 | "in": "query", 15 | "description": "页码号", 16 | "required": true, 17 | "schema": { 18 | "type": "integer", 19 | "format": "int32" 20 | } 21 | }, 22 | { 23 | "name": "pageSize", 24 | "in": "query", 25 | "description": "页大小", 26 | "required": true, 27 | "schema": { 28 | "type": "integer", 29 | "format": "int32" 30 | } 31 | }, 32 | { 33 | "name": "searchVal", 34 | "in": "query", 35 | "description": "搜索值", 36 | "required": false, 37 | "schema": { 38 | "type": "string" 39 | } 40 | } 41 | ], 42 | "responses": { 43 | "200": { 44 | "description": "OK", 45 | "content": { 46 | "*/*": { 47 | "schema": { 48 | "$ref": "#/components/schemas/Result" 49 | } 50 | } 51 | } 52 | } 53 | } 54 | }, 55 | "post": { 56 | "tags": [ 57 | "Worker分组管理" 58 | ], 59 | "summary": "saveWorkerGroup", 60 | "description": "创建Worker分组", 61 | "operationId": "saveWorkerGroup", 62 | "parameters": [ 63 | { 64 | "name": "id", 65 | "in": "query", 66 | "description": "Worker Server分组ID", 67 | "required": false, 68 | "schema": { 69 | "type": "integer", 70 | "format": "int32" 71 | } 72 | }, 73 | { 74 | "name": "name", 75 | "in": "query", 76 | "description": "Worker分组名称", 77 | "required": true, 78 | "schema": { 79 | "type": "string" 80 | } 81 | }, 82 | { 83 | "name": "addrList", 84 | "in": "query", 85 | "description": "worker地址列表", 86 | "required": true, 87 | "schema": { 88 | "type": "string" 89 | } 90 | }, 91 | { 92 | "name": "description", 93 | "in": "query", 94 | "description": "WORKER_DESC", 95 | "required": false, 96 | "schema": { 97 | "type": "string" 98 | } 99 | }, 100 | { 101 | "name": "otherParamsJson", 102 | "in": "query", 103 | "description": "WORKER_PARAMS_JSON", 104 | "required": false, 105 | "schema": { 106 | "type": "string" 107 | } 108 | } 109 | ], 110 | "responses": { 111 | "200": { 112 | "description": "OK", 113 | "content": { 114 | "*/*": { 115 | "schema": { 116 | "$ref": "#/components/schemas/Result" 117 | } 118 | } 119 | } 120 | } 121 | } 122 | } 123 | }, 124 | "/worker-groups/worker-address-list": { 125 | "get": { 126 | "tags": [ 127 | "Worker分组管理" 128 | ], 129 | "summary": "queryWorkerAddressList", 130 | "description": "查询worker地址列表", 131 | "operationId": "queryWorkerAddressList", 132 | "responses": { 133 | "200": { 134 | "description": "OK", 135 | "content": { 136 | "*/*": { 137 | "schema": { 138 | "$ref": "#/components/schemas/Result" 139 | } 140 | } 141 | } 142 | } 143 | } 144 | } 145 | }, 146 | "/worker-groups/all": { 147 | "get": { 148 | "tags": [ 149 | "Worker分组管理" 150 | ], 151 | "summary": "queryAllWorkerGroups", 152 | "description": "查询worker group分组", 153 | "operationId": "queryAllWorkerGroups", 154 | "responses": { 155 | "200": { 156 | "description": "OK", 157 | "content": { 158 | "*/*": { 159 | "schema": { 160 | "$ref": "#/components/schemas/Result" 161 | } 162 | } 163 | } 164 | } 165 | } 166 | } 167 | }, 168 | "/worker-groups/{id}": { 169 | "delete": { 170 | "tags": [ 171 | "Worker分组管理" 172 | ], 173 | "summary": "deleteWorkerGroupById", 174 | "description": "通过ID删除worker group", 175 | "operationId": "deleteWorkerGroupById", 176 | "parameters": [ 177 | { 178 | "name": "id", 179 | "in": "path", 180 | "description": "Worker Server分组ID", 181 | "required": true, 182 | "schema": { 183 | "type": "integer", 184 | "format": "int32" 185 | } 186 | } 187 | ], 188 | "responses": { 189 | "200": { 190 | "description": "OK", 191 | "content": { 192 | "*/*": { 193 | "schema": { 194 | "$ref": "#/components/schemas/Result" 195 | } 196 | } 197 | } 198 | } 199 | } 200 | } 201 | } 202 | } 203 | } ``` -------------------------------------------------------------------------------- /src/dolphinscheduler_mcp/tools_generated/lineage_tools.py: -------------------------------------------------------------------------------- ```python 1 | """Tools for lineage operations in DolphinScheduler.""" 2 | 3 | from typing import Dict, List, Optional 4 | 5 | from ..fastmcp_compat import FastMCPTool 6 | 7 | from ..client import DolphinSchedulerClient 8 | 9 | 10 | class CreateProjectsLineagesTasksVerifyDelete(FastMCPTool): 11 | """Tool to 校验是否可以删除任务""" 12 | 13 | name = "create_projects_lineages_tasks_verify_delete" 14 | description = "校验是否可以删除任务" 15 | is_async = True 16 | schema = { 17 | "type": "object", 18 | "properties": { 19 | "project_code": { 20 | "type": "integer", 21 | "format": "int64", 22 | "description": "\u9879\u76eeCode" 23 | }, 24 | "process_definition_code": { 25 | "type": "integer", 26 | "format": "int64", 27 | "description": "\u6d41\u7a0b\u5b9a\u4e49\u7f16\u7801" 28 | }, 29 | "task_code": { 30 | "type": "integer", 31 | "format": "int64", 32 | "description": "\u4efb\u52a1\u5b9a\u4e49\u4ee3\u7801" 33 | } 34 | }, 35 | "required": [ 36 | "project_code", 37 | "process_definition_code", 38 | "task_code" 39 | ] 40 | } 41 | 42 | async def _run(self, project_code, process_definition_code, task_code) -> Dict: 43 | """Execute the POST operation on /projects/{projectCode}/lineages/tasks/verify-delete.""" 44 | client = DolphinSchedulerClient() 45 | try: 46 | params = { 47 | "processDefinitionCode": process_definition_code, 48 | "taskCode": task_code, 49 | } 50 | response = await client.request( 51 | "POST", 52 | f"/projects/{project_code}/lineages/tasks/verify-delete", params=params 53 | ) 54 | return {"success": True, "data": response} 55 | finally: 56 | await client.close() 57 | 58 | 59 | class ListProjectsLineages(FastMCPTool): 60 | """Tool to 通过血缘代码查询工作流血缘关系""" 61 | 62 | name = "list_projects_lineages" 63 | description = "通过血缘代码查询工作流血缘关系" 64 | is_async = True 65 | schema = { 66 | "type": "object", 67 | "properties": { 68 | "project_code": { 69 | "type": "integer", 70 | "format": "int64", 71 | "description": "\u9879\u76eeCode" 72 | }, 73 | "work_flow_code": { 74 | "type": "integer", 75 | "format": "int64" 76 | } 77 | }, 78 | "required": [ 79 | "project_code", 80 | "work_flow_code" 81 | ] 82 | } 83 | 84 | async def _run(self, project_code, work_flow_code) -> Dict: 85 | """Execute the GET operation on /projects/{projectCode}/lineages/{workFlowCode}.""" 86 | client = DolphinSchedulerClient() 87 | try: 88 | response = await client.request( 89 | "GET", 90 | f"/projects/{project_code}/lineages/{work_flow_code}" 91 | ) 92 | return {"success": True, "data": response} 93 | finally: 94 | await client.close() 95 | 96 | 97 | class ListProjectsLineagesQueryDependentTasks(FastMCPTool): 98 | """Tool to query_downstream_dependent_task_notes""" 99 | 100 | name = "list_projects_lineages_query_dependent_tasks" 101 | description = "QUERY_DOWNSTREAM_DEPENDENT_TASK_NOTES" 102 | is_async = True 103 | schema = { 104 | "type": "object", 105 | "properties": { 106 | "work_flow_code": { 107 | "type": "integer", 108 | "format": "int64", 109 | "description": "\u6d41\u7a0b\u5b9a\u4e49\u7f16\u7801" 110 | }, 111 | "task_code": { 112 | "type": "integer", 113 | "format": "int64", 114 | "description": "\u4efb\u52a1\u5b9a\u4e49\u4ee3\u7801" 115 | } 116 | }, 117 | "required": [ 118 | "work_flow_code" 119 | ] 120 | } 121 | 122 | async def _run(self, work_flow_code, task_code) -> Dict: 123 | """Execute the GET operation on /projects/{projectCode}/lineages/query-dependent-tasks.""" 124 | client = DolphinSchedulerClient() 125 | try: 126 | params = { 127 | "workFlowCode": work_flow_code, 128 | "taskCode": task_code, 129 | } 130 | response = await client.request( 131 | "GET", 132 | f"/projects/{project_code}/lineages/query-dependent-tasks", params=params 133 | ) 134 | return {"success": True, "data": response} 135 | finally: 136 | await client.close() 137 | 138 | 139 | class GetProjectsLineagesQueryByName(FastMCPTool): 140 | """Tool to 通过名称查询工作流血缘列表""" 141 | 142 | name = "get_projects_lineages_query_by_name" 143 | description = "通过名称查询工作流血缘列表" 144 | is_async = True 145 | schema = { 146 | "type": "object", 147 | "properties": { 148 | "project_code": { 149 | "type": "integer", 150 | "format": "int64", 151 | "description": "\u9879\u76eeCode" 152 | }, 153 | "work_flow_name": { 154 | "type": "string" 155 | } 156 | }, 157 | "required": [ 158 | "project_code" 159 | ] 160 | } 161 | 162 | async def _run(self, project_code, work_flow_name) -> Dict: 163 | """Execute the GET operation on /projects/{projectCode}/lineages/query-by-name.""" 164 | client = DolphinSchedulerClient() 165 | try: 166 | params = { 167 | "workFlowName": work_flow_name, 168 | } 169 | response = await client.request( 170 | "GET", 171 | f"/projects/{project_code}/lineages/query-by-name", params=params 172 | ) 173 | return {"success": True, "data": response} 174 | finally: 175 | await client.close() 176 | 177 | 178 | class ListProjectsLineagesList(FastMCPTool): 179 | """Tool to 查询工作量血缘关系""" 180 | 181 | name = "list_projects_lineages_list" 182 | description = "查询工作量血缘关系" 183 | is_async = True 184 | schema = { 185 | "type": "object", 186 | "properties": { 187 | "project_code": { 188 | "type": "integer", 189 | "format": "int64", 190 | "description": "\u9879\u76eeCode" 191 | } 192 | }, 193 | "required": [ 194 | "project_code" 195 | ] 196 | } 197 | 198 | async def _run(self, project_code) -> Dict: 199 | """Execute the GET operation on /projects/{projectCode}/lineages/list.""" 200 | client = DolphinSchedulerClient() 201 | try: 202 | response = await client.request( 203 | "GET", 204 | f"/projects/{project_code}/lineages/list" 205 | ) 206 | return {"success": True, "data": response} 207 | finally: 208 | await client.close() 209 | 210 | 211 | def register_lineage_tools(mcp): 212 | """Register lineage tools with FastMCP. 213 | 214 | Args: 215 | mcp: The FastMCP instance to register tools with. 216 | """ 217 | from ..fastmcp_compat import register_tool_class 218 | 219 | register_tool_class(mcp, CreateProjectsLineagesTasksVerifyDelete) 220 | register_tool_class(mcp, GetProjectsLineagesQueryByName) 221 | register_tool_class(mcp, ListProjectsLineages) 222 | register_tool_class(mcp, ListProjectsLineagesList) 223 | register_tool_class(mcp, ListProjectsLineagesQueryDependentTasks) 224 | ``` -------------------------------------------------------------------------------- /mcp-openapi-split/paths/18_workflow_lineage_api.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "paths": { 3 | "/projects/{projectCode}/lineages/tasks/verify-delete": { 4 | "post": { 5 | "tags": [ 6 | "工作流血缘相关操作" 7 | ], 8 | "summary": "verifyTaskCanDelete", 9 | "description": "校验是否可以删除任务", 10 | "operationId": "verifyTaskCanDelete", 11 | "parameters": [ 12 | { 13 | "name": "projectCode", 14 | "in": "path", 15 | "description": "项目Code", 16 | "required": true, 17 | "schema": { 18 | "type": "integer", 19 | "format": "int64" 20 | } 21 | }, 22 | { 23 | "name": "processDefinitionCode", 24 | "in": "query", 25 | "description": "流程定义编码", 26 | "required": true, 27 | "schema": { 28 | "type": "integer", 29 | "format": "int64" 30 | } 31 | }, 32 | { 33 | "name": "taskCode", 34 | "in": "query", 35 | "description": "任务定义代码", 36 | "required": true, 37 | "schema": { 38 | "type": "integer", 39 | "format": "int64" 40 | } 41 | } 42 | ], 43 | "responses": { 44 | "200": { 45 | "description": "OK", 46 | "content": { 47 | "*/*": { 48 | "schema": { 49 | "$ref": "#/components/schemas/Result" 50 | } 51 | } 52 | } 53 | } 54 | } 55 | } 56 | }, 57 | "/projects/{projectCode}/lineages/{workFlowCode}": { 58 | "get": { 59 | "tags": [ 60 | "工作流血缘相关操作" 61 | ], 62 | "summary": "queryLineageByWorkFlowCode", 63 | "description": "通过血缘代码查询工作流血缘关系", 64 | "operationId": "queryWorkFlowLineageByCode", 65 | "parameters": [ 66 | { 67 | "name": "projectCode", 68 | "in": "path", 69 | "description": "项目Code", 70 | "required": true, 71 | "schema": { 72 | "type": "integer", 73 | "format": "int64" 74 | } 75 | }, 76 | { 77 | "name": "workFlowCode", 78 | "in": "path", 79 | "required": true, 80 | "schema": { 81 | "type": "integer", 82 | "format": "int64" 83 | } 84 | } 85 | ], 86 | "responses": { 87 | "200": { 88 | "description": "OK", 89 | "content": { 90 | "*/*": { 91 | "schema": { 92 | "$ref": "#/components/schemas/ResultMapStringObject" 93 | } 94 | } 95 | } 96 | } 97 | } 98 | } 99 | }, 100 | "/projects/{projectCode}/lineages/query-dependent-tasks": { 101 | "get": { 102 | "tags": [ 103 | "工作流血缘相关操作" 104 | ], 105 | "summary": "queryDownstreamDependentTaskList", 106 | "description": "QUERY_DOWNSTREAM_DEPENDENT_TASK_NOTES", 107 | "operationId": "queryDownstreamDependentTaskList", 108 | "parameters": [ 109 | { 110 | "name": "workFlowCode", 111 | "in": "query", 112 | "description": "流程定义编码", 113 | "required": true, 114 | "schema": { 115 | "type": "integer", 116 | "format": "int64" 117 | } 118 | }, 119 | { 120 | "name": "taskCode", 121 | "in": "query", 122 | "description": "任务定义代码", 123 | "required": false, 124 | "schema": { 125 | "type": "integer", 126 | "format": "int64" 127 | } 128 | } 129 | ], 130 | "responses": { 131 | "200": { 132 | "description": "OK", 133 | "content": { 134 | "*/*": { 135 | "schema": { 136 | "$ref": "#/components/schemas/ResultMapStringObject" 137 | } 138 | } 139 | } 140 | } 141 | } 142 | } 143 | }, 144 | "/projects/{projectCode}/lineages/query-by-name": { 145 | "get": { 146 | "tags": [ 147 | "工作流血缘相关操作" 148 | ], 149 | "summary": "queryLineageByWorkFlowName", 150 | "description": "通过名称查询工作流血缘列表", 151 | "operationId": "queryWorkFlowLineageByName", 152 | "parameters": [ 153 | { 154 | "name": "projectCode", 155 | "in": "path", 156 | "description": "项目Code", 157 | "required": true, 158 | "schema": { 159 | "type": "integer", 160 | "format": "int64" 161 | } 162 | }, 163 | { 164 | "name": "workFlowName", 165 | "in": "query", 166 | "required": false, 167 | "schema": { 168 | "type": "string" 169 | } 170 | } 171 | ], 172 | "responses": { 173 | "200": { 174 | "description": "OK", 175 | "content": { 176 | "*/*": { 177 | "schema": { 178 | "$ref": "#/components/schemas/ResultListWorkFlowLineage" 179 | } 180 | } 181 | } 182 | } 183 | } 184 | } 185 | }, 186 | "/projects/{projectCode}/lineages/list": { 187 | "get": { 188 | "tags": [ 189 | "工作流血缘相关操作" 190 | ], 191 | "summary": "queryWorkFlowList", 192 | "description": "查询工作量血缘关系", 193 | "operationId": "queryWorkFlowLineage", 194 | "parameters": [ 195 | { 196 | "name": "projectCode", 197 | "in": "path", 198 | "description": "项目Code", 199 | "required": true, 200 | "schema": { 201 | "type": "integer", 202 | "format": "int64" 203 | } 204 | } 205 | ], 206 | "responses": { 207 | "200": { 208 | "description": "OK", 209 | "content": { 210 | "*/*": { 211 | "schema": { 212 | "$ref": "#/components/schemas/ResultMapStringObject" 213 | } 214 | } 215 | } 216 | } 217 | } 218 | } 219 | } 220 | } 221 | } ``` -------------------------------------------------------------------------------- /mcp-openapi-split/paths/32_queue_api.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "paths": { 3 | "/queues/{id}": { 4 | "put": { 5 | "tags": [ 6 | "队列相关操作" 7 | ], 8 | "summary": "updateQueue", 9 | "description": "更新队列", 10 | "operationId": "updateQueue", 11 | "parameters": [ 12 | { 13 | "name": "id", 14 | "in": "path", 15 | "description": "队列ID", 16 | "required": true, 17 | "schema": { 18 | "type": "integer", 19 | "format": "int32" 20 | } 21 | }, 22 | { 23 | "name": "queue", 24 | "in": "query", 25 | "description": "hadoop yarn队列名", 26 | "required": true, 27 | "schema": { 28 | "type": "string" 29 | } 30 | }, 31 | { 32 | "name": "queueName", 33 | "in": "query", 34 | "description": "队列名", 35 | "required": true, 36 | "schema": { 37 | "type": "string" 38 | } 39 | } 40 | ], 41 | "responses": { 42 | "201": { 43 | "description": "Created", 44 | "content": { 45 | "*/*": { 46 | "schema": { 47 | "$ref": "#/components/schemas/ResultQueue" 48 | } 49 | } 50 | } 51 | } 52 | } 53 | }, 54 | "delete": { 55 | "tags": [ 56 | "队列相关操作" 57 | ], 58 | "summary": "deleteQueueById", 59 | "description": "DELETE_QUEUE_NOTES", 60 | "operationId": "deleteQueueById", 61 | "parameters": [ 62 | { 63 | "name": "id", 64 | "in": "path", 65 | "description": "队列ID", 66 | "required": true, 67 | "schema": { 68 | "type": "integer", 69 | "format": "int32" 70 | } 71 | } 72 | ], 73 | "responses": { 74 | "200": { 75 | "description": "OK", 76 | "content": { 77 | "*/*": { 78 | "schema": { 79 | "$ref": "#/components/schemas/ResultBoolean" 80 | } 81 | } 82 | } 83 | } 84 | } 85 | } 86 | }, 87 | "/queues": { 88 | "get": { 89 | "tags": [ 90 | "队列相关操作" 91 | ], 92 | "summary": "queryQueueListPaging", 93 | "description": "分页查询队列列表", 94 | "operationId": "queryQueueListPaging", 95 | "parameters": [ 96 | { 97 | "name": "pageNo", 98 | "in": "query", 99 | "description": "页码号", 100 | "required": true, 101 | "schema": { 102 | "type": "integer", 103 | "format": "int32" 104 | } 105 | }, 106 | { 107 | "name": "searchVal", 108 | "in": "query", 109 | "description": "搜索值", 110 | "required": false, 111 | "schema": { 112 | "type": "string" 113 | } 114 | }, 115 | { 116 | "name": "pageSize", 117 | "in": "query", 118 | "description": "页大小", 119 | "required": true, 120 | "schema": { 121 | "type": "integer", 122 | "format": "int32" 123 | } 124 | } 125 | ], 126 | "responses": { 127 | "200": { 128 | "description": "OK", 129 | "content": { 130 | "*/*": { 131 | "schema": { 132 | "$ref": "#/components/schemas/ResultPageInfoQueue" 133 | } 134 | } 135 | } 136 | } 137 | } 138 | }, 139 | "post": { 140 | "tags": [ 141 | "队列相关操作" 142 | ], 143 | "summary": "createQueue", 144 | "description": "创建队列", 145 | "operationId": "createQueue", 146 | "parameters": [ 147 | { 148 | "name": "queue", 149 | "in": "query", 150 | "description": "hadoop yarn队列名", 151 | "required": true, 152 | "schema": { 153 | "type": "string" 154 | } 155 | }, 156 | { 157 | "name": "queueName", 158 | "in": "query", 159 | "description": "队列名", 160 | "required": true, 161 | "schema": { 162 | "type": "string" 163 | } 164 | } 165 | ], 166 | "responses": { 167 | "201": { 168 | "description": "Created", 169 | "content": { 170 | "*/*": { 171 | "schema": { 172 | "$ref": "#/components/schemas/ResultQueue" 173 | } 174 | } 175 | } 176 | } 177 | } 178 | } 179 | }, 180 | "/queues/verify": { 181 | "post": { 182 | "tags": [ 183 | "队列相关操作" 184 | ], 185 | "summary": "verifyQueue", 186 | "description": "验证队列", 187 | "operationId": "verifyQueue", 188 | "parameters": [ 189 | { 190 | "name": "queue", 191 | "in": "query", 192 | "description": "hadoop yarn队列名", 193 | "required": true, 194 | "schema": { 195 | "type": "string" 196 | } 197 | }, 198 | { 199 | "name": "queueName", 200 | "in": "query", 201 | "description": "队列名", 202 | "required": true, 203 | "schema": { 204 | "type": "string" 205 | } 206 | } 207 | ], 208 | "responses": { 209 | "200": { 210 | "description": "OK", 211 | "content": { 212 | "*/*": { 213 | "schema": { 214 | "$ref": "#/components/schemas/ResultBoolean" 215 | } 216 | } 217 | } 218 | } 219 | } 220 | } 221 | }, 222 | "/queues/list": { 223 | "get": { 224 | "tags": [ 225 | "队列相关操作" 226 | ], 227 | "summary": "queryList", 228 | "description": "查询队列列表", 229 | "operationId": "queryList", 230 | "responses": { 231 | "200": { 232 | "description": "OK", 233 | "content": { 234 | "*/*": { 235 | "schema": { 236 | "$ref": "#/components/schemas/ResultListQueue" 237 | } 238 | } 239 | } 240 | } 241 | } 242 | } 243 | } 244 | } 245 | } ``` -------------------------------------------------------------------------------- /src/dolphinscheduler_mcp/tools_generated/k8s_namespace_tools.py: -------------------------------------------------------------------------------- ```python 1 | """Tools for k8s namespace operations in DolphinScheduler.""" 2 | 3 | from typing import Dict, List, Optional 4 | 5 | from ..fastmcp_compat import FastMCPTool 6 | 7 | from ..client import DolphinSchedulerClient 8 | 9 | 10 | class GetK8sNamespace(FastMCPTool): 11 | """Tool to 查询命名空间列表页面""" 12 | 13 | name = "get_k8s_namespace" 14 | description = "查询命名空间列表页面" 15 | is_async = True 16 | schema = { 17 | "type": "object", 18 | "properties": { 19 | "searchVal": { 20 | "type": "string", 21 | "description": "\u641c\u7d22\u503c" 22 | }, 23 | "pageSize": { 24 | "type": "integer", 25 | "format": "int32", 26 | "description": "\u9875\u5927\u5c0f" 27 | }, 28 | "pageNo": { 29 | "type": "integer", 30 | "format": "int32", 31 | "description": "\u9875\u7801\u53f7" 32 | } 33 | }, 34 | "required": [ 35 | "pageSize", 36 | "pageNo" 37 | ] 38 | } 39 | 40 | async def _run(self, searchVal, pageSize, pageNo) -> Dict: 41 | """Execute the GET operation on /k8s-namespace.""" 42 | client = DolphinSchedulerClient() 43 | try: 44 | params = { 45 | "searchVal": searchVal, 46 | "pageSize": pageSize, 47 | "pageNo": pageNo, 48 | } 49 | response = await client.request( 50 | "GET", 51 | f"/k8s-namespace", params=params 52 | ) 53 | return {"success": True, "data": response} 54 | finally: 55 | await client.close() 56 | 57 | 58 | class CreateK8sNamespace(FastMCPTool): 59 | """Tool to 创建命名空间""" 60 | 61 | name = "create_k8s_namespace" 62 | description = "创建命名空间" 63 | is_async = True 64 | schema = { 65 | "type": "object", 66 | "properties": { 67 | "namespace": { 68 | "type": "string", 69 | "description": "\u547d\u540d\u7a7a\u95f4" 70 | }, 71 | "clusterCode": { 72 | "type": "integer", 73 | "format": "int64", 74 | "description": "\u96c6\u7fa4\u4ee3\u7801" 75 | } 76 | }, 77 | "required": [ 78 | "namespace", 79 | "clusterCode" 80 | ] 81 | } 82 | 83 | async def _run(self, namespace, clusterCode) -> Dict: 84 | """Execute the POST operation on /k8s-namespace.""" 85 | client = DolphinSchedulerClient() 86 | try: 87 | params = { 88 | "namespace": namespace, 89 | "clusterCode": clusterCode, 90 | } 91 | response = await client.request( 92 | "POST", 93 | f"/k8s-namespace", params=params 94 | ) 95 | return {"success": True, "data": response} 96 | finally: 97 | await client.close() 98 | 99 | 100 | class CreateK8sNamespaceVerify(FastMCPTool): 101 | """Tool to 校验命名空间""" 102 | 103 | name = "create_k8s_namespace_verify" 104 | description = "校验命名空间" 105 | is_async = True 106 | schema = { 107 | "type": "object", 108 | "properties": { 109 | "namespace": { 110 | "type": "string", 111 | "description": "\u547d\u540d\u7a7a\u95f4" 112 | }, 113 | "clusterCode": { 114 | "type": "integer", 115 | "format": "int64", 116 | "description": "\u96c6\u7fa4\u4ee3\u7801" 117 | } 118 | }, 119 | "required": [ 120 | "namespace", 121 | "clusterCode" 122 | ] 123 | } 124 | 125 | async def _run(self, namespace, clusterCode) -> Dict: 126 | """Execute the POST operation on /k8s-namespace/verify.""" 127 | client = DolphinSchedulerClient() 128 | try: 129 | params = { 130 | "namespace": namespace, 131 | "clusterCode": clusterCode, 132 | } 133 | response = await client.request( 134 | "POST", 135 | f"/k8s-namespace/verify", params=params 136 | ) 137 | return {"success": True, "data": response} 138 | finally: 139 | await client.close() 140 | 141 | 142 | class CreateK8sNamespaceDelete(FastMCPTool): 143 | """Tool to 通过id删除命名空间""" 144 | 145 | name = "create_k8s_namespace_delete" 146 | description = "通过ID删除命名空间" 147 | is_async = True 148 | schema = { 149 | "type": "object", 150 | "properties": { 151 | "id": { 152 | "type": "integer", 153 | "format": "int32", 154 | "description": "k8s\u547d\u540d\u7a7a\u95f4ID" 155 | } 156 | }, 157 | "required": [ 158 | "id" 159 | ] 160 | } 161 | 162 | async def _run(self, id) -> Dict: 163 | """Execute the POST operation on /k8s-namespace/delete.""" 164 | client = DolphinSchedulerClient() 165 | try: 166 | params = { 167 | "id": id, 168 | } 169 | response = await client.request( 170 | "POST", 171 | f"/k8s-namespace/delete", params=params 172 | ) 173 | return {"success": True, "data": response} 174 | finally: 175 | await client.close() 176 | 177 | 178 | class GetK8sNamespaceUnauthNamespace(FastMCPTool): 179 | """Tool to 查询未授权命名空间""" 180 | 181 | name = "get_k8s_namespace_unauth_namespace" 182 | description = "查询未授权命名空间" 183 | is_async = True 184 | schema = { 185 | "type": "object", 186 | "properties": { 187 | "userId": { 188 | "type": "integer", 189 | "format": "int32", 190 | "description": "\u7528\u6237ID" 191 | } 192 | }, 193 | "required": [ 194 | "userId" 195 | ] 196 | } 197 | 198 | async def _run(self, userId) -> Dict: 199 | """Execute the GET operation on /k8s-namespace/unauth-namespace.""" 200 | client = DolphinSchedulerClient() 201 | try: 202 | params = { 203 | "userId": userId, 204 | } 205 | response = await client.request( 206 | "GET", 207 | f"/k8s-namespace/unauth-namespace", params=params 208 | ) 209 | return {"success": True, "data": response} 210 | finally: 211 | await client.close() 212 | 213 | 214 | class GetK8sNamespaceAvailableNamespaceList(FastMCPTool): 215 | """Tool to 获取可用命名空间列表""" 216 | 217 | name = "get_k8s_namespace_available_namespace_list" 218 | description = "获取可用命名空间列表" 219 | is_async = True 220 | 221 | async def _run(self) -> Dict: 222 | """Execute the GET operation on /k8s-namespace/available-namespace-list.""" 223 | client = DolphinSchedulerClient() 224 | try: 225 | response = await client.request( 226 | "GET", 227 | f"/k8s-namespace/available-namespace-list" 228 | ) 229 | return {"success": True, "data": response} 230 | finally: 231 | await client.close() 232 | 233 | 234 | class GetK8sNamespaceAuthorizedNamespace(FastMCPTool): 235 | """Tool to 获取命名空间列表""" 236 | 237 | name = "get_k8s_namespace_authorized_namespace" 238 | description = "获取命名空间列表" 239 | is_async = True 240 | schema = { 241 | "type": "object", 242 | "properties": { 243 | "userId": { 244 | "type": "integer", 245 | "format": "int32", 246 | "description": "\u7528\u6237ID" 247 | } 248 | }, 249 | "required": [ 250 | "userId" 251 | ] 252 | } 253 | 254 | async def _run(self, userId) -> Dict: 255 | """Execute the GET operation on /k8s-namespace/authorized-namespace.""" 256 | client = DolphinSchedulerClient() 257 | try: 258 | params = { 259 | "userId": userId, 260 | } 261 | response = await client.request( 262 | "GET", 263 | f"/k8s-namespace/authorized-namespace", params=params 264 | ) 265 | return {"success": True, "data": response} 266 | finally: 267 | await client.close() 268 | 269 | 270 | def register_k8s_namespace_tools(mcp): 271 | """Register k8s namespace tools with FastMCP. 272 | 273 | Args: 274 | mcp: The FastMCP instance to register tools with. 275 | """ 276 | from ..fastmcp_compat import register_tool_class 277 | 278 | register_tool_class(mcp, CreateK8sNamespace) 279 | register_tool_class(mcp, CreateK8sNamespaceDelete) 280 | register_tool_class(mcp, CreateK8sNamespaceVerify) 281 | register_tool_class(mcp, GetK8sNamespace) 282 | register_tool_class(mcp, GetK8sNamespaceAuthorizedNamespace) 283 | register_tool_class(mcp, GetK8sNamespaceAvailableNamespaceList) 284 | register_tool_class(mcp, GetK8sNamespaceUnauthNamespace) 285 | ``` -------------------------------------------------------------------------------- /src/dolphinscheduler_mcp/tools_generated/access_token_tools.py: -------------------------------------------------------------------------------- ```python 1 | """Tools for access token operations in DolphinScheduler.""" 2 | 3 | from typing import Dict, List, Optional 4 | 5 | from ..fastmcp_compat import FastMCPTool 6 | 7 | from ..client import DolphinSchedulerClient 8 | 9 | 10 | class UpdateAccessTokens(FastMCPTool): 11 | """Tool to 更新指定用户的安全令牌""" 12 | 13 | name = "update_access_tokens" 14 | description = "更新指定用户的安全令牌" 15 | is_async = True 16 | schema = { 17 | "type": "object", 18 | "properties": { 19 | "id": { 20 | "type": "integer", 21 | "format": "int32", 22 | "description": "\u5b89\u5168\u4ee4\u724c\u7684ID" 23 | }, 24 | "user_id": { 25 | "type": "integer", 26 | "format": "int32", 27 | "description": "\u7528\u6237ID" 28 | }, 29 | "expire_time": { 30 | "type": "string", 31 | "description": "\u5b89\u5168\u4ee4\u724c\u7684\u8fc7\u671f\u65f6\u95f4" 32 | }, 33 | "token": { 34 | "type": "string", 35 | "description": "\u5b89\u5168\u4ee4\u724c\u5b57\u7b26\u4e32\uff0c\u82e5\u672a\u663e\u5f0f\u6307\u5b9a\u5c06\u4f1a\u81ea\u52a8\u751f\u6210" 36 | } 37 | }, 38 | "required": [ 39 | "id", 40 | "user_id", 41 | "expire_time" 42 | ] 43 | } 44 | 45 | async def _run(self, id, user_id, expire_time, token) -> Dict: 46 | """Execute the PUT operation on /access-tokens/{id}.""" 47 | client = DolphinSchedulerClient() 48 | try: 49 | params = { 50 | "userId": user_id, 51 | "expireTime": expire_time, 52 | "token": token, 53 | } 54 | response = await client.request( 55 | "PUT", 56 | f"/access-tokens/{id}", params=params 57 | ) 58 | return {"success": True, "data": response} 59 | finally: 60 | await client.close() 61 | 62 | 63 | class DeleteAccessTokens(FastMCPTool): 64 | """Tool to delete_token_notes""" 65 | 66 | name = "delete_access_tokens" 67 | description = "DELETE_TOKEN_NOTES" 68 | is_async = True 69 | schema = { 70 | "type": "object", 71 | "properties": { 72 | "id": { 73 | "type": "integer", 74 | "format": "int32" 75 | } 76 | }, 77 | "required": [ 78 | "id" 79 | ] 80 | } 81 | 82 | async def _run(self, id) -> Dict: 83 | """Execute the DELETE operation on /access-tokens/{id}.""" 84 | client = DolphinSchedulerClient() 85 | try: 86 | response = await client.request( 87 | "DELETE", 88 | f"/access-tokens/{id}" 89 | ) 90 | return {"success": True, "data": response} 91 | finally: 92 | await client.close() 93 | 94 | 95 | class GetAccessTokens(FastMCPTool): 96 | """Tool to 分页查询access token列表""" 97 | 98 | name = "get_access_tokens" 99 | description = "分页查询access token列表" 100 | is_async = True 101 | schema = { 102 | "type": "object", 103 | "properties": { 104 | "page_no": { 105 | "type": "integer", 106 | "format": "int32", 107 | "description": "\u9875\u7801\u53f7" 108 | }, 109 | "search_val": { 110 | "type": "string", 111 | "description": "\u641c\u7d22\u503c" 112 | }, 113 | "page_size": { 114 | "type": "integer", 115 | "format": "int32", 116 | "description": "\u9875\u5927\u5c0f" 117 | } 118 | }, 119 | "required": [ 120 | "page_no", 121 | "page_size" 122 | ] 123 | } 124 | 125 | async def _run(self, page_no, search_val, page_size) -> Dict: 126 | """Execute the GET operation on /access-tokens.""" 127 | client = DolphinSchedulerClient() 128 | try: 129 | params = { 130 | "pageNo": page_no, 131 | "searchVal": search_val, 132 | "pageSize": page_size, 133 | } 134 | response = await client.request( 135 | "GET", 136 | f"/access-tokens", params=params 137 | ) 138 | return {"success": True, "data": response} 139 | finally: 140 | await client.close() 141 | 142 | 143 | class CreateAccessTokens(FastMCPTool): 144 | """Tool to 为指定用户创建安全令牌""" 145 | 146 | name = "create_access_tokens" 147 | description = "为指定用户创建安全令牌" 148 | is_async = True 149 | schema = { 150 | "type": "object", 151 | "properties": { 152 | "user_id": { 153 | "type": "integer", 154 | "format": "int32", 155 | "description": "\u7528\u6237ID" 156 | }, 157 | "expire_time": { 158 | "type": "string", 159 | "description": "\u5b89\u5168\u4ee4\u724c\u7684\u8fc7\u671f\u65f6\u95f4" 160 | }, 161 | "token": { 162 | "type": "string", 163 | "description": "\u5b89\u5168\u4ee4\u724c\u5b57\u7b26\u4e32\uff0c\u82e5\u672a\u663e\u5f0f\u6307\u5b9a\u5c06\u4f1a\u81ea\u52a8\u751f\u6210" 164 | } 165 | }, 166 | "required": [ 167 | "user_id", 168 | "expire_time" 169 | ] 170 | } 171 | 172 | async def _run(self, user_id, expire_time, token) -> Dict: 173 | """Execute the POST operation on /access-tokens.""" 174 | client = DolphinSchedulerClient() 175 | try: 176 | params = { 177 | "userId": user_id, 178 | "expireTime": expire_time, 179 | "token": token, 180 | } 181 | response = await client.request( 182 | "POST", 183 | f"/access-tokens", params=params 184 | ) 185 | return {"success": True, "data": response} 186 | finally: 187 | await client.close() 188 | 189 | 190 | class CreateAccessTokensGenerate(FastMCPTool): 191 | """Tool to no description available.""" 192 | 193 | name = "create_access_tokens_generate" 194 | description = "No description available." 195 | is_async = True 196 | schema = { 197 | "type": "object", 198 | "properties": { 199 | "user_id": { 200 | "type": "integer", 201 | "format": "int32" 202 | }, 203 | "expire_time": { 204 | "type": "string" 205 | } 206 | }, 207 | "required": [ 208 | "user_id", 209 | "expire_time" 210 | ] 211 | } 212 | 213 | async def _run(self, user_id, expire_time) -> Dict: 214 | """Execute the POST operation on /access-tokens/generate.""" 215 | client = DolphinSchedulerClient() 216 | try: 217 | params = { 218 | "userId": user_id, 219 | "expireTime": expire_time, 220 | } 221 | response = await client.request( 222 | "POST", 223 | f"/access-tokens/generate", params=params 224 | ) 225 | return {"success": True, "data": response} 226 | finally: 227 | await client.close() 228 | 229 | 230 | class GetAccessTokensUser(FastMCPTool): 231 | """Tool to 查询指定用户的access token""" 232 | 233 | name = "get_access_tokens_user" 234 | description = "查询指定用户的access token" 235 | is_async = True 236 | schema = { 237 | "type": "object", 238 | "properties": { 239 | "user_id": { 240 | "type": "integer", 241 | "format": "int32", 242 | "description": "\u7528\u6237ID" 243 | } 244 | }, 245 | "required": [ 246 | "user_id" 247 | ] 248 | } 249 | 250 | async def _run(self, user_id) -> Dict: 251 | """Execute the GET operation on /access-tokens/user/{userId}.""" 252 | client = DolphinSchedulerClient() 253 | try: 254 | response = await client.request( 255 | "GET", 256 | f"/access-tokens/user/{user_id}" 257 | ) 258 | return {"success": True, "data": response} 259 | finally: 260 | await client.close() 261 | 262 | 263 | def register_access_token_tools(mcp): 264 | """Register access token tools with FastMCP. 265 | 266 | Args: 267 | mcp: The FastMCP instance to register tools with. 268 | """ 269 | from ..fastmcp_compat import register_tool_class 270 | 271 | register_tool_class(mcp, CreateAccessTokens) 272 | register_tool_class(mcp, CreateAccessTokensGenerate) 273 | register_tool_class(mcp, DeleteAccessTokens) 274 | register_tool_class(mcp, GetAccessTokens) 275 | register_tool_class(mcp, GetAccessTokensUser) 276 | register_tool_class(mcp, UpdateAccessTokens) 277 | ``` -------------------------------------------------------------------------------- /mcp-openapi-split/paths/29_tenant_api.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "paths": { 3 | "/tenants/{id}": { 4 | "put": { 5 | "tags": [ 6 | "租户相关操作" 7 | ], 8 | "summary": "updateTenant", 9 | "description": "更新租户", 10 | "operationId": "updateTenant", 11 | "parameters": [ 12 | { 13 | "name": "id", 14 | "in": "path", 15 | "description": "租户ID", 16 | "required": true, 17 | "schema": { 18 | "type": "integer", 19 | "format": "int32" 20 | } 21 | }, 22 | { 23 | "name": "tenantCode", 24 | "in": "query", 25 | "description": "操作系统租户", 26 | "required": true, 27 | "schema": { 28 | "type": "string" 29 | } 30 | }, 31 | { 32 | "name": "queueId", 33 | "in": "query", 34 | "description": "队列ID", 35 | "required": true, 36 | "schema": { 37 | "type": "integer", 38 | "format": "int32" 39 | } 40 | }, 41 | { 42 | "name": "description", 43 | "in": "query", 44 | "description": "租户描述", 45 | "required": false, 46 | "schema": { 47 | "type": "string" 48 | } 49 | } 50 | ], 51 | "responses": { 52 | "200": { 53 | "description": "OK", 54 | "content": { 55 | "*/*": { 56 | "schema": { 57 | "$ref": "#/components/schemas/ResultBoolean" 58 | } 59 | } 60 | } 61 | } 62 | } 63 | }, 64 | "delete": { 65 | "tags": [ 66 | "租户相关操作" 67 | ], 68 | "summary": "deleteTenantById", 69 | "description": "删除租户", 70 | "operationId": "deleteTenantById", 71 | "parameters": [ 72 | { 73 | "name": "id", 74 | "in": "path", 75 | "description": "租户ID", 76 | "required": true, 77 | "schema": { 78 | "type": "integer", 79 | "format": "int32" 80 | } 81 | } 82 | ], 83 | "responses": { 84 | "200": { 85 | "description": "OK", 86 | "content": { 87 | "*/*": { 88 | "schema": { 89 | "$ref": "#/components/schemas/ResultBoolean" 90 | } 91 | } 92 | } 93 | } 94 | } 95 | } 96 | }, 97 | "/tenants": { 98 | "get": { 99 | "tags": [ 100 | "租户相关操作" 101 | ], 102 | "summary": "queryTenantListPaging", 103 | "description": "分页查询租户列表", 104 | "operationId": "queryTenantListPaging", 105 | "parameters": [ 106 | { 107 | "name": "searchVal", 108 | "in": "query", 109 | "description": "搜索值", 110 | "required": false, 111 | "schema": { 112 | "type": "string" 113 | } 114 | }, 115 | { 116 | "name": "pageNo", 117 | "in": "query", 118 | "description": "页码号", 119 | "required": true, 120 | "schema": { 121 | "type": "integer", 122 | "format": "int32" 123 | } 124 | }, 125 | { 126 | "name": "pageSize", 127 | "in": "query", 128 | "description": "页大小", 129 | "required": true, 130 | "schema": { 131 | "type": "integer", 132 | "format": "int32" 133 | } 134 | } 135 | ], 136 | "responses": { 137 | "200": { 138 | "description": "OK", 139 | "content": { 140 | "*/*": { 141 | "schema": { 142 | "$ref": "#/components/schemas/ResultPageInfoTenant" 143 | } 144 | } 145 | } 146 | } 147 | } 148 | }, 149 | "post": { 150 | "tags": [ 151 | "租户相关操作" 152 | ], 153 | "summary": "createTenant", 154 | "description": "创建租户", 155 | "operationId": "createTenant", 156 | "parameters": [ 157 | { 158 | "name": "tenantCode", 159 | "in": "query", 160 | "description": "操作系统租户", 161 | "required": true, 162 | "schema": { 163 | "type": "string" 164 | } 165 | }, 166 | { 167 | "name": "queueId", 168 | "in": "query", 169 | "description": "队列ID", 170 | "required": true, 171 | "schema": { 172 | "type": "integer", 173 | "format": "int32" 174 | } 175 | }, 176 | { 177 | "name": "description", 178 | "in": "query", 179 | "description": "租户描述", 180 | "required": false, 181 | "schema": { 182 | "type": "string" 183 | } 184 | } 185 | ], 186 | "responses": { 187 | "201": { 188 | "description": "Created", 189 | "content": { 190 | "*/*": { 191 | "schema": { 192 | "$ref": "#/components/schemas/ResultTenant" 193 | } 194 | } 195 | } 196 | } 197 | } 198 | } 199 | }, 200 | "/tenants/verify-code": { 201 | "get": { 202 | "tags": [ 203 | "租户相关操作" 204 | ], 205 | "summary": "verifyTenantCode", 206 | "description": "验证租户", 207 | "operationId": "verifyTenantCode", 208 | "parameters": [ 209 | { 210 | "name": "tenantCode", 211 | "in": "query", 212 | "description": "操作系统租户", 213 | "required": true, 214 | "schema": { 215 | "type": "string" 216 | } 217 | } 218 | ], 219 | "responses": { 220 | "200": { 221 | "description": "OK", 222 | "content": { 223 | "*/*": { 224 | "schema": { 225 | "$ref": "#/components/schemas/ResultBoolean" 226 | } 227 | } 228 | } 229 | } 230 | } 231 | } 232 | }, 233 | "/tenants/list": { 234 | "get": { 235 | "tags": [ 236 | "租户相关操作" 237 | ], 238 | "summary": "queryTenantList", 239 | "description": "查询租户列表", 240 | "operationId": "queryTenantList", 241 | "responses": { 242 | "200": { 243 | "description": "OK", 244 | "content": { 245 | "*/*": { 246 | "schema": { 247 | "$ref": "#/components/schemas/ResultListTenant" 248 | } 249 | } 250 | } 251 | } 252 | } 253 | } 254 | } 255 | } 256 | } ``` -------------------------------------------------------------------------------- /src/dolphinscheduler_mcp/client.py: -------------------------------------------------------------------------------- ```python 1 | """DolphinScheduler API Client for MCP tools.""" 2 | 3 | import os 4 | import json 5 | import logging 6 | from typing import Dict, Any, Optional, Union, List, Tuple, BinaryIO 7 | 8 | import aiohttp 9 | from aiohttp import FormData 10 | 11 | from .config import Config 12 | 13 | 14 | class DolphinSchedulerClient: 15 | """Client for interacting with DolphinScheduler REST API.""" 16 | 17 | def __init__(self, api_url: Optional[str] = None, api_key: Optional[str] = None): 18 | """Initialize the client. 19 | 20 | Args: 21 | api_url: API URL for DolphinScheduler 22 | api_key: API key for authentication 23 | """ 24 | self.config = Config() 25 | if api_url: 26 | self.config.api_url = api_url 27 | if api_key: 28 | self.config.api_key = api_key 29 | 30 | self.session: Optional[aiohttp.ClientSession] = None 31 | self.logger = logging.getLogger("dolphinscheduler_mcp.client") 32 | 33 | async def _ensure_session(self) -> aiohttp.ClientSession: 34 | """Ensure that a session exists. 35 | 36 | Returns: 37 | An aiohttp ClientSession. 38 | """ 39 | if self.session is None: 40 | self.session = aiohttp.ClientSession() 41 | return self.session 42 | 43 | async def close(self) -> None: 44 | """Close the session.""" 45 | if self.session: 46 | await self.session.close() 47 | self.session = None 48 | 49 | async def request( 50 | self, 51 | method: str, 52 | path: str, 53 | params: Optional[Dict[str, Any]] = None, 54 | json_data: Optional[Dict[str, Any]] = None 55 | ) -> Dict[str, Any]: 56 | """Make a request to the DolphinScheduler API. 57 | 58 | Args: 59 | method: HTTP method (GET, POST, PUT, DELETE) 60 | path: API path 61 | params: Query parameters 62 | json_data: JSON data for the request body 63 | 64 | Returns: 65 | Response from the API 66 | """ 67 | session = await self._ensure_session() 68 | 69 | # Build the full URL 70 | url = f"{self.config.api_url.rstrip('/')}/{path.lstrip('/')}" 71 | 72 | # Build headers 73 | headers = {} 74 | if self.config.has_api_key(): 75 | headers["Token"] = self.config.api_key 76 | 77 | # Make the request 78 | async with session.request(method, url, params=params, json=json_data, headers=headers) as response: 79 | # Raise an exception for 4XX/5XX responses 80 | response.raise_for_status() 81 | 82 | # Parse the response 83 | return await response.json() 84 | 85 | async def request_with_files( 86 | self, 87 | method: str, 88 | endpoint: str, 89 | params: Optional[Dict[str, Any]] = None, 90 | headers: Optional[Dict[str, str]] = None, 91 | files: Optional[Dict[str, Tuple[str, Union[str, bytes]]]] = None, 92 | ) -> Dict[str, Any]: 93 | """ 94 | Send a multipart request with files to the DolphinScheduler API. 95 | 96 | Args: 97 | method: HTTP method (typically POST) 98 | endpoint: API endpoint 99 | params: Form parameters 100 | headers: Request headers 101 | files: Dictionary of files to upload {field_name: (filename, content)} 102 | 103 | Returns: 104 | Response JSON 105 | """ 106 | await self._ensure_session() 107 | 108 | url = f"{self.config.api_url.rstrip('/')}/{endpoint.lstrip('/')}" 109 | 110 | if not headers: 111 | headers = {} 112 | 113 | # Add token if available 114 | if self.config.has_api_key(): 115 | headers["Token"] = self.config.api_key 116 | 117 | try: 118 | # Create form data 119 | form = FormData() 120 | 121 | # Add files to form data 122 | if files: 123 | for field_name, (filename, content) in files.items(): 124 | form.add_field(field_name, content, filename=filename) 125 | 126 | # Add other parameters to form data 127 | if params: 128 | for key, value in params.items(): 129 | if isinstance(value, (dict, list)): 130 | form.add_field(key, json.dumps(value)) 131 | else: 132 | form.add_field(key, str(value)) 133 | 134 | self.logger.debug(f"Sending multipart {method} request to {url}") 135 | 136 | async with self.session.request( 137 | method=method, 138 | url=url, 139 | headers=headers, 140 | data=form 141 | ) as response: 142 | result = await response.json() 143 | 144 | if response.status >= 400: 145 | self.logger.error(f"API error: {response.status} - {result}") 146 | return { 147 | "success": False, 148 | "error": f"API error: {response.status}", 149 | "data": result 150 | } 151 | 152 | return result 153 | except Exception as e: 154 | self.logger.exception(f"Error in API request to {url}: {str(e)}") 155 | return { 156 | "success": False, 157 | "error": f"Request error: {str(e)}" 158 | } 159 | 160 | async def request_raw( 161 | self, 162 | method: str, 163 | endpoint: str, 164 | params: Optional[Dict[str, Any]] = None, 165 | headers: Optional[Dict[str, str]] = None, 166 | ) -> bytes: 167 | """ 168 | Send a request to the DolphinScheduler API and return raw bytes response. 169 | Useful for downloading files. 170 | 171 | Args: 172 | method: HTTP method (typically GET) 173 | endpoint: API endpoint 174 | params: URL parameters 175 | headers: Request headers 176 | 177 | Returns: 178 | Raw response bytes 179 | """ 180 | await self._ensure_session() 181 | 182 | url = f"{self.config.api_url.rstrip('/')}/{endpoint.lstrip('/')}" 183 | 184 | if not headers: 185 | headers = {} 186 | 187 | # Add token if available 188 | if self.config.has_api_key(): 189 | headers["Token"] = self.config.api_key 190 | 191 | try: 192 | self.logger.debug(f"Sending {method} request to {url} for raw response") 193 | 194 | async with self.session.request( 195 | method=method, 196 | url=url, 197 | params=params, 198 | headers=headers 199 | ) as response: 200 | if response.status >= 400: 201 | error_text = await response.text() 202 | self.logger.error(f"API error: {response.status} - {error_text}") 203 | raise Exception(f"API error: {response.status} - {error_text}") 204 | 205 | return await response.read() 206 | except Exception as e: 207 | self.logger.exception(f"Error in API request to {url}: {str(e)}") 208 | raise 209 | 210 | # Project management methods 211 | 212 | async def get_projects(self, search_val: Optional[str] = None) -> Dict[str, Any]: 213 | """Get a list of projects. 214 | 215 | Args: 216 | search_val: Optional search value to filter projects by name 217 | 218 | Returns: 219 | Response from the API 220 | """ 221 | params = {} 222 | if search_val: 223 | params["searchVal"] = search_val 224 | 225 | return await self.request("GET", "projects", params=params) 226 | 227 | async def get_project(self, project_code: int) -> Dict[str, Any]: 228 | """Get project details. 229 | 230 | Args: 231 | project_code: Project code 232 | 233 | Returns: 234 | Response from the API 235 | """ 236 | return await self.request("GET", f"projects/{project_code}") 237 | 238 | async def create_project(self, name: str, description: str = "") -> Dict[str, Any]: 239 | """Create a new project. 240 | 241 | Args: 242 | name: Project name 243 | description: Project description 244 | 245 | Returns: 246 | Response from the API 247 | """ 248 | data = { 249 | "projectName": name 250 | } 251 | if description: 252 | data["description"] = description 253 | 254 | return await self.request("POST", "projects", json_data=data) 255 | 256 | async def update_project(self, project_code: int, name: str, description: str = "") -> Dict[str, Any]: 257 | """Update a project. 258 | 259 | Args: 260 | project_code: Project code 261 | name: Project name 262 | description: Project description 263 | 264 | Returns: 265 | Response from the API 266 | """ 267 | params = { 268 | "projectName": name 269 | } 270 | if description: 271 | params["description"] = description 272 | 273 | return await self.request("PUT", f"projects/{project_code}", params=params) 274 | 275 | async def delete_project(self, project_code: int) -> Dict[str, Any]: 276 | """Delete a project. 277 | 278 | Args: 279 | project_code: Project code 280 | 281 | Returns: 282 | Response from the API 283 | """ 284 | return await self.request("DELETE", f"projects/{project_code}") ``` -------------------------------------------------------------------------------- /mcp-openapi-split/paths/03_kubernetes_namespace_api.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "paths": { 3 | "/k8s-namespace": { 4 | "get": { 5 | "tags": [ 6 | "K8S命名空间相关操作" 7 | ], 8 | "summary": "queryNamespaceListPaging", 9 | "description": "查询命名空间列表页面", 10 | "operationId": "queryNamespaceListPaging", 11 | "parameters": [ 12 | { 13 | "name": "searchVal", 14 | "in": "query", 15 | "description": "搜索值", 16 | "required": false, 17 | "schema": { 18 | "type": "string" 19 | } 20 | }, 21 | { 22 | "name": "pageSize", 23 | "in": "query", 24 | "description": "页大小", 25 | "required": true, 26 | "schema": { 27 | "type": "integer", 28 | "format": "int32" 29 | } 30 | }, 31 | { 32 | "name": "pageNo", 33 | "in": "query", 34 | "description": "页码号", 35 | "required": true, 36 | "schema": { 37 | "type": "integer", 38 | "format": "int32" 39 | } 40 | } 41 | ], 42 | "responses": { 43 | "200": { 44 | "description": "OK", 45 | "content": { 46 | "*/*": { 47 | "schema": { 48 | "$ref": "#/components/schemas/Result" 49 | } 50 | } 51 | } 52 | } 53 | } 54 | }, 55 | "post": { 56 | "tags": [ 57 | "K8S命名空间相关操作" 58 | ], 59 | "summary": "createK8sNamespace", 60 | "description": "创建命名空间", 61 | "operationId": "createNamespace", 62 | "parameters": [ 63 | { 64 | "name": "namespace", 65 | "in": "query", 66 | "description": "命名空间", 67 | "required": true, 68 | "schema": { 69 | "type": "string" 70 | } 71 | }, 72 | { 73 | "name": "clusterCode", 74 | "in": "query", 75 | "description": "集群代码", 76 | "required": true, 77 | "schema": { 78 | "type": "integer", 79 | "format": "int64" 80 | } 81 | } 82 | ], 83 | "responses": { 84 | "201": { 85 | "description": "Created", 86 | "content": { 87 | "*/*": { 88 | "schema": { 89 | "$ref": "#/components/schemas/Result" 90 | } 91 | } 92 | } 93 | } 94 | } 95 | } 96 | }, 97 | "/k8s-namespace/verify": { 98 | "post": { 99 | "tags": [ 100 | "K8S命名空间相关操作" 101 | ], 102 | "summary": "verifyNamespaceK8s", 103 | "description": "校验命名空间", 104 | "operationId": "verifyNamespace", 105 | "parameters": [ 106 | { 107 | "name": "namespace", 108 | "in": "query", 109 | "description": "命名空间", 110 | "required": true, 111 | "schema": { 112 | "type": "string" 113 | } 114 | }, 115 | { 116 | "name": "clusterCode", 117 | "in": "query", 118 | "description": "集群代码", 119 | "required": true, 120 | "schema": { 121 | "type": "integer", 122 | "format": "int64" 123 | } 124 | } 125 | ], 126 | "responses": { 127 | "200": { 128 | "description": "OK", 129 | "content": { 130 | "*/*": { 131 | "schema": { 132 | "$ref": "#/components/schemas/Result" 133 | } 134 | } 135 | } 136 | } 137 | } 138 | } 139 | }, 140 | "/k8s-namespace/delete": { 141 | "post": { 142 | "tags": [ 143 | "K8S命名空间相关操作" 144 | ], 145 | "summary": "delNamespaceById", 146 | "description": "通过ID删除命名空间", 147 | "operationId": "delNamespaceById", 148 | "parameters": [ 149 | { 150 | "name": "id", 151 | "in": "query", 152 | "description": "k8s命名空间ID", 153 | "required": true, 154 | "schema": { 155 | "type": "integer", 156 | "format": "int32" 157 | } 158 | } 159 | ], 160 | "responses": { 161 | "200": { 162 | "description": "OK", 163 | "content": { 164 | "*/*": { 165 | "schema": { 166 | "$ref": "#/components/schemas/Result" 167 | } 168 | } 169 | } 170 | } 171 | } 172 | } 173 | }, 174 | "/k8s-namespace/unauth-namespace": { 175 | "get": { 176 | "tags": [ 177 | "K8S命名空间相关操作" 178 | ], 179 | "summary": "queryUnauthorizedNamespace", 180 | "description": "查询未授权命名空间", 181 | "operationId": "queryUnauthorizedNamespace", 182 | "parameters": [ 183 | { 184 | "name": "userId", 185 | "in": "query", 186 | "description": "用户ID", 187 | "required": true, 188 | "schema": { 189 | "type": "integer", 190 | "format": "int32" 191 | } 192 | } 193 | ], 194 | "responses": { 195 | "200": { 196 | "description": "OK", 197 | "content": { 198 | "*/*": { 199 | "schema": { 200 | "$ref": "#/components/schemas/Result" 201 | } 202 | } 203 | } 204 | } 205 | } 206 | } 207 | }, 208 | "/k8s-namespace/available-list": { 209 | "get": { 210 | "tags": [ 211 | "K8S命名空间相关操作" 212 | ], 213 | "summary": "queryAvailableNamespaceList", 214 | "description": "查询可用命名空间列表", 215 | "operationId": "queryAvailableNamespaceList", 216 | "responses": { 217 | "200": { 218 | "description": "OK", 219 | "content": { 220 | "*/*": { 221 | "schema": { 222 | "$ref": "#/components/schemas/Result" 223 | } 224 | } 225 | } 226 | } 227 | } 228 | } 229 | }, 230 | "/k8s-namespace/authed-namespace": { 231 | "get": { 232 | "tags": [ 233 | "K8S命名空间相关操作" 234 | ], 235 | "summary": "queryAuthorizedNamespace", 236 | "description": "查询授权命名空间", 237 | "operationId": "queryAuthorizedNamespace", 238 | "parameters": [ 239 | { 240 | "name": "userId", 241 | "in": "query", 242 | "description": "用户ID", 243 | "required": true, 244 | "schema": { 245 | "type": "integer", 246 | "format": "int32" 247 | } 248 | } 249 | ], 250 | "responses": { 251 | "200": { 252 | "description": "OK", 253 | "content": { 254 | "*/*": { 255 | "schema": { 256 | "$ref": "#/components/schemas/Result" 257 | } 258 | } 259 | } 260 | } 261 | } 262 | } 263 | } 264 | } 265 | } ``` -------------------------------------------------------------------------------- /mcp-openapi-split/paths/20_data_quality_api.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "paths": { 3 | "/data-quality/ruleList": { 4 | "get": { 5 | "tags": [ 6 | "数据质量相关操作" 7 | ], 8 | "summary": "queryRuleList", 9 | "description": "查询规则列表", 10 | "operationId": "queryRuleList", 11 | "responses": { 12 | "200": { 13 | "description": "OK", 14 | "content": { 15 | "*/*": { 16 | "schema": { 17 | "$ref": "#/components/schemas/ResultListDqRule" 18 | } 19 | } 20 | } 21 | } 22 | } 23 | } 24 | }, 25 | "/data-quality/rule/page": { 26 | "get": { 27 | "tags": [ 28 | "数据质量相关操作" 29 | ], 30 | "summary": "queryRuleListPaging", 31 | "description": "查询规则分页列表", 32 | "operationId": "queryRuleListPaging", 33 | "parameters": [ 34 | { 35 | "name": "searchVal", 36 | "in": "query", 37 | "description": "搜索值", 38 | "required": false, 39 | "schema": { 40 | "type": "string" 41 | } 42 | }, 43 | { 44 | "name": "ruleType", 45 | "in": "query", 46 | "description": "规则类型", 47 | "required": false, 48 | "schema": { 49 | "type": "integer", 50 | "format": "int32" 51 | } 52 | }, 53 | { 54 | "name": "startDate", 55 | "in": "query", 56 | "description": "开始时间", 57 | "required": false, 58 | "schema": { 59 | "type": "string" 60 | } 61 | }, 62 | { 63 | "name": "endDate", 64 | "in": "query", 65 | "description": "结束时间", 66 | "required": false, 67 | "schema": { 68 | "type": "string" 69 | } 70 | }, 71 | { 72 | "name": "pageNo", 73 | "in": "query", 74 | "description": "页码号", 75 | "required": true, 76 | "schema": { 77 | "type": "integer", 78 | "format": "int32" 79 | } 80 | }, 81 | { 82 | "name": "pageSize", 83 | "in": "query", 84 | "description": "页大小", 85 | "required": true, 86 | "schema": { 87 | "type": "integer", 88 | "format": "int32" 89 | } 90 | } 91 | ], 92 | "responses": { 93 | "200": { 94 | "description": "OK", 95 | "content": { 96 | "*/*": { 97 | "schema": { 98 | "$ref": "#/components/schemas/ResultPageInfoDqRule" 99 | } 100 | } 101 | } 102 | } 103 | } 104 | } 105 | }, 106 | "/data-quality/result/page": { 107 | "get": { 108 | "tags": [ 109 | "数据质量相关操作" 110 | ], 111 | "summary": "queryExecuteResultListPaging", 112 | "description": "查询数据质量任务结果分页列表", 113 | "operationId": "queryExecuteResultListPaging", 114 | "parameters": [ 115 | { 116 | "name": "searchVal", 117 | "in": "query", 118 | "description": "搜索值", 119 | "required": false, 120 | "schema": { 121 | "type": "string" 122 | } 123 | }, 124 | { 125 | "name": "ruleType", 126 | "in": "query", 127 | "description": "规则类型", 128 | "required": false, 129 | "schema": { 130 | "type": "integer", 131 | "format": "int32" 132 | } 133 | }, 134 | { 135 | "name": "state", 136 | "in": "query", 137 | "description": "状态", 138 | "required": false, 139 | "schema": { 140 | "type": "integer", 141 | "format": "int32" 142 | } 143 | }, 144 | { 145 | "name": "startDate", 146 | "in": "query", 147 | "description": "开始时间", 148 | "required": false, 149 | "schema": { 150 | "type": "string" 151 | } 152 | }, 153 | { 154 | "name": "endDate", 155 | "in": "query", 156 | "description": "结束时间", 157 | "required": false, 158 | "schema": { 159 | "type": "string" 160 | } 161 | }, 162 | { 163 | "name": "pageNo", 164 | "in": "query", 165 | "description": "页码号", 166 | "required": true, 167 | "schema": { 168 | "type": "integer", 169 | "format": "int32" 170 | } 171 | }, 172 | { 173 | "name": "pageSize", 174 | "in": "query", 175 | "description": "页大小", 176 | "required": true, 177 | "schema": { 178 | "type": "integer", 179 | "format": "int32" 180 | } 181 | } 182 | ], 183 | "responses": { 184 | "200": { 185 | "description": "OK", 186 | "content": { 187 | "*/*": { 188 | "schema": { 189 | "$ref": "#/components/schemas/ResultPageInfoDqExecuteResult" 190 | } 191 | } 192 | } 193 | } 194 | } 195 | } 196 | }, 197 | "/data-quality/getRuleFormCreateJson": { 198 | "get": { 199 | "tags": [ 200 | "数据质量相关操作" 201 | ], 202 | "summary": "getRuleFormCreateJson", 203 | "description": "获取规则form-create json", 204 | "operationId": "getRuleFormCreateJsonById", 205 | "parameters": [ 206 | { 207 | "name": "ruleId", 208 | "in": "query", 209 | "description": "规则ID", 210 | "required": true, 211 | "schema": { 212 | "type": "integer", 213 | "format": "int32" 214 | } 215 | } 216 | ], 217 | "responses": { 218 | "200": { 219 | "description": "OK", 220 | "content": { 221 | "*/*": { 222 | "schema": { 223 | "$ref": "#/components/schemas/ResultString" 224 | } 225 | } 226 | } 227 | } 228 | } 229 | } 230 | }, 231 | "/data-quality/getDatasourceOptionsById": { 232 | "get": { 233 | "tags": [ 234 | "数据质量相关操作" 235 | ], 236 | "summary": "getDatasourceOptionsById", 237 | "description": "获取数据源OPTIONS", 238 | "operationId": "getDatasourceOptionsById", 239 | "parameters": [ 240 | { 241 | "name": "datasourceId", 242 | "in": "query", 243 | "description": "数据源ID", 244 | "required": true, 245 | "schema": { 246 | "type": "integer", 247 | "format": "int32" 248 | } 249 | } 250 | ], 251 | "responses": { 252 | "200": { 253 | "description": "OK", 254 | "content": { 255 | "*/*": { 256 | "schema": { 257 | "$ref": "#/components/schemas/ResultListParamsOptions" 258 | } 259 | } 260 | } 261 | } 262 | } 263 | } 264 | } 265 | } 266 | } ``` -------------------------------------------------------------------------------- /mcp-openapi-split/paths/30_token_api.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "paths": { 3 | "/access-tokens/{id}": { 4 | "put": { 5 | "tags": [ 6 | "访问token相关操作" 7 | ], 8 | "summary": "updateToken", 9 | "description": "更新指定用户的安全令牌", 10 | "operationId": "updateToken", 11 | "parameters": [ 12 | { 13 | "name": "id", 14 | "in": "path", 15 | "description": "安全令牌的ID", 16 | "required": true, 17 | "schema": { 18 | "type": "integer", 19 | "format": "int32" 20 | } 21 | }, 22 | { 23 | "name": "userId", 24 | "in": "query", 25 | "description": "用户ID", 26 | "required": true, 27 | "schema": { 28 | "type": "integer", 29 | "format": "int32" 30 | } 31 | }, 32 | { 33 | "name": "expireTime", 34 | "in": "query", 35 | "description": "安全令牌的过期时间", 36 | "required": true, 37 | "schema": { 38 | "type": "string" 39 | }, 40 | "example": "2021-12-31 00:00:00" 41 | }, 42 | { 43 | "name": "token", 44 | "in": "query", 45 | "description": "安全令牌字符串,若未显式指定将会自动生成", 46 | "required": false, 47 | "schema": { 48 | "type": "string" 49 | }, 50 | "example": "xxxx" 51 | } 52 | ], 53 | "responses": { 54 | "200": { 55 | "description": "OK", 56 | "content": { 57 | "*/*": { 58 | "schema": { 59 | "$ref": "#/components/schemas/ResultAccessToken" 60 | } 61 | } 62 | } 63 | } 64 | } 65 | }, 66 | "delete": { 67 | "tags": [ 68 | "访问token相关操作" 69 | ], 70 | "summary": "deleteToken", 71 | "description": "DELETE_TOKEN_NOTES", 72 | "operationId": "delAccessTokenById", 73 | "parameters": [ 74 | { 75 | "name": "id", 76 | "in": "path", 77 | "required": true, 78 | "schema": { 79 | "type": "integer", 80 | "format": "int32" 81 | } 82 | } 83 | ], 84 | "responses": { 85 | "200": { 86 | "description": "OK", 87 | "content": { 88 | "*/*": { 89 | "schema": { 90 | "$ref": "#/components/schemas/ResultBoolean" 91 | } 92 | } 93 | } 94 | } 95 | } 96 | } 97 | }, 98 | "/access-tokens": { 99 | "get": { 100 | "tags": [ 101 | "访问token相关操作" 102 | ], 103 | "summary": "queryAccessTokenList", 104 | "description": "分页查询access token列表", 105 | "operationId": "queryAccessTokenList", 106 | "parameters": [ 107 | { 108 | "name": "pageNo", 109 | "in": "query", 110 | "description": "页码号", 111 | "required": true, 112 | "schema": { 113 | "type": "integer", 114 | "format": "int32" 115 | }, 116 | "example": 1 117 | }, 118 | { 119 | "name": "searchVal", 120 | "in": "query", 121 | "description": "搜索值", 122 | "required": false, 123 | "schema": { 124 | "type": "string" 125 | } 126 | }, 127 | { 128 | "name": "pageSize", 129 | "in": "query", 130 | "description": "页大小", 131 | "required": true, 132 | "schema": { 133 | "type": "integer", 134 | "format": "int32" 135 | }, 136 | "example": 20 137 | } 138 | ], 139 | "responses": { 140 | "200": { 141 | "description": "OK", 142 | "content": { 143 | "*/*": { 144 | "schema": { 145 | "$ref": "#/components/schemas/ResultPageInfoAccessToken" 146 | } 147 | } 148 | } 149 | } 150 | } 151 | }, 152 | "post": { 153 | "tags": [ 154 | "访问token相关操作" 155 | ], 156 | "summary": "createToken", 157 | "description": "为指定用户创建安全令牌", 158 | "operationId": "createToken", 159 | "parameters": [ 160 | { 161 | "name": "userId", 162 | "in": "query", 163 | "description": "用户ID", 164 | "required": true, 165 | "schema": { 166 | "type": "integer", 167 | "format": "int32" 168 | } 169 | }, 170 | { 171 | "name": "expireTime", 172 | "in": "query", 173 | "description": "安全令牌的过期时间", 174 | "required": true, 175 | "schema": { 176 | "type": "string" 177 | }, 178 | "example": "2021-12-31 00:00:00" 179 | }, 180 | { 181 | "name": "token", 182 | "in": "query", 183 | "description": "安全令牌字符串,若未显式指定将会自动生成", 184 | "required": false, 185 | "schema": { 186 | "type": "string" 187 | }, 188 | "example": "xxxx" 189 | } 190 | ], 191 | "responses": { 192 | "201": { 193 | "description": "Created", 194 | "content": { 195 | "*/*": { 196 | "schema": { 197 | "$ref": "#/components/schemas/ResultAccessToken" 198 | } 199 | } 200 | } 201 | } 202 | } 203 | } 204 | }, 205 | "/access-tokens/generate": { 206 | "post": { 207 | "tags": [ 208 | "访问token相关操作" 209 | ], 210 | "operationId": "generateToken", 211 | "parameters": [ 212 | { 213 | "name": "userId", 214 | "in": "query", 215 | "required": true, 216 | "schema": { 217 | "type": "integer", 218 | "format": "int32" 219 | } 220 | }, 221 | { 222 | "name": "expireTime", 223 | "in": "query", 224 | "required": true, 225 | "schema": { 226 | "type": "string" 227 | } 228 | } 229 | ], 230 | "responses": { 231 | "201": { 232 | "description": "Created", 233 | "content": { 234 | "*/*": { 235 | "schema": { 236 | "$ref": "#/components/schemas/ResultString" 237 | } 238 | } 239 | } 240 | } 241 | } 242 | } 243 | }, 244 | "/access-tokens/user/{userId}": { 245 | "get": { 246 | "tags": [ 247 | "访问token相关操作" 248 | ], 249 | "summary": "queryAccessTokenByUser", 250 | "description": "查询指定用户的access token", 251 | "operationId": "queryAccessTokenByUser", 252 | "parameters": [ 253 | { 254 | "name": "userId", 255 | "in": "path", 256 | "description": "用户ID", 257 | "required": true, 258 | "schema": { 259 | "type": "integer", 260 | "format": "int32" 261 | } 262 | } 263 | ], 264 | "responses": { 265 | "200": { 266 | "description": "OK", 267 | "content": { 268 | "*/*": { 269 | "schema": { 270 | "$ref": "#/components/schemas/ResultListAccessToken" 271 | } 272 | } 273 | } 274 | } 275 | } 276 | } 277 | } 278 | } 279 | } ``` -------------------------------------------------------------------------------- /src/dolphinscheduler_mcp/tools_generated/project_parameter_tools.py: -------------------------------------------------------------------------------- ```python 1 | """Tools for project parameter operations in DolphinScheduler.""" 2 | 3 | from typing import Dict, List, Optional 4 | 5 | from ..fastmcp_compat import FastMCPTool 6 | 7 | from ..client import DolphinSchedulerClient 8 | 9 | 10 | class GetProjectsProjectParameter(FastMCPTool): 11 | """Tool to 查询项目参数""" 12 | 13 | name = "get_projects_project_parameter" 14 | description = "查询项目参数" 15 | is_async = True 16 | schema = { 17 | "type": "object", 18 | "properties": { 19 | "project_code": { 20 | "type": "integer", 21 | "format": "int64", 22 | "description": "\u9879\u76eeCode" 23 | }, 24 | "code": { 25 | "type": "integer", 26 | "format": "int64", 27 | "description": "\u9879\u76ee\u53c2\u6570code" 28 | } 29 | }, 30 | "required": [ 31 | "project_code", 32 | "code" 33 | ] 34 | } 35 | 36 | async def _run(self, project_code, code) -> Dict: 37 | """Execute the GET operation on /projects/{projectCode}/project-parameter/{code}.""" 38 | client = DolphinSchedulerClient() 39 | try: 40 | response = await client.request( 41 | "GET", 42 | f"/projects/{project_code}/project-parameter/{code}" 43 | ) 44 | return {"success": True, "data": response} 45 | finally: 46 | await client.close() 47 | 48 | 49 | class UpdateProjectsProjectParameter(FastMCPTool): 50 | """Tool to 更新项目参数""" 51 | 52 | name = "update_projects_project_parameter" 53 | description = "更新项目参数" 54 | is_async = True 55 | schema = { 56 | "type": "object", 57 | "properties": { 58 | "project_code": { 59 | "type": "integer", 60 | "format": "int64", 61 | "description": "\u9879\u76eeCode" 62 | }, 63 | "code": { 64 | "type": "integer", 65 | "format": "int64", 66 | "description": "\u9879\u76ee\u53c2\u6570code" 67 | }, 68 | "project_parameter_name": { 69 | "type": "string", 70 | "description": "\u9879\u76ee\u53c2\u6570\u540d\u79f0" 71 | }, 72 | "project_parameter_value": { 73 | "type": "string", 74 | "description": "\u9879\u76ee\u53c2\u6570\u503c" 75 | } 76 | }, 77 | "required": [ 78 | "project_code", 79 | "code", 80 | "project_parameter_name", 81 | "project_parameter_value" 82 | ] 83 | } 84 | 85 | async def _run(self, project_code, code, project_parameter_name, project_parameter_value) -> Dict: 86 | """Execute the PUT operation on /projects/{projectCode}/project-parameter/{code}.""" 87 | client = DolphinSchedulerClient() 88 | try: 89 | params = { 90 | "projectParameterName": project_parameter_name, 91 | "projectParameterValue": project_parameter_value, 92 | } 93 | response = await client.request( 94 | "PUT", 95 | f"/projects/{project_code}/project-parameter/{code}", params=params 96 | ) 97 | return {"success": True, "data": response} 98 | finally: 99 | await client.close() 100 | 101 | 102 | class GetProjectsProjectParameter2(FastMCPTool): 103 | """Tool to 分页查询项目参数""" 104 | 105 | name = "get_projects_project_parameter2" 106 | description = "分页查询项目参数" 107 | is_async = True 108 | schema = { 109 | "type": "object", 110 | "properties": { 111 | "project_code": { 112 | "type": "integer", 113 | "format": "int64", 114 | "description": "\u9879\u76eeCode" 115 | }, 116 | "search_val": { 117 | "type": "string", 118 | "description": "\u641c\u7d22\u503c" 119 | }, 120 | "page_no": { 121 | "type": "integer", 122 | "format": "int32", 123 | "description": "\u9875\u7801\u53f7" 124 | }, 125 | "page_size": { 126 | "type": "integer", 127 | "format": "int32", 128 | "description": "\u9875\u5927\u5c0f" 129 | } 130 | }, 131 | "required": [ 132 | "project_code", 133 | "page_no", 134 | "page_size" 135 | ] 136 | } 137 | 138 | async def _run(self, project_code, search_val, page_no, page_size) -> Dict: 139 | """Execute the GET operation on /projects/{projectCode}/project-parameter.""" 140 | client = DolphinSchedulerClient() 141 | try: 142 | params = { 143 | "searchVal": search_val, 144 | "pageNo": page_no, 145 | "pageSize": page_size, 146 | } 147 | response = await client.request( 148 | "GET", 149 | f"/projects/{project_code}/project-parameter", params=params 150 | ) 151 | return {"success": True, "data": response} 152 | finally: 153 | await client.close() 154 | 155 | 156 | class CreateProjectsProjectParameter(FastMCPTool): 157 | """Tool to 新增项目参数""" 158 | 159 | name = "create_projects_project_parameter" 160 | description = "新增项目参数" 161 | is_async = True 162 | schema = { 163 | "type": "object", 164 | "properties": { 165 | "project_code": { 166 | "type": "integer", 167 | "format": "int64", 168 | "description": "\u9879\u76eeCode" 169 | }, 170 | "project_parameter_name": { 171 | "type": "string", 172 | "description": "\u9879\u76ee\u53c2\u6570\u540d\u79f0" 173 | }, 174 | "project_parameter_value": { 175 | "type": "string", 176 | "description": "\u9879\u76ee\u53c2\u6570\u503c" 177 | } 178 | }, 179 | "required": [ 180 | "project_code", 181 | "project_parameter_name", 182 | "project_parameter_value" 183 | ] 184 | } 185 | 186 | async def _run(self, project_code, project_parameter_name, project_parameter_value) -> Dict: 187 | """Execute the POST operation on /projects/{projectCode}/project-parameter.""" 188 | client = DolphinSchedulerClient() 189 | try: 190 | params = { 191 | "projectParameterName": project_parameter_name, 192 | "projectParameterValue": project_parameter_value, 193 | } 194 | response = await client.request( 195 | "POST", 196 | f"/projects/{project_code}/project-parameter", params=params 197 | ) 198 | return {"success": True, "data": response} 199 | finally: 200 | await client.close() 201 | 202 | 203 | class CreateProjectsProjectParameterDelete(FastMCPTool): 204 | """Tool to 删除项目参数""" 205 | 206 | name = "create_projects_project_parameter_delete" 207 | description = "删除项目参数" 208 | is_async = True 209 | schema = { 210 | "type": "object", 211 | "properties": { 212 | "project_code": { 213 | "type": "integer", 214 | "format": "int64", 215 | "description": "\u9879\u76eeCode" 216 | }, 217 | "code": { 218 | "type": "string", 219 | "description": "\u9879\u76ee\u53c2\u6570code" 220 | } 221 | }, 222 | "required": [ 223 | "project_code", 224 | "code" 225 | ] 226 | } 227 | 228 | async def _run(self, project_code, code) -> Dict: 229 | """Execute the POST operation on /projects/{projectCode}/project-parameter/delete.""" 230 | client = DolphinSchedulerClient() 231 | try: 232 | params = { 233 | "code": code, 234 | } 235 | response = await client.request( 236 | "POST", 237 | f"/projects/{project_code}/project-parameter/delete", params=params 238 | ) 239 | return {"success": True, "data": response} 240 | finally: 241 | await client.close() 242 | 243 | 244 | class CreateProjectsProjectParameterBatchDelete(FastMCPTool): 245 | """Tool to 删除项目参数""" 246 | 247 | name = "create_projects_project_parameter_batch_delete" 248 | description = "删除项目参数" 249 | is_async = True 250 | schema = { 251 | "type": "object", 252 | "properties": { 253 | "project_code": { 254 | "type": "integer", 255 | "format": "int64", 256 | "description": "\u9879\u76eeCode" 257 | }, 258 | "codes": { 259 | "type": "string", 260 | "description": "\u9879\u76ee\u53c2\u6570code" 261 | } 262 | }, 263 | "required": [ 264 | "project_code", 265 | "codes" 266 | ] 267 | } 268 | 269 | async def _run(self, project_code, codes) -> Dict: 270 | """Execute the POST operation on /projects/{projectCode}/project-parameter/batch-delete.""" 271 | client = DolphinSchedulerClient() 272 | try: 273 | params = { 274 | "codes": codes, 275 | } 276 | response = await client.request( 277 | "POST", 278 | f"/projects/{project_code}/project-parameter/batch-delete", params=params 279 | ) 280 | return {"success": True, "data": response} 281 | finally: 282 | await client.close() 283 | 284 | 285 | def register_project_parameter_tools(mcp): 286 | """Register project parameter tools with FastMCP. 287 | 288 | Args: 289 | mcp: The FastMCP instance to register tools with. 290 | """ 291 | from ..fastmcp_compat import register_tool_class 292 | 293 | register_tool_class(mcp, CreateProjectsProjectParameter) 294 | register_tool_class(mcp, CreateProjectsProjectParameterBatchDelete) 295 | register_tool_class(mcp, CreateProjectsProjectParameterDelete) 296 | register_tool_class(mcp, GetProjectsProjectParameter) 297 | register_tool_class(mcp, GetProjectsProjectParameter2) 298 | register_tool_class(mcp, UpdateProjectsProjectParameter) 299 | ``` -------------------------------------------------------------------------------- /mcp-openapi-split/paths/33_cluster_api.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "paths": { 3 | "/cluster/verify-cluster": { 4 | "post": { 5 | "tags": [ 6 | "集群相关操作" 7 | ], 8 | "summary": "verifyCluster", 9 | "description": "校验集群", 10 | "operationId": "verifyCluster", 11 | "parameters": [ 12 | { 13 | "name": "clusterName", 14 | "in": "query", 15 | "description": "集群名称", 16 | "required": true, 17 | "schema": { 18 | "type": "string" 19 | } 20 | } 21 | ], 22 | "responses": { 23 | "200": { 24 | "description": "OK", 25 | "content": { 26 | "*/*": { 27 | "schema": { 28 | "$ref": "#/components/schemas/ResultBoolean" 29 | } 30 | } 31 | } 32 | } 33 | } 34 | } 35 | }, 36 | "/cluster/update": { 37 | "post": { 38 | "tags": [ 39 | "集群相关操作" 40 | ], 41 | "summary": "updateCluster", 42 | "description": "更新集群", 43 | "operationId": "updateCluster", 44 | "parameters": [ 45 | { 46 | "name": "code", 47 | "in": "query", 48 | "description": "集群代码", 49 | "required": true, 50 | "schema": { 51 | "type": "integer", 52 | "format": "int64" 53 | } 54 | }, 55 | { 56 | "name": "name", 57 | "in": "query", 58 | "description": "集群名称", 59 | "required": true, 60 | "schema": { 61 | "type": "string" 62 | } 63 | }, 64 | { 65 | "name": "config", 66 | "in": "query", 67 | "description": "集群配置", 68 | "required": true, 69 | "schema": { 70 | "type": "string" 71 | } 72 | }, 73 | { 74 | "name": "description", 75 | "in": "query", 76 | "description": "集群描述", 77 | "required": false, 78 | "schema": { 79 | "type": "string" 80 | } 81 | } 82 | ], 83 | "responses": { 84 | "200": { 85 | "description": "OK", 86 | "content": { 87 | "*/*": { 88 | "schema": { 89 | "$ref": "#/components/schemas/ResultCluster" 90 | } 91 | } 92 | } 93 | } 94 | } 95 | } 96 | }, 97 | "/cluster/delete": { 98 | "post": { 99 | "tags": [ 100 | "集群相关操作" 101 | ], 102 | "summary": "deleteClusterByCode", 103 | "description": "通过集群代码删除集群", 104 | "operationId": "deleteCluster", 105 | "parameters": [ 106 | { 107 | "name": "clusterCode", 108 | "in": "query", 109 | "description": "集群代码", 110 | "required": true, 111 | "schema": { 112 | "type": "integer", 113 | "format": "int64" 114 | } 115 | } 116 | ], 117 | "responses": { 118 | "200": { 119 | "description": "OK", 120 | "content": { 121 | "*/*": { 122 | "schema": { 123 | "$ref": "#/components/schemas/ResultBoolean" 124 | } 125 | } 126 | } 127 | } 128 | } 129 | } 130 | }, 131 | "/cluster/create": { 132 | "post": { 133 | "tags": [ 134 | "集群相关操作" 135 | ], 136 | "summary": "createCluster", 137 | "description": "创建集群", 138 | "operationId": "createCluster", 139 | "parameters": [ 140 | { 141 | "name": "name", 142 | "in": "query", 143 | "description": "集群名称", 144 | "required": true, 145 | "schema": { 146 | "type": "string" 147 | } 148 | }, 149 | { 150 | "name": "config", 151 | "in": "query", 152 | "description": "集群配置", 153 | "required": true, 154 | "schema": { 155 | "type": "string" 156 | } 157 | }, 158 | { 159 | "name": "description", 160 | "in": "query", 161 | "description": "集群描述", 162 | "required": false, 163 | "schema": { 164 | "type": "string" 165 | } 166 | } 167 | ], 168 | "responses": { 169 | "201": { 170 | "description": "Created", 171 | "content": { 172 | "*/*": { 173 | "schema": { 174 | "$ref": "#/components/schemas/ResultLong" 175 | } 176 | } 177 | } 178 | } 179 | } 180 | } 181 | }, 182 | "/cluster/query-cluster-list": { 183 | "get": { 184 | "tags": [ 185 | "集群相关操作" 186 | ], 187 | "summary": "queryAllClusterList", 188 | "description": "查询所有集群列表", 189 | "operationId": "queryAllClusterList", 190 | "responses": { 191 | "200": { 192 | "description": "OK", 193 | "content": { 194 | "*/*": { 195 | "schema": { 196 | "$ref": "#/components/schemas/ResultListClusterDto" 197 | } 198 | } 199 | } 200 | } 201 | } 202 | } 203 | }, 204 | "/cluster/query-by-code": { 205 | "get": { 206 | "tags": [ 207 | "集群相关操作" 208 | ], 209 | "summary": "queryClusterByCode", 210 | "description": "通过集群ID查询集群", 211 | "operationId": "queryClusterByCode", 212 | "parameters": [ 213 | { 214 | "name": "clusterCode", 215 | "in": "query", 216 | "description": "集群代码", 217 | "required": true, 218 | "schema": { 219 | "type": "integer", 220 | "format": "int64" 221 | } 222 | } 223 | ], 224 | "responses": { 225 | "200": { 226 | "description": "OK", 227 | "content": { 228 | "*/*": { 229 | "schema": { 230 | "$ref": "#/components/schemas/ResultClusterDto" 231 | } 232 | } 233 | } 234 | } 235 | } 236 | } 237 | }, 238 | "/cluster/list-paging": { 239 | "get": { 240 | "tags": [ 241 | "集群相关操作" 242 | ], 243 | "summary": "queryClusterListPaging", 244 | "description": "查询集群分页列表", 245 | "operationId": "queryClusterListPaging", 246 | "parameters": [ 247 | { 248 | "name": "searchVal", 249 | "in": "query", 250 | "description": "搜索值", 251 | "required": false, 252 | "schema": { 253 | "type": "string" 254 | } 255 | }, 256 | { 257 | "name": "pageSize", 258 | "in": "query", 259 | "description": "页大小", 260 | "required": true, 261 | "schema": { 262 | "type": "integer", 263 | "format": "int32" 264 | } 265 | }, 266 | { 267 | "name": "pageNo", 268 | "in": "query", 269 | "description": "页码号", 270 | "required": true, 271 | "schema": { 272 | "type": "integer", 273 | "format": "int32" 274 | } 275 | } 276 | ], 277 | "responses": { 278 | "200": { 279 | "description": "OK", 280 | "content": { 281 | "*/*": { 282 | "schema": { 283 | "$ref": "#/components/schemas/ResultPageInfoClusterDto" 284 | } 285 | } 286 | } 287 | } 288 | } 289 | } 290 | } 291 | } 292 | } ``` -------------------------------------------------------------------------------- /mcp-openapi-split/utils/split_openapi.py: -------------------------------------------------------------------------------- ```python 1 | #!/usr/bin/env python3 2 | """ 3 | Split DolphinScheduler OpenAPI specification into multiple smaller files. 4 | """ 5 | import json 6 | import os 7 | import re 8 | from collections import defaultdict 9 | 10 | # Input file 11 | INPUT_FILE = '../ds-restfuleapi-v1.json' 12 | 13 | # Output directories 14 | BASE_DIR = 'base' 15 | PATHS_DIR = 'paths' 16 | SCHEMAS_DIR = 'schemas' 17 | COMBINED_DIR = 'combined' 18 | 19 | def ensure_directories(): 20 | """Ensure all necessary directories exist.""" 21 | for directory in [BASE_DIR, PATHS_DIR, SCHEMAS_DIR, COMBINED_DIR]: 22 | os.makedirs(directory, exist_ok=True) 23 | 24 | def load_openapi(): 25 | """Load the OpenAPI JSON file.""" 26 | with open(INPUT_FILE, 'r', encoding='utf-8') as f: 27 | return json.load(f) 28 | 29 | def save_json(data, filename): 30 | """Save JSON data to a file with nice formatting.""" 31 | with open(filename, 'w', encoding='utf-8') as f: 32 | json.dump(data, f, ensure_ascii=False, indent=4) 33 | 34 | def save_base_info(openapi): 35 | """Save the base OpenAPI information.""" 36 | base_info = { 37 | "openapi": openapi["openapi"], 38 | "info": openapi["info"], 39 | "servers": openapi["servers"] 40 | } 41 | save_json(base_info, os.path.join(BASE_DIR, "01_base.json")) 42 | 43 | def group_paths_by_tag(openapi): 44 | """Group API paths by their tags.""" 45 | tag_paths = defaultdict(dict) 46 | 47 | # Group paths by the first tag 48 | for path, path_item in openapi["paths"].items(): 49 | tag = None 50 | 51 | # Find the first operation with tags 52 | for method, operation in path_item.items(): 53 | if "tags" in operation and operation["tags"]: 54 | tag = operation["tags"][0] 55 | break 56 | 57 | # If no tag found, use "misc" 58 | if not tag: 59 | tag = "misc" 60 | 61 | # Add to the appropriate tag group 62 | tag_paths[tag][path] = path_item 63 | 64 | return tag_paths 65 | 66 | def save_paths_by_tag(tag_paths): 67 | """Save path groups to separate files.""" 68 | for i, (tag, paths) in enumerate(sorted(tag_paths.items()), 1): 69 | # Create safe filename from tag 70 | safe_name = re.sub(r'[^a-zA-Z0-9]', '_', tag) 71 | filename = f"{i:02d}_{safe_name}.json" 72 | 73 | # Create the paths document 74 | paths_doc = {"paths": paths} 75 | save_json(paths_doc, os.path.join(PATHS_DIR, filename)) 76 | 77 | print(f"Created path file {filename} with {len(paths)} paths for tag '{tag}'") 78 | 79 | def group_schemas(openapi): 80 | """Group schemas into related categories.""" 81 | schemas = openapi["components"]["schemas"] 82 | 83 | # Group 1: Basic result schemas 84 | result_schemas = {k: v for k, v in schemas.items() if k.startswith("Result")} 85 | 86 | # Group 2: Data models directly related to projects 87 | project_schemas = {k: v for k, v in schemas.items() if "Project" in k or "project" in k.lower()} 88 | 89 | # Group 3: Data models for tasks and workflows 90 | task_schemas = {k: v for k, v in schemas.items() if "Task" in k or "task" in k.lower()} 91 | workflow_schemas = {k: v for k, v in schemas.items() if "Process" in k or "Workflow" in k} 92 | 93 | # Group 4: User and tenant related 94 | user_schemas = {k: v for k, v in schemas.items() if "User" in k or "user" in k.lower()} 95 | tenant_schemas = {k: v for k, v in schemas.items() if "Tenant" in k or "tenant" in k.lower()} 96 | 97 | # Group 5: Resource and data source related 98 | resource_schemas = {k: v for k, v in schemas.items() if "Resource" in k or "resource" in k.lower()} 99 | datasource_schemas = {k: v for k, v in schemas.items() if "DataSource" in k or "datasource" in k.lower()} 100 | 101 | # Group 6: Alert and monitoring related 102 | alert_schemas = {k: v for k, v in schemas.items() if "Alert" in k or "alert" in k.lower()} 103 | 104 | # Group 7: K8s related 105 | k8s_schemas = {k: v for k, v in schemas.items() if "K8s" in k or "k8s" in k.lower()} 106 | 107 | # Group 8: Queue and worker related 108 | queue_schemas = {k: v for k, v in schemas.items() if "Queue" in k or "queue" in k.lower()} 109 | worker_schemas = {k: v for k, v in schemas.items() if "Worker" in k or "worker" in k.lower()} 110 | 111 | # Group 9: Environment and cluster related 112 | env_schemas = {k: v for k, v in schemas.items() if "Environment" in k or "environment" in k.lower()} 113 | cluster_schemas = {k: v for k, v in schemas.items() if "Cluster" in k or "cluster" in k.lower()} 114 | 115 | # Group 10: Schedule related 116 | schedule_schemas = {k: v for k, v in schemas.items() if "Schedule" in k or "schedule" in k.lower()} 117 | 118 | # Collect all allocated schemas 119 | allocated_schemas = set() 120 | for schema_group in [ 121 | result_schemas, project_schemas, task_schemas, workflow_schemas, 122 | user_schemas, tenant_schemas, resource_schemas, datasource_schemas, 123 | alert_schemas, k8s_schemas, queue_schemas, worker_schemas, 124 | env_schemas, cluster_schemas, schedule_schemas 125 | ]: 126 | allocated_schemas.update(schema_group.keys()) 127 | 128 | # Remaining schemas 129 | remaining_schemas = {k: v for k, v in schemas.items() if k not in allocated_schemas} 130 | 131 | # Split remaining schemas into smaller chunks 132 | remaining_chunks = {} 133 | chunk_size = len(remaining_schemas) // 10 134 | chunk_size = max(chunk_size, 1) 135 | 136 | chunk_id = 1 137 | current_chunk = {} 138 | 139 | for i, (key, value) in enumerate(remaining_schemas.items(), 1): 140 | current_chunk[key] = value 141 | if i % chunk_size == 0 or i == len(remaining_schemas): 142 | remaining_chunks[f"remaining_{chunk_id}"] = current_chunk 143 | chunk_id += 1 144 | current_chunk = {} 145 | 146 | # Prepare the final grouped schemas 147 | grouped_schemas = { 148 | "result": result_schemas, 149 | "project": project_schemas, 150 | "task": task_schemas, 151 | "workflow": workflow_schemas, 152 | "user": user_schemas, 153 | "tenant": tenant_schemas, 154 | "resource": resource_schemas, 155 | "datasource": datasource_schemas, 156 | "alert": alert_schemas, 157 | "k8s": k8s_schemas, 158 | "queue": queue_schemas, 159 | "worker": worker_schemas, 160 | "environment": env_schemas, 161 | "cluster": cluster_schemas, 162 | "schedule": schedule_schemas, 163 | } 164 | 165 | # Add the remaining chunks 166 | grouped_schemas.update(remaining_chunks) 167 | 168 | return grouped_schemas 169 | 170 | def save_schemas(grouped_schemas): 171 | """Save schema groups to separate files.""" 172 | for i, (group_name, schemas) in enumerate(sorted(grouped_schemas.items()), 1): 173 | # Create the schema document 174 | schema_doc = {"components": {"schemas": schemas}} 175 | 176 | # Save to a file 177 | filename = f"{i:02d}_{group_name}_schemas.json" 178 | save_json(schema_doc, os.path.join(SCHEMAS_DIR, filename)) 179 | 180 | print(f"Created schema file {filename} with {len(schemas)} schemas for group '{group_name}'") 181 | 182 | def create_combiner_script(): 183 | """Create a script to combine all JSON files back into a single OpenAPI spec.""" 184 | script_content = """#!/usr/bin/env python3 185 | ''' 186 | Combine split OpenAPI files back into a single specification. 187 | ''' 188 | import json 189 | import os 190 | import glob 191 | 192 | # Output file 193 | OUTPUT_FILE = '../combined_openapi.json' 194 | 195 | def load_json(filename): 196 | '''Load JSON from a file.''' 197 | with open(filename, 'r', encoding='utf-8') as f: 198 | return json.load(f) 199 | 200 | def combine_openapi(): 201 | '''Combine all the split OpenAPI files into a single specification.''' 202 | # Start with the base information 203 | base_files = sorted(glob.glob('../base/*.json')) 204 | if not base_files: 205 | raise FileNotFoundError("No base files found!") 206 | 207 | combined = load_json(base_files[0]) 208 | combined['paths'] = {} 209 | combined['components'] = {'schemas': {}} 210 | 211 | # Add all paths 212 | path_files = sorted(glob.glob('../paths/*.json')) 213 | for path_file in path_files: 214 | paths_data = load_json(path_file) 215 | if 'paths' in paths_data: 216 | combined['paths'].update(paths_data['paths']) 217 | 218 | # Add all schemas 219 | schema_files = sorted(glob.glob('../schemas/*.json')) 220 | for schema_file in schema_files: 221 | schema_data = load_json(schema_file) 222 | if 'components' in schema_data and 'schemas' in schema_data['components']: 223 | combined['components']['schemas'].update(schema_data['components']['schemas']) 224 | 225 | # Save the combined specification 226 | with open(OUTPUT_FILE, 'w', encoding='utf-8') as f: 227 | json.dump(combined, f, ensure_ascii=False, indent=4) 228 | 229 | print(f"Combined OpenAPI specification saved to {OUTPUT_FILE}") 230 | print(f"Specification contains {len(combined['paths'])} paths and {len(combined['components']['schemas'])} schemas") 231 | 232 | if __name__ == '__main__': 233 | combine_openapi() 234 | """ 235 | 236 | with open(os.path.join("utils", "combine_openapi.py"), 'w', encoding='utf-8') as f: 237 | f.write(script_content) 238 | 239 | # Make the script executable 240 | os.chmod(os.path.join("utils", "combine_openapi.py"), 0o755) 241 | 242 | def main(): 243 | """Split the OpenAPI specification into multiple files.""" 244 | # Ensure directories exist 245 | ensure_directories() 246 | 247 | # Load the OpenAPI spec 248 | print("Loading OpenAPI specification...") 249 | openapi = load_openapi() 250 | 251 | # Save base information (already done manually, but included for completeness) 252 | # save_base_info(openapi) 253 | print("Base information already saved manually") 254 | 255 | # Group and save paths by tag 256 | print("\nSplitting API paths by tags...") 257 | tag_paths = group_paths_by_tag(openapi) 258 | save_paths_by_tag(tag_paths) 259 | 260 | # Group and save schemas 261 | print("\nSplitting schema definitions...") 262 | grouped_schemas = group_schemas(openapi) 263 | save_schemas(grouped_schemas) 264 | 265 | # Create the combiner script 266 | print("\nCreating the combiner script...") 267 | create_combiner_script() 268 | 269 | print("\nDone! The OpenAPI specification has been split into multiple files.") 270 | print(f"Paths: {sum(len(paths) for paths in tag_paths.values())} paths in {len(tag_paths)} files") 271 | print(f"Schemas: {sum(len(schemas) for schemas in grouped_schemas.values())} schemas in {len(grouped_schemas)} files") 272 | 273 | if __name__ == "__main__": 274 | main() ``` -------------------------------------------------------------------------------- /mcp-openapi-split/schemas/01_alert_schemas.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "components": { 3 | "schemas": { 4 | "AlertPluginInstance": { 5 | "type": "object", 6 | "properties": { 7 | "id": { 8 | "type": "integer", 9 | "format": "int32" 10 | }, 11 | "pluginDefineId": { 12 | "type": "integer", 13 | "format": "int32" 14 | }, 15 | "instanceName": { 16 | "type": "string" 17 | }, 18 | "pluginInstanceParams": { 19 | "type": "string" 20 | }, 21 | "instanceType": { 22 | "type": "string", 23 | "enum": [ 24 | "NORMAL", 25 | "GLOBAL" 26 | ] 27 | }, 28 | "warningType": { 29 | "type": "string", 30 | "enum": [ 31 | "NONE", 32 | "SUCCESS", 33 | "FAILURE", 34 | "ALL", 35 | "GLOBAL" 36 | ] 37 | }, 38 | "createTime": { 39 | "type": "string", 40 | "format": "date-time" 41 | }, 42 | "updateTime": { 43 | "type": "string", 44 | "format": "date-time" 45 | } 46 | } 47 | }, 48 | "ResultAlertPluginInstance": { 49 | "type": "object", 50 | "properties": { 51 | "code": { 52 | "type": "integer", 53 | "format": "int32" 54 | }, 55 | "msg": { 56 | "type": "string" 57 | }, 58 | "data": { 59 | "$ref": "#/components/schemas/AlertPluginInstance" 60 | }, 61 | "failed": { 62 | "type": "boolean" 63 | }, 64 | "success": { 65 | "type": "boolean" 66 | } 67 | } 68 | }, 69 | "AlertGroup": { 70 | "type": "object", 71 | "properties": { 72 | "id": { 73 | "type": "integer", 74 | "format": "int32" 75 | }, 76 | "groupName": { 77 | "type": "string" 78 | }, 79 | "alertInstanceIds": { 80 | "type": "string" 81 | }, 82 | "description": { 83 | "type": "string" 84 | }, 85 | "createTime": { 86 | "type": "string", 87 | "format": "date-time" 88 | }, 89 | "updateTime": { 90 | "type": "string", 91 | "format": "date-time" 92 | }, 93 | "createUserId": { 94 | "type": "integer", 95 | "format": "int32" 96 | } 97 | } 98 | }, 99 | "ResultAlertGroup": { 100 | "type": "object", 101 | "properties": { 102 | "code": { 103 | "type": "integer", 104 | "format": "int32" 105 | }, 106 | "msg": { 107 | "type": "string" 108 | }, 109 | "data": { 110 | "$ref": "#/components/schemas/AlertGroup" 111 | }, 112 | "failed": { 113 | "type": "boolean" 114 | }, 115 | "success": { 116 | "type": "boolean" 117 | } 118 | } 119 | }, 120 | "AlertPluginInstanceVO": { 121 | "type": "object", 122 | "properties": { 123 | "id": { 124 | "type": "integer", 125 | "format": "int32" 126 | }, 127 | "pluginDefineId": { 128 | "type": "integer", 129 | "format": "int32" 130 | }, 131 | "instanceName": { 132 | "type": "string" 133 | }, 134 | "instanceType": { 135 | "type": "string" 136 | }, 137 | "warningType": { 138 | "type": "string" 139 | }, 140 | "pluginInstanceParams": { 141 | "type": "string" 142 | }, 143 | "createTime": { 144 | "type": "string", 145 | "format": "date-time" 146 | }, 147 | "updateTime": { 148 | "type": "string", 149 | "format": "date-time" 150 | }, 151 | "alertPluginName": { 152 | "type": "string" 153 | } 154 | } 155 | }, 156 | "PageInfoAlertPluginInstanceVO": { 157 | "type": "object", 158 | "properties": { 159 | "totalList": { 160 | "type": "array", 161 | "items": { 162 | "$ref": "#/components/schemas/AlertPluginInstanceVO" 163 | } 164 | }, 165 | "total": { 166 | "type": "integer", 167 | "format": "int32" 168 | }, 169 | "totalPage": { 170 | "type": "integer", 171 | "format": "int32" 172 | }, 173 | "pageSize": { 174 | "type": "integer", 175 | "format": "int32" 176 | }, 177 | "currentPage": { 178 | "type": "integer", 179 | "format": "int32" 180 | }, 181 | "pageNo": { 182 | "type": "integer", 183 | "format": "int32" 184 | } 185 | } 186 | }, 187 | "ResultPageInfoAlertPluginInstanceVO": { 188 | "type": "object", 189 | "properties": { 190 | "code": { 191 | "type": "integer", 192 | "format": "int32" 193 | }, 194 | "msg": { 195 | "type": "string" 196 | }, 197 | "data": { 198 | "$ref": "#/components/schemas/PageInfoAlertPluginInstanceVO" 199 | }, 200 | "failed": { 201 | "type": "boolean" 202 | }, 203 | "success": { 204 | "type": "boolean" 205 | } 206 | } 207 | }, 208 | "ResultListAlertPluginInstanceVO": { 209 | "type": "object", 210 | "properties": { 211 | "code": { 212 | "type": "integer", 213 | "format": "int32" 214 | }, 215 | "msg": { 216 | "type": "string" 217 | }, 218 | "data": { 219 | "type": "array", 220 | "items": { 221 | "$ref": "#/components/schemas/AlertPluginInstanceVO" 222 | } 223 | }, 224 | "failed": { 225 | "type": "boolean" 226 | }, 227 | "success": { 228 | "type": "boolean" 229 | } 230 | } 231 | }, 232 | "PageInfoAlertGroup": { 233 | "type": "object", 234 | "properties": { 235 | "totalList": { 236 | "type": "array", 237 | "items": { 238 | "$ref": "#/components/schemas/AlertGroup" 239 | } 240 | }, 241 | "total": { 242 | "type": "integer", 243 | "format": "int32" 244 | }, 245 | "totalPage": { 246 | "type": "integer", 247 | "format": "int32" 248 | }, 249 | "pageSize": { 250 | "type": "integer", 251 | "format": "int32" 252 | }, 253 | "currentPage": { 254 | "type": "integer", 255 | "format": "int32" 256 | }, 257 | "pageNo": { 258 | "type": "integer", 259 | "format": "int32" 260 | } 261 | } 262 | }, 263 | "ResultPageInfoAlertGroup": { 264 | "type": "object", 265 | "properties": { 266 | "code": { 267 | "type": "integer", 268 | "format": "int32" 269 | }, 270 | "msg": { 271 | "type": "string" 272 | }, 273 | "data": { 274 | "$ref": "#/components/schemas/PageInfoAlertGroup" 275 | }, 276 | "failed": { 277 | "type": "boolean" 278 | }, 279 | "success": { 280 | "type": "boolean" 281 | } 282 | } 283 | }, 284 | "ResultListAlertGroup": { 285 | "type": "object", 286 | "properties": { 287 | "code": { 288 | "type": "integer", 289 | "format": "int32" 290 | }, 291 | "msg": { 292 | "type": "string" 293 | }, 294 | "data": { 295 | "type": "array", 296 | "items": { 297 | "$ref": "#/components/schemas/AlertGroup" 298 | } 299 | }, 300 | "failed": { 301 | "type": "boolean" 302 | }, 303 | "success": { 304 | "type": "boolean" 305 | } 306 | } 307 | } 308 | } 309 | } 310 | } ``` -------------------------------------------------------------------------------- /mcp-openapi-split/paths/25_environment_api.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "paths": { 3 | "/environment/verify-environment": { 4 | "post": { 5 | "tags": [ 6 | "环境相关操作" 7 | ], 8 | "summary": "verifyEnvironment", 9 | "description": "校验环境", 10 | "operationId": "verifyEnvironment", 11 | "parameters": [ 12 | { 13 | "name": "environmentName", 14 | "in": "query", 15 | "description": "环境名称", 16 | "required": true, 17 | "schema": { 18 | "type": "string" 19 | } 20 | } 21 | ], 22 | "responses": { 23 | "200": { 24 | "description": "OK", 25 | "content": { 26 | "*/*": { 27 | "schema": { 28 | "$ref": "#/components/schemas/Result" 29 | } 30 | } 31 | } 32 | } 33 | } 34 | } 35 | }, 36 | "/environment/update": { 37 | "post": { 38 | "tags": [ 39 | "环境相关操作" 40 | ], 41 | "summary": "updateEnvironment", 42 | "description": "UPDATE_ENVIRONMENT_NOTES", 43 | "operationId": "updateEnvironment", 44 | "parameters": [ 45 | { 46 | "name": "code", 47 | "in": "query", 48 | "description": "环境代码", 49 | "required": true, 50 | "schema": { 51 | "type": "integer", 52 | "format": "int64" 53 | } 54 | }, 55 | { 56 | "name": "name", 57 | "in": "query", 58 | "description": "环境名称", 59 | "required": true, 60 | "schema": { 61 | "type": "string" 62 | } 63 | }, 64 | { 65 | "name": "config", 66 | "in": "query", 67 | "description": "环境配置", 68 | "required": true, 69 | "schema": { 70 | "type": "string" 71 | } 72 | }, 73 | { 74 | "name": "description", 75 | "in": "query", 76 | "description": "环境描述", 77 | "required": false, 78 | "schema": { 79 | "type": "string" 80 | } 81 | }, 82 | { 83 | "name": "workerGroups", 84 | "in": "query", 85 | "description": "Worker工作组列表", 86 | "required": false, 87 | "schema": { 88 | "type": "string" 89 | } 90 | } 91 | ], 92 | "responses": { 93 | "200": { 94 | "description": "OK", 95 | "content": { 96 | "*/*": { 97 | "schema": { 98 | "$ref": "#/components/schemas/ResultEnvironment" 99 | } 100 | } 101 | } 102 | } 103 | } 104 | } 105 | }, 106 | "/environment/delete": { 107 | "post": { 108 | "tags": [ 109 | "环境相关操作" 110 | ], 111 | "summary": "deleteEnvironmentByCode", 112 | "description": "通过环境代码删除环境", 113 | "operationId": "deleteEnvironment", 114 | "parameters": [ 115 | { 116 | "name": "environmentCode", 117 | "in": "query", 118 | "description": "环境代码", 119 | "required": true, 120 | "schema": { 121 | "type": "integer", 122 | "format": "int64" 123 | } 124 | } 125 | ], 126 | "responses": { 127 | "200": { 128 | "description": "OK", 129 | "content": { 130 | "*/*": { 131 | "schema": { 132 | "$ref": "#/components/schemas/Result" 133 | } 134 | } 135 | } 136 | } 137 | } 138 | } 139 | }, 140 | "/environment/create": { 141 | "post": { 142 | "tags": [ 143 | "环境相关操作" 144 | ], 145 | "summary": "createEnvironment", 146 | "description": "创建环境", 147 | "operationId": "createEnvironment", 148 | "parameters": [ 149 | { 150 | "name": "name", 151 | "in": "query", 152 | "description": "环境名称", 153 | "required": true, 154 | "schema": { 155 | "type": "string" 156 | } 157 | }, 158 | { 159 | "name": "config", 160 | "in": "query", 161 | "description": "环境配置", 162 | "required": true, 163 | "schema": { 164 | "type": "string" 165 | } 166 | }, 167 | { 168 | "name": "description", 169 | "in": "query", 170 | "description": "环境描述", 171 | "required": false, 172 | "schema": { 173 | "type": "string" 174 | } 175 | }, 176 | { 177 | "name": "workerGroups", 178 | "in": "query", 179 | "description": "Worker工作组列表", 180 | "required": false, 181 | "schema": { 182 | "type": "string" 183 | } 184 | } 185 | ], 186 | "responses": { 187 | "201": { 188 | "description": "Created", 189 | "content": { 190 | "*/*": { 191 | "schema": { 192 | "$ref": "#/components/schemas/ResultLong" 193 | } 194 | } 195 | } 196 | } 197 | } 198 | } 199 | }, 200 | "/environment/query-environment-list": { 201 | "get": { 202 | "tags": [ 203 | "环境相关操作" 204 | ], 205 | "summary": "queryAllEnvironmentList", 206 | "description": "查询所有环境列表", 207 | "operationId": "queryAllEnvironmentList", 208 | "responses": { 209 | "200": { 210 | "description": "OK", 211 | "content": { 212 | "*/*": { 213 | "schema": { 214 | "$ref": "#/components/schemas/Result" 215 | } 216 | } 217 | } 218 | } 219 | } 220 | } 221 | }, 222 | "/environment/query-by-code": { 223 | "get": { 224 | "tags": [ 225 | "环境相关操作" 226 | ], 227 | "summary": "queryEnvironmentByCode", 228 | "description": "通过环境代码查询环境", 229 | "operationId": "queryEnvironmentByCode", 230 | "parameters": [ 231 | { 232 | "name": "environmentCode", 233 | "in": "query", 234 | "description": "环境代码", 235 | "required": true, 236 | "schema": { 237 | "type": "integer", 238 | "format": "int64" 239 | } 240 | } 241 | ], 242 | "responses": { 243 | "200": { 244 | "description": "OK", 245 | "content": { 246 | "*/*": { 247 | "schema": { 248 | "$ref": "#/components/schemas/Result" 249 | } 250 | } 251 | } 252 | } 253 | } 254 | } 255 | }, 256 | "/environment/list-paging": { 257 | "get": { 258 | "tags": [ 259 | "环境相关操作" 260 | ], 261 | "summary": "queryEnvironmentListPaging", 262 | "description": "查询环境列表页面", 263 | "operationId": "queryEnvironmentListPaging", 264 | "parameters": [ 265 | { 266 | "name": "searchVal", 267 | "in": "query", 268 | "description": "搜索值", 269 | "required": false, 270 | "schema": { 271 | "type": "string" 272 | } 273 | }, 274 | { 275 | "name": "pageSize", 276 | "in": "query", 277 | "description": "页大小", 278 | "required": true, 279 | "schema": { 280 | "type": "integer", 281 | "format": "int32" 282 | } 283 | }, 284 | { 285 | "name": "pageNo", 286 | "in": "query", 287 | "description": "页码号", 288 | "required": true, 289 | "schema": { 290 | "type": "integer", 291 | "format": "int32" 292 | } 293 | } 294 | ], 295 | "responses": { 296 | "200": { 297 | "description": "OK", 298 | "content": { 299 | "*/*": { 300 | "schema": { 301 | "$ref": "#/components/schemas/Result" 302 | } 303 | } 304 | } 305 | } 306 | } 307 | } 308 | } 309 | } 310 | } ``` -------------------------------------------------------------------------------- /mcp-openapi-split/paths/14_alert_group_api.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "paths": { 3 | "/alert-groups/{id}": { 4 | "put": { 5 | "tags": [ 6 | "告警组相关操作" 7 | ], 8 | "summary": "updateAlertGroup", 9 | "description": "编辑(更新)告警组", 10 | "operationId": "updateAlertGroupById", 11 | "parameters": [ 12 | { 13 | "name": "id", 14 | "in": "path", 15 | "description": "告警组ID", 16 | "required": true, 17 | "schema": { 18 | "type": "integer", 19 | "format": "int32" 20 | } 21 | }, 22 | { 23 | "name": "groupName", 24 | "in": "query", 25 | "description": "组名称", 26 | "required": true, 27 | "schema": { 28 | "type": "string" 29 | } 30 | }, 31 | { 32 | "name": "description", 33 | "in": "query", 34 | "description": "备注(描述)", 35 | "required": false, 36 | "schema": { 37 | "type": "string" 38 | } 39 | }, 40 | { 41 | "name": "alertInstanceIds", 42 | "in": "query", 43 | "description": "告警实例ID列表(字符串格式,多个告警实例ID以\",\"分割)", 44 | "required": true, 45 | "schema": { 46 | "type": "string" 47 | } 48 | } 49 | ], 50 | "responses": { 51 | "200": { 52 | "description": "OK", 53 | "content": { 54 | "*/*": { 55 | "schema": { 56 | "$ref": "#/components/schemas/ResultAlertGroup" 57 | } 58 | } 59 | } 60 | } 61 | } 62 | }, 63 | "delete": { 64 | "tags": [ 65 | "告警组相关操作" 66 | ], 67 | "summary": "delAlertGroupById", 68 | "description": "通过ID删除告警组", 69 | "operationId": "deleteAlertGroupById", 70 | "parameters": [ 71 | { 72 | "name": "id", 73 | "in": "path", 74 | "description": "告警组ID", 75 | "required": true, 76 | "schema": { 77 | "type": "integer", 78 | "format": "int32" 79 | } 80 | } 81 | ], 82 | "responses": { 83 | "200": { 84 | "description": "OK", 85 | "content": { 86 | "*/*": { 87 | "schema": { 88 | "$ref": "#/components/schemas/ResultBoolean" 89 | } 90 | } 91 | } 92 | } 93 | } 94 | } 95 | }, 96 | "/alert-groups": { 97 | "get": { 98 | "tags": [ 99 | "告警组相关操作" 100 | ], 101 | "summary": "queryAlertGroupListPaging", 102 | "description": "分页查询告警组列表", 103 | "operationId": "listPaging_2", 104 | "parameters": [ 105 | { 106 | "name": "searchVal", 107 | "in": "query", 108 | "description": "搜索值", 109 | "required": false, 110 | "schema": { 111 | "type": "string" 112 | } 113 | }, 114 | { 115 | "name": "pageNo", 116 | "in": "query", 117 | "description": "页码号", 118 | "required": true, 119 | "schema": { 120 | "type": "integer", 121 | "format": "int32" 122 | } 123 | }, 124 | { 125 | "name": "pageSize", 126 | "in": "query", 127 | "description": "页大小", 128 | "required": true, 129 | "schema": { 130 | "type": "integer", 131 | "format": "int32" 132 | } 133 | } 134 | ], 135 | "responses": { 136 | "200": { 137 | "description": "OK", 138 | "content": { 139 | "*/*": { 140 | "schema": { 141 | "$ref": "#/components/schemas/ResultPageInfoAlertGroup" 142 | } 143 | } 144 | } 145 | } 146 | } 147 | }, 148 | "post": { 149 | "tags": [ 150 | "告警组相关操作" 151 | ], 152 | "summary": "createAlertGroup", 153 | "description": "创建告警组", 154 | "operationId": "createAlertGroup", 155 | "parameters": [ 156 | { 157 | "name": "groupName", 158 | "in": "query", 159 | "description": "组名称", 160 | "required": true, 161 | "schema": { 162 | "type": "string" 163 | } 164 | }, 165 | { 166 | "name": "description", 167 | "in": "query", 168 | "description": "备注(描述)", 169 | "required": false, 170 | "schema": { 171 | "type": "string" 172 | } 173 | }, 174 | { 175 | "name": "alertInstanceIds", 176 | "in": "query", 177 | "description": "alertInstanceIds", 178 | "required": true, 179 | "schema": { 180 | "type": "string" 181 | } 182 | } 183 | ], 184 | "responses": { 185 | "201": { 186 | "description": "Created", 187 | "content": { 188 | "*/*": { 189 | "schema": { 190 | "$ref": "#/components/schemas/ResultAlertGroup" 191 | } 192 | } 193 | } 194 | } 195 | } 196 | } 197 | }, 198 | "/alert-groups/query": { 199 | "post": { 200 | "tags": [ 201 | "告警组相关操作" 202 | ], 203 | "summary": "queryAlertGroupById", 204 | "description": "QUERY_ALERT_GROUP_BY_ID_NOTES", 205 | "operationId": "queryAlertGroupById", 206 | "parameters": [ 207 | { 208 | "name": "id", 209 | "in": "query", 210 | "description": "告警组ID", 211 | "required": true, 212 | "schema": { 213 | "type": "integer", 214 | "format": "int32" 215 | } 216 | } 217 | ], 218 | "responses": { 219 | "200": { 220 | "description": "OK", 221 | "content": { 222 | "*/*": { 223 | "schema": { 224 | "$ref": "#/components/schemas/ResultAlertGroup" 225 | } 226 | } 227 | } 228 | } 229 | } 230 | } 231 | }, 232 | "/alert-groups/verify-name": { 233 | "get": { 234 | "tags": [ 235 | "告警组相关操作" 236 | ], 237 | "summary": "verifyGroupName", 238 | "description": "检查告警组是否存在", 239 | "operationId": "verifyGroupName_1", 240 | "parameters": [ 241 | { 242 | "name": "groupName", 243 | "in": "query", 244 | "description": "组名称", 245 | "required": true, 246 | "schema": { 247 | "type": "string" 248 | } 249 | } 250 | ], 251 | "responses": { 252 | "200": { 253 | "description": "OK", 254 | "content": { 255 | "*/*": { 256 | "schema": { 257 | "$ref": "#/components/schemas/Result" 258 | } 259 | } 260 | } 261 | } 262 | } 263 | } 264 | }, 265 | "/alert-groups/normal-list": { 266 | "get": { 267 | "tags": [ 268 | "告警组相关操作" 269 | ], 270 | "summary": "listNormalAlertGroupById", 271 | "description": "告警组列表", 272 | "operationId": "normalAlertGroupList", 273 | "responses": { 274 | "200": { 275 | "description": "OK", 276 | "content": { 277 | "*/*": { 278 | "schema": { 279 | "$ref": "#/components/schemas/ResultListAlertGroup" 280 | } 281 | } 282 | } 283 | } 284 | } 285 | } 286 | }, 287 | "/alert-groups/list": { 288 | "get": { 289 | "tags": [ 290 | "告警组相关操作" 291 | ], 292 | "summary": "listAlertGroupById", 293 | "description": "告警组列表", 294 | "operationId": "list", 295 | "responses": { 296 | "200": { 297 | "description": "OK", 298 | "content": { 299 | "*/*": { 300 | "schema": { 301 | "$ref": "#/components/schemas/ResultListAlertGroup" 302 | } 303 | } 304 | } 305 | } 306 | } 307 | } 308 | } 309 | } 310 | } ``` -------------------------------------------------------------------------------- /mcp-openapi-split/paths/10_task_analysis_api.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "paths": { 3 | "/projects/analysis/task-state-count": { 4 | "get": { 5 | "tags": [ 6 | "任务状态分析相关操作" 7 | ], 8 | "summary": "countTaskState", 9 | "description": "任务状态统计", 10 | "operationId": "getTaskInstanceStateCount", 11 | "parameters": [ 12 | { 13 | "name": "startDate", 14 | "in": "query", 15 | "description": "开始时间", 16 | "required": false, 17 | "schema": { 18 | "type": "string" 19 | } 20 | }, 21 | { 22 | "name": "endDate", 23 | "in": "query", 24 | "description": "结束时间", 25 | "required": false, 26 | "schema": { 27 | "type": "string" 28 | } 29 | }, 30 | { 31 | "name": "projectCode", 32 | "in": "query", 33 | "description": "项目Code", 34 | "required": false, 35 | "schema": { 36 | "type": "integer", 37 | "format": "int64" 38 | } 39 | } 40 | ], 41 | "responses": { 42 | "200": { 43 | "description": "OK", 44 | "content": { 45 | "*/*": { 46 | "schema": { 47 | "$ref": "#/components/schemas/ResultTaskInstanceCountVO" 48 | } 49 | } 50 | } 51 | } 52 | } 53 | } 54 | }, 55 | "/projects/analysis/queue-count": { 56 | "get": { 57 | "tags": [ 58 | "任务状态分析相关操作" 59 | ], 60 | "summary": "countQueueState", 61 | "description": "统计队列里任务状态", 62 | "operationId": "countQueueState", 63 | "responses": { 64 | "200": { 65 | "description": "OK", 66 | "content": { 67 | "*/*": { 68 | "schema": { 69 | "$ref": "#/components/schemas/ResultMapStringInteger" 70 | } 71 | } 72 | } 73 | } 74 | } 75 | } 76 | }, 77 | "/projects/analysis/process-state-count": { 78 | "get": { 79 | "tags": [ 80 | "任务状态分析相关操作" 81 | ], 82 | "summary": "countProcessInstanceState", 83 | "description": "统计流程实例状态", 84 | "operationId": "getWorkflowInstanceStateCount", 85 | "parameters": [ 86 | { 87 | "name": "startDate", 88 | "in": "query", 89 | "description": "开始时间", 90 | "required": false, 91 | "schema": { 92 | "type": "string" 93 | } 94 | }, 95 | { 96 | "name": "endDate", 97 | "in": "query", 98 | "description": "结束时间", 99 | "required": false, 100 | "schema": { 101 | "type": "string" 102 | } 103 | }, 104 | { 105 | "name": "projectCode", 106 | "in": "query", 107 | "description": "项目Code", 108 | "required": false, 109 | "schema": { 110 | "type": "integer", 111 | "format": "int64" 112 | } 113 | } 114 | ], 115 | "responses": { 116 | "200": { 117 | "description": "OK", 118 | "content": { 119 | "*/*": { 120 | "schema": { 121 | "$ref": "#/components/schemas/ResultWorkflowInstanceCountVO" 122 | } 123 | } 124 | } 125 | } 126 | } 127 | } 128 | }, 129 | "/projects/analysis/listErrorCommand": { 130 | "get": { 131 | "tags": [ 132 | "任务状态分析相关操作" 133 | ], 134 | "summary": "listErrorCommand", 135 | "description": "LIST_ERROR_COMMAND_LIST_PAGING_NOTES", 136 | "operationId": "listErrorCommand", 137 | "parameters": [ 138 | { 139 | "name": "projectCode", 140 | "in": "query", 141 | "required": false, 142 | "schema": { 143 | "type": "integer", 144 | "format": "int64" 145 | } 146 | }, 147 | { 148 | "name": "pageNo", 149 | "in": "query", 150 | "description": "页码号", 151 | "required": true, 152 | "schema": { 153 | "type": "integer", 154 | "format": "int32" 155 | } 156 | }, 157 | { 158 | "name": "pageSize", 159 | "in": "query", 160 | "description": "页大小", 161 | "required": true, 162 | "schema": { 163 | "type": "integer", 164 | "format": "int32" 165 | } 166 | }, 167 | { 168 | "name": "searchVal", 169 | "description": "搜索值", 170 | "schema": { 171 | "type": "string" 172 | } 173 | } 174 | ], 175 | "responses": { 176 | "200": { 177 | "description": "OK", 178 | "content": { 179 | "*/*": { 180 | "schema": { 181 | "$ref": "#/components/schemas/ResultPageInfoErrorCommand" 182 | } 183 | } 184 | } 185 | } 186 | } 187 | } 188 | }, 189 | "/projects/analysis/listCommand": { 190 | "get": { 191 | "tags": [ 192 | "任务状态分析相关操作" 193 | ], 194 | "summary": "listPendingCommands", 195 | "description": "LIST_PENDING_COMMANDS", 196 | "operationId": "listPaging", 197 | "parameters": [ 198 | { 199 | "name": "projectCode", 200 | "in": "query", 201 | "required": false, 202 | "schema": { 203 | "type": "integer", 204 | "format": "int64" 205 | } 206 | }, 207 | { 208 | "name": "pageNo", 209 | "in": "query", 210 | "description": "页码号", 211 | "required": true, 212 | "schema": { 213 | "type": "integer", 214 | "format": "int32" 215 | } 216 | }, 217 | { 218 | "name": "pageSize", 219 | "in": "query", 220 | "description": "页大小", 221 | "required": true, 222 | "schema": { 223 | "type": "integer", 224 | "format": "int32" 225 | } 226 | }, 227 | { 228 | "name": "searchVal", 229 | "description": "搜索值", 230 | "schema": { 231 | "type": "string" 232 | } 233 | } 234 | ], 235 | "responses": { 236 | "200": { 237 | "description": "OK", 238 | "content": { 239 | "*/*": { 240 | "schema": { 241 | "$ref": "#/components/schemas/ResultPageInfoCommand" 242 | } 243 | } 244 | } 245 | } 246 | } 247 | } 248 | }, 249 | "/projects/analysis/define-user-count": { 250 | "get": { 251 | "tags": [ 252 | "任务状态分析相关操作" 253 | ], 254 | "summary": "countDefinitionByUser", 255 | "description": "统计用户创建的流程定义", 256 | "operationId": "countDefinitionByUser", 257 | "parameters": [ 258 | { 259 | "name": "projectCode", 260 | "in": "query", 261 | "description": "项目Code", 262 | "required": false, 263 | "schema": { 264 | "type": "integer", 265 | "format": "int64" 266 | } 267 | } 268 | ], 269 | "responses": { 270 | "200": { 271 | "description": "OK", 272 | "content": { 273 | "*/*": { 274 | "schema": { 275 | "$ref": "#/components/schemas/ResultWorkflowDefinitionCountVO" 276 | } 277 | } 278 | } 279 | } 280 | } 281 | } 282 | }, 283 | "/projects/analysis/command-state-count": { 284 | "get": { 285 | "tags": [ 286 | "任务状态分析相关操作" 287 | ], 288 | "summary": "countCommandState", 289 | "description": "统计命令状态", 290 | "operationId": "countCommandState", 291 | "responses": { 292 | "200": { 293 | "description": "OK", 294 | "content": { 295 | "*/*": { 296 | "schema": { 297 | "$ref": "#/components/schemas/ResultListCommandStateCount" 298 | } 299 | } 300 | } 301 | } 302 | } 303 | } 304 | } 305 | } 306 | } ```