This is page 3 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/paths/34_project_parameter_api.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "paths": { 3 | "/projects/{projectCode}/project-parameter/{code}": { 4 | "get": { 5 | "tags": [ 6 | "项目参数相关操作" 7 | ], 8 | "summary": "queryProjectParameterByCode", 9 | "description": "查询项目参数", 10 | "operationId": "queryProjectParameterByCode", 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": "code", 24 | "in": "path", 25 | "description": "项目参数code", 26 | "required": true, 27 | "schema": { 28 | "type": "integer", 29 | "format": "int64" 30 | } 31 | } 32 | ], 33 | "responses": { 34 | "200": { 35 | "description": "OK", 36 | "content": { 37 | "*/*": { 38 | "schema": { 39 | "$ref": "#/components/schemas/Result" 40 | } 41 | } 42 | } 43 | } 44 | } 45 | }, 46 | "put": { 47 | "tags": [ 48 | "项目参数相关操作" 49 | ], 50 | "summary": "updateProjectParameter", 51 | "description": "更新项目参数", 52 | "operationId": "updateProjectParameter", 53 | "parameters": [ 54 | { 55 | "name": "projectCode", 56 | "in": "path", 57 | "description": "项目Code", 58 | "required": true, 59 | "schema": { 60 | "type": "integer", 61 | "format": "int64" 62 | } 63 | }, 64 | { 65 | "name": "code", 66 | "in": "path", 67 | "description": "项目参数code", 68 | "required": true, 69 | "schema": { 70 | "type": "integer", 71 | "format": "int64" 72 | } 73 | }, 74 | { 75 | "name": "projectParameterName", 76 | "in": "query", 77 | "description": "项目参数名称", 78 | "required": true, 79 | "schema": { 80 | "type": "string" 81 | } 82 | }, 83 | { 84 | "name": "projectParameterValue", 85 | "in": "query", 86 | "description": "项目参数值", 87 | "required": true, 88 | "schema": { 89 | "type": "string" 90 | } 91 | } 92 | ], 93 | "responses": { 94 | "200": { 95 | "description": "OK", 96 | "content": { 97 | "*/*": { 98 | "schema": { 99 | "$ref": "#/components/schemas/Result" 100 | } 101 | } 102 | } 103 | } 104 | } 105 | } 106 | }, 107 | "/projects/{projectCode}/project-parameter": { 108 | "get": { 109 | "tags": [ 110 | "项目参数相关操作" 111 | ], 112 | "summary": "queryProjectParameterListPaging", 113 | "description": "分页查询项目参数", 114 | "operationId": "queryProjectParameterListPaging", 115 | "parameters": [ 116 | { 117 | "name": "projectCode", 118 | "in": "path", 119 | "description": "项目Code", 120 | "required": true, 121 | "schema": { 122 | "type": "integer", 123 | "format": "int64" 124 | } 125 | }, 126 | { 127 | "name": "searchVal", 128 | "in": "query", 129 | "description": "搜索值", 130 | "required": false, 131 | "schema": { 132 | "type": "string" 133 | } 134 | }, 135 | { 136 | "name": "pageNo", 137 | "in": "query", 138 | "description": "页码号", 139 | "required": true, 140 | "schema": { 141 | "type": "integer", 142 | "format": "int32" 143 | } 144 | }, 145 | { 146 | "name": "pageSize", 147 | "in": "query", 148 | "description": "页大小", 149 | "required": true, 150 | "schema": { 151 | "type": "integer", 152 | "format": "int32" 153 | } 154 | } 155 | ], 156 | "responses": { 157 | "200": { 158 | "description": "OK", 159 | "content": { 160 | "*/*": { 161 | "schema": { 162 | "$ref": "#/components/schemas/Result" 163 | } 164 | } 165 | } 166 | } 167 | } 168 | }, 169 | "post": { 170 | "tags": [ 171 | "项目参数相关操作" 172 | ], 173 | "summary": "createProjectParameter", 174 | "description": "新增项目参数", 175 | "operationId": "createProjectParameter", 176 | "parameters": [ 177 | { 178 | "name": "projectCode", 179 | "in": "path", 180 | "description": "项目Code", 181 | "required": true, 182 | "schema": { 183 | "type": "integer", 184 | "format": "int64" 185 | } 186 | }, 187 | { 188 | "name": "projectParameterName", 189 | "in": "query", 190 | "description": "项目参数名称", 191 | "required": true, 192 | "schema": { 193 | "type": "string" 194 | } 195 | }, 196 | { 197 | "name": "projectParameterValue", 198 | "in": "query", 199 | "description": "项目参数值", 200 | "required": true, 201 | "schema": { 202 | "type": "string" 203 | } 204 | } 205 | ], 206 | "responses": { 207 | "201": { 208 | "description": "Created", 209 | "content": { 210 | "*/*": { 211 | "schema": { 212 | "$ref": "#/components/schemas/Result" 213 | } 214 | } 215 | } 216 | } 217 | } 218 | } 219 | }, 220 | "/projects/{projectCode}/project-parameter/delete": { 221 | "post": { 222 | "tags": [ 223 | "项目参数相关操作" 224 | ], 225 | "summary": "deleteProjectParametersByCode", 226 | "description": "删除项目参数", 227 | "operationId": "deleteProjectParametersByCode", 228 | "parameters": [ 229 | { 230 | "name": "projectCode", 231 | "in": "path", 232 | "description": "项目Code", 233 | "required": true, 234 | "schema": { 235 | "type": "integer", 236 | "format": "int64" 237 | } 238 | }, 239 | { 240 | "name": "code", 241 | "in": "query", 242 | "description": "项目参数code", 243 | "required": true, 244 | "schema": { 245 | "type": "string" 246 | } 247 | } 248 | ], 249 | "responses": { 250 | "200": { 251 | "description": "OK", 252 | "content": { 253 | "*/*": { 254 | "schema": { 255 | "$ref": "#/components/schemas/Result" 256 | } 257 | } 258 | } 259 | } 260 | } 261 | } 262 | }, 263 | "/projects/{projectCode}/project-parameter/batch-delete": { 264 | "post": { 265 | "tags": [ 266 | "项目参数相关操作" 267 | ], 268 | "summary": "batchDeleteProjectParametersByCodes", 269 | "description": "删除项目参数", 270 | "operationId": "batchDeleteProjectParametersByCodes", 271 | "parameters": [ 272 | { 273 | "name": "projectCode", 274 | "in": "path", 275 | "description": "项目Code", 276 | "required": true, 277 | "schema": { 278 | "type": "integer", 279 | "format": "int64" 280 | } 281 | }, 282 | { 283 | "name": "codes", 284 | "in": "query", 285 | "description": "项目参数code", 286 | "required": true, 287 | "schema": { 288 | "type": "string" 289 | } 290 | } 291 | ], 292 | "responses": { 293 | "200": { 294 | "description": "OK", 295 | "content": { 296 | "*/*": { 297 | "schema": { 298 | "$ref": "#/components/schemas/Result" 299 | } 300 | } 301 | } 302 | } 303 | } 304 | } 305 | } 306 | } 307 | } ``` -------------------------------------------------------------------------------- /mcp-openapi-split/schemas/24_task_schemas.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "components": { 3 | "schemas": { 4 | "ProcessTaskRelation": { 5 | "type": "object", 6 | "properties": { 7 | "id": { 8 | "type": "integer", 9 | "format": "int32" 10 | }, 11 | "name": { 12 | "type": "string" 13 | }, 14 | "processDefinitionVersion": { 15 | "type": "integer", 16 | "format": "int32" 17 | }, 18 | "projectCode": { 19 | "type": "integer", 20 | "format": "int64" 21 | }, 22 | "processDefinitionCode": { 23 | "type": "integer", 24 | "format": "int64" 25 | }, 26 | "preTaskCode": { 27 | "type": "integer", 28 | "format": "int64" 29 | }, 30 | "preTaskVersion": { 31 | "type": "integer", 32 | "format": "int32" 33 | }, 34 | "postTaskCode": { 35 | "type": "integer", 36 | "format": "int64" 37 | }, 38 | "postTaskVersion": { 39 | "type": "integer", 40 | "format": "int32" 41 | }, 42 | "conditionType": { 43 | "type": "string", 44 | "enum": [ 45 | "NONE", 46 | "JUDGE", 47 | "DELAY" 48 | ] 49 | }, 50 | "conditionParams": { 51 | "type": "string" 52 | }, 53 | "createTime": { 54 | "type": "string", 55 | "format": "date-time" 56 | }, 57 | "updateTime": { 58 | "type": "string", 59 | "format": "date-time" 60 | } 61 | } 62 | }, 63 | "TaskDefinition": { 64 | "type": "object", 65 | "properties": { 66 | "id": { 67 | "type": "integer", 68 | "format": "int32" 69 | }, 70 | "code": { 71 | "type": "integer", 72 | "format": "int64" 73 | }, 74 | "name": { 75 | "type": "string" 76 | }, 77 | "version": { 78 | "type": "integer", 79 | "format": "int32" 80 | }, 81 | "description": { 82 | "type": "string" 83 | }, 84 | "projectCode": { 85 | "type": "integer", 86 | "format": "int64" 87 | }, 88 | "userId": { 89 | "type": "integer", 90 | "format": "int32" 91 | }, 92 | "taskType": { 93 | "type": "string" 94 | }, 95 | "taskParams": { 96 | "type": "string" 97 | }, 98 | "taskParamList": { 99 | "type": "array", 100 | "items": { 101 | "$ref": "#/components/schemas/Property" 102 | } 103 | }, 104 | "taskParamMap": { 105 | "type": "object", 106 | "additionalProperties": { 107 | "type": "string" 108 | } 109 | }, 110 | "flag": { 111 | "type": "string", 112 | "enum": [ 113 | "NO", 114 | "YES" 115 | ] 116 | }, 117 | "isCache": { 118 | "type": "string", 119 | "enum": [ 120 | "NO", 121 | "YES" 122 | ] 123 | }, 124 | "taskPriority": { 125 | "type": "string", 126 | "enum": [ 127 | "HIGHEST", 128 | "HIGH", 129 | "MEDIUM", 130 | "LOW", 131 | "LOWEST" 132 | ] 133 | }, 134 | "userName": { 135 | "type": "string" 136 | }, 137 | "projectName": { 138 | "type": "string" 139 | }, 140 | "workerGroup": { 141 | "type": "string" 142 | }, 143 | "environmentCode": { 144 | "type": "integer", 145 | "format": "int64" 146 | }, 147 | "failRetryTimes": { 148 | "type": "integer", 149 | "format": "int32" 150 | }, 151 | "failRetryInterval": { 152 | "type": "integer", 153 | "format": "int32" 154 | }, 155 | "timeoutFlag": { 156 | "type": "string", 157 | "enum": [ 158 | "CLOSE", 159 | "OPEN" 160 | ] 161 | }, 162 | "timeoutNotifyStrategy": { 163 | "type": "string", 164 | "enum": [ 165 | "WARN", 166 | "FAILED", 167 | "WARNFAILED" 168 | ] 169 | }, 170 | "timeout": { 171 | "type": "integer", 172 | "format": "int32" 173 | }, 174 | "delayTime": { 175 | "type": "integer", 176 | "format": "int32" 177 | }, 178 | "resourceIds": { 179 | "type": "string", 180 | "deprecated": true 181 | }, 182 | "createTime": { 183 | "type": "string", 184 | "format": "date-time" 185 | }, 186 | "updateTime": { 187 | "type": "string", 188 | "format": "date-time" 189 | }, 190 | "modifyBy": { 191 | "type": "string" 192 | }, 193 | "taskGroupId": { 194 | "type": "integer", 195 | "format": "int32" 196 | }, 197 | "taskGroupPriority": { 198 | "type": "integer", 199 | "format": "int32" 200 | }, 201 | "cpuQuota": { 202 | "type": "integer", 203 | "format": "int32" 204 | }, 205 | "memoryMax": { 206 | "type": "integer", 207 | "format": "int32" 208 | }, 209 | "taskExecuteType": { 210 | "type": "string", 211 | "enum": [ 212 | "BATCH", 213 | "STREAM" 214 | ] 215 | }, 216 | "dependence": { 217 | "type": "string" 218 | } 219 | } 220 | }, 221 | "ResultTaskInstanceCountVO": { 222 | "type": "object", 223 | "properties": { 224 | "code": { 225 | "type": "integer", 226 | "format": "int32" 227 | }, 228 | "msg": { 229 | "type": "string" 230 | }, 231 | "data": { 232 | "$ref": "#/components/schemas/TaskInstanceCountVO" 233 | }, 234 | "failed": { 235 | "type": "boolean" 236 | }, 237 | "success": { 238 | "type": "boolean" 239 | } 240 | } 241 | }, 242 | "TaskInstanceCountVO": { 243 | "type": "object", 244 | "properties": { 245 | "totalCount": { 246 | "type": "integer", 247 | "format": "int32" 248 | }, 249 | "taskInstanceStatusCounts": { 250 | "type": "array", 251 | "items": { 252 | "$ref": "#/components/schemas/TaskInstanceStatusCountDto" 253 | } 254 | } 255 | } 256 | }, 257 | "TaskInstanceStatusCountDto": { 258 | "type": "object", 259 | "properties": { 260 | "state": { 261 | "type": "string", 262 | "enum": [ 263 | "TaskExecutionStatus{code=0, desc='submit success'}", 264 | "TaskExecutionStatus{code=1, desc='running'}", 265 | "TaskExecutionStatus{code=3, desc='pause'}", 266 | "TaskExecutionStatus{code=5, desc='stop'}", 267 | "TaskExecutionStatus{code=6, desc='failure'}", 268 | "TaskExecutionStatus{code=7, desc='success'}", 269 | "TaskExecutionStatus{code=8, desc='need fault tolerance'}", 270 | "TaskExecutionStatus{code=9, desc='kill'}", 271 | "TaskExecutionStatus{code=12, desc='delay execution'}", 272 | "TaskExecutionStatus{code=13, desc='forced success'}", 273 | "TaskExecutionStatus{code=17, desc='dispatch'}" 274 | ] 275 | }, 276 | "count": { 277 | "type": "integer", 278 | "format": "int32" 279 | } 280 | } 281 | }, 282 | "ResponseTaskLog": { 283 | "type": "object", 284 | "properties": { 285 | "lineNum": { 286 | "type": "integer", 287 | "format": "int32" 288 | }, 289 | "message": { 290 | "type": "string" 291 | } 292 | } 293 | }, 294 | "ResultResponseTaskLog": { 295 | "type": "object", 296 | "properties": { 297 | "code": { 298 | "type": "integer", 299 | "format": "int32" 300 | }, 301 | "msg": { 302 | "type": "string" 303 | }, 304 | "data": { 305 | "$ref": "#/components/schemas/ResponseTaskLog" 306 | }, 307 | "failed": { 308 | "type": "boolean" 309 | }, 310 | "success": { 311 | "type": "boolean" 312 | } 313 | } 314 | }, 315 | "TaskInstanceRemoveCacheResponse": { 316 | "type": "object", 317 | "properties": { 318 | "code": { 319 | "type": "integer", 320 | "format": "int32" 321 | }, 322 | "msg": { 323 | "type": "string" 324 | }, 325 | "data": { 326 | "type": "object" 327 | }, 328 | "cacheKey": { 329 | "type": "string" 330 | }, 331 | "failed": { 332 | "type": "boolean" 333 | }, 334 | "success": { 335 | "type": "boolean" 336 | } 337 | } 338 | } 339 | } 340 | } 341 | } ``` -------------------------------------------------------------------------------- /mcp-openapi-split/paths/13_alert_plugin_instance_api.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "paths": { 3 | "/alert-plugin-instances/{id}": { 4 | "get": { 5 | "tags": [ 6 | "告警插件实例相关操作" 7 | ], 8 | "summary": "getAlertPluginInstance", 9 | "description": "查询告警插件实例", 10 | "operationId": "getAlertPluginInstance", 11 | "parameters": [ 12 | { 13 | "name": "id", 14 | "in": "path", 15 | "required": true, 16 | "schema": { 17 | "type": "integer", 18 | "format": "int32" 19 | } 20 | } 21 | ], 22 | "responses": { 23 | "200": { 24 | "description": "OK", 25 | "content": { 26 | "*/*": { 27 | "schema": { 28 | "$ref": "#/components/schemas/ResultAlertPluginInstance" 29 | } 30 | } 31 | } 32 | } 33 | } 34 | }, 35 | "put": { 36 | "tags": [ 37 | "告警插件实例相关操作" 38 | ], 39 | "summary": "updateAlertPluginInstance", 40 | "description": "更新告警插件实例", 41 | "operationId": "updateAlertPluginInstanceById", 42 | "parameters": [ 43 | { 44 | "name": "id", 45 | "in": "path", 46 | "required": true, 47 | "schema": { 48 | "type": "integer", 49 | "format": "int32" 50 | } 51 | }, 52 | { 53 | "name": "instanceName", 54 | "in": "query", 55 | "description": "告警插件实例名称", 56 | "required": true, 57 | "schema": { 58 | "type": "string" 59 | } 60 | }, 61 | { 62 | "name": "warningType", 63 | "in": "query", 64 | "required": true, 65 | "schema": { 66 | "type": "string", 67 | "enum": [ 68 | "NONE", 69 | "SUCCESS", 70 | "FAILURE", 71 | "ALL", 72 | "GLOBAL" 73 | ] 74 | } 75 | }, 76 | { 77 | "name": "pluginInstanceParams", 78 | "in": "query", 79 | "description": "告警插件实例参数", 80 | "required": true, 81 | "schema": { 82 | "type": "string" 83 | } 84 | }, 85 | { 86 | "name": "alertPluginInstanceId", 87 | "description": "告警插件实例ID", 88 | "required": true, 89 | "schema": { 90 | "type": "integer", 91 | "format": "int32" 92 | } 93 | } 94 | ], 95 | "responses": { 96 | "200": { 97 | "description": "OK", 98 | "content": { 99 | "*/*": { 100 | "schema": { 101 | "$ref": "#/components/schemas/ResultAlertPluginInstance" 102 | } 103 | } 104 | } 105 | } 106 | } 107 | }, 108 | "delete": { 109 | "tags": [ 110 | "告警插件实例相关操作" 111 | ], 112 | "summary": "deleteAlertPluginInstance", 113 | "description": "删除告警插件实例", 114 | "operationId": "deleteAlertPluginInstance", 115 | "parameters": [ 116 | { 117 | "name": "id", 118 | "in": "path", 119 | "description": "告警插件ID", 120 | "required": true, 121 | "schema": { 122 | "type": "integer", 123 | "format": "int32" 124 | } 125 | } 126 | ], 127 | "responses": { 128 | "200": { 129 | "description": "OK", 130 | "content": { 131 | "*/*": { 132 | "schema": { 133 | "$ref": "#/components/schemas/ResultBoolean" 134 | } 135 | } 136 | } 137 | } 138 | } 139 | } 140 | }, 141 | "/alert-plugin-instances": { 142 | "get": { 143 | "tags": [ 144 | "告警插件实例相关操作" 145 | ], 146 | "summary": "queryAlertPluginInstanceListPaging", 147 | "description": "分页查询告警实例列表", 148 | "operationId": "listPaging_1", 149 | "parameters": [ 150 | { 151 | "name": "searchVal", 152 | "in": "query", 153 | "description": "搜索值", 154 | "required": false, 155 | "schema": { 156 | "type": "string" 157 | } 158 | }, 159 | { 160 | "name": "pageNo", 161 | "in": "query", 162 | "description": "页码号", 163 | "required": true, 164 | "schema": { 165 | "type": "integer", 166 | "format": "int32" 167 | } 168 | }, 169 | { 170 | "name": "pageSize", 171 | "in": "query", 172 | "description": "页大小", 173 | "required": true, 174 | "schema": { 175 | "type": "integer", 176 | "format": "int32" 177 | } 178 | } 179 | ], 180 | "responses": { 181 | "200": { 182 | "description": "OK", 183 | "content": { 184 | "*/*": { 185 | "schema": { 186 | "$ref": "#/components/schemas/ResultPageInfoAlertPluginInstanceVO" 187 | } 188 | } 189 | } 190 | } 191 | } 192 | }, 193 | "post": { 194 | "tags": [ 195 | "告警插件实例相关操作" 196 | ], 197 | "summary": "createAlertPluginInstance", 198 | "description": "创建告警插件实例", 199 | "operationId": "createAlertPluginInstance", 200 | "parameters": [ 201 | { 202 | "name": "pluginDefineId", 203 | "in": "query", 204 | "description": "告警插件定义ID", 205 | "required": true, 206 | "schema": { 207 | "type": "integer", 208 | "format": "int32" 209 | } 210 | }, 211 | { 212 | "name": "instanceName", 213 | "in": "query", 214 | "description": "告警插件实例名称", 215 | "required": true, 216 | "schema": { 217 | "type": "string" 218 | } 219 | }, 220 | { 221 | "name": "instanceType", 222 | "in": "query", 223 | "required": true, 224 | "schema": { 225 | "type": "string", 226 | "enum": [ 227 | "NORMAL", 228 | "GLOBAL" 229 | ] 230 | } 231 | }, 232 | { 233 | "name": "warningType", 234 | "in": "query", 235 | "required": true, 236 | "schema": { 237 | "type": "string", 238 | "enum": [ 239 | "NONE", 240 | "SUCCESS", 241 | "FAILURE", 242 | "ALL", 243 | "GLOBAL" 244 | ] 245 | } 246 | }, 247 | { 248 | "name": "pluginInstanceParams", 249 | "in": "query", 250 | "description": "告警插件实例参数", 251 | "required": true, 252 | "schema": { 253 | "type": "string" 254 | } 255 | } 256 | ], 257 | "responses": { 258 | "201": { 259 | "description": "Created", 260 | "content": { 261 | "*/*": { 262 | "schema": { 263 | "$ref": "#/components/schemas/ResultAlertPluginInstance" 264 | } 265 | } 266 | } 267 | } 268 | } 269 | } 270 | }, 271 | "/alert-plugin-instances/test-send": { 272 | "post": { 273 | "tags": [ 274 | "告警插件实例相关操作" 275 | ], 276 | "summary": "testSendAlertPluginInstance", 277 | "description": "TEST_SEND_ALERT_PLUGIN_INSTANCE", 278 | "operationId": "testSendAlertPluginInstance", 279 | "parameters": [ 280 | { 281 | "name": "pluginDefineId", 282 | "in": "query", 283 | "description": "告警插件定义ID", 284 | "required": true, 285 | "schema": { 286 | "type": "integer", 287 | "format": "int32" 288 | } 289 | }, 290 | { 291 | "name": "pluginInstanceParams", 292 | "in": "query", 293 | "description": "告警插件实例参数", 294 | "required": true, 295 | "schema": { 296 | "type": "string" 297 | } 298 | } 299 | ], 300 | "responses": { 301 | "200": { 302 | "description": "OK", 303 | "content": { 304 | "*/*": { 305 | "schema": { 306 | "$ref": "#/components/schemas/ResultBoolean" 307 | } 308 | } 309 | } 310 | } 311 | } 312 | } 313 | }, 314 | "/alert-plugin-instances/verify-name": { 315 | "get": { 316 | "tags": [ 317 | "告警插件实例相关操作" 318 | ], 319 | "summary": "verifyAlertInstanceName", 320 | "description": "验证告警插件名称", 321 | "operationId": "verifyGroupName", 322 | "parameters": [ 323 | { 324 | "name": "alertInstanceName", 325 | "in": "query", 326 | "description": "告警插件名称", 327 | "required": true, 328 | "schema": { 329 | "type": "string" 330 | } 331 | } 332 | ], 333 | "responses": { 334 | "200": { 335 | "description": "OK", 336 | "content": { 337 | "*/*": { 338 | "schema": { 339 | "$ref": "#/components/schemas/Result" 340 | } 341 | } 342 | } 343 | } 344 | } 345 | } 346 | }, 347 | "/alert-plugin-instances/list": { 348 | "get": { 349 | "tags": [ 350 | "告警插件实例相关操作" 351 | ], 352 | "summary": "queryAlertPluginInstanceList", 353 | "description": "查询所有告警实例列表", 354 | "operationId": "getAlertPluginInstance_1", 355 | "responses": { 356 | "200": { 357 | "description": "OK", 358 | "content": { 359 | "*/*": { 360 | "schema": { 361 | "$ref": "#/components/schemas/ResultListAlertPluginInstanceVO" 362 | } 363 | } 364 | } 365 | } 366 | } 367 | } 368 | } 369 | } 370 | } ``` -------------------------------------------------------------------------------- /mcp-openapi-split/paths/09_task_instance_api.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "paths": { 3 | "/projects/{projectCode}/task-instances/{id}/stop": { 4 | "post": { 5 | "tags": [ 6 | "任务实例相关操作" 7 | ], 8 | "summary": "stop", 9 | "description": "停止任务实例", 10 | "operationId": "stopTask", 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": "id", 24 | "in": "path", 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 | "$ref": "#/components/schemas/ResultObject" 40 | } 41 | } 42 | } 43 | } 44 | } 45 | } 46 | }, 47 | "/projects/{projectCode}/task-instances/{id}/savepoint": { 48 | "post": { 49 | "tags": [ 50 | "任务实例相关操作" 51 | ], 52 | "summary": "savepoint", 53 | "description": "任务SavePoint", 54 | "operationId": "taskSavePoint", 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": "id", 68 | "in": "path", 69 | "description": "任务实例ID", 70 | "required": true, 71 | "schema": { 72 | "type": "integer", 73 | "format": "int32" 74 | } 75 | } 76 | ], 77 | "responses": { 78 | "200": { 79 | "description": "OK", 80 | "content": { 81 | "*/*": { 82 | "schema": { 83 | "$ref": "#/components/schemas/ResultObject" 84 | } 85 | } 86 | } 87 | } 88 | } 89 | } 90 | }, 91 | "/projects/{projectCode}/task-instances/{id}/force-success": { 92 | "post": { 93 | "tags": [ 94 | "任务实例相关操作" 95 | ], 96 | "summary": "force-success", 97 | "description": "强制TASK成功", 98 | "operationId": "forceTaskSuccess", 99 | "parameters": [ 100 | { 101 | "name": "projectCode", 102 | "in": "path", 103 | "required": true, 104 | "schema": { 105 | "type": "integer", 106 | "format": "int64" 107 | } 108 | }, 109 | { 110 | "name": "id", 111 | "in": "path", 112 | "description": "任务实例ID", 113 | "required": true, 114 | "schema": { 115 | "type": "integer", 116 | "format": "int32" 117 | } 118 | } 119 | ], 120 | "responses": { 121 | "200": { 122 | "description": "OK", 123 | "content": { 124 | "*/*": { 125 | "schema": { 126 | "$ref": "#/components/schemas/ResultVoid" 127 | } 128 | } 129 | } 130 | } 131 | } 132 | } 133 | }, 134 | "/projects/{projectCode}/task-instances": { 135 | "get": { 136 | "tags": [ 137 | "任务实例相关操作" 138 | ], 139 | "summary": "queryTaskListPaging", 140 | "description": "分页查询任务实例列表", 141 | "operationId": "queryTaskListPaging", 142 | "parameters": [ 143 | { 144 | "name": "projectCode", 145 | "in": "path", 146 | "description": "项目Code", 147 | "required": true, 148 | "schema": { 149 | "type": "integer", 150 | "format": "int64" 151 | } 152 | }, 153 | { 154 | "name": "processInstanceId", 155 | "in": "query", 156 | "description": "流程实例ID", 157 | "required": false, 158 | "schema": { 159 | "type": "integer", 160 | "format": "int32" 161 | } 162 | }, 163 | { 164 | "name": "processInstanceName", 165 | "in": "query", 166 | "description": "流程实例名称", 167 | "required": false, 168 | "schema": { 169 | "type": "string" 170 | } 171 | }, 172 | { 173 | "name": "processDefinitionName", 174 | "in": "query", 175 | "required": false, 176 | "schema": { 177 | "type": "string" 178 | } 179 | }, 180 | { 181 | "name": "searchVal", 182 | "in": "query", 183 | "description": "搜索值", 184 | "required": false, 185 | "schema": { 186 | "type": "string" 187 | } 188 | }, 189 | { 190 | "name": "taskName", 191 | "in": "query", 192 | "description": "任务实例名", 193 | "required": false, 194 | "schema": { 195 | "type": "string" 196 | } 197 | }, 198 | { 199 | "name": "taskCode", 200 | "in": "query", 201 | "description": "TASK_CODE", 202 | "required": false, 203 | "schema": { 204 | "type": "integer", 205 | "format": "int64" 206 | } 207 | }, 208 | { 209 | "name": "executorName", 210 | "in": "query", 211 | "description": "流程名称", 212 | "required": false, 213 | "schema": { 214 | "type": "string" 215 | } 216 | }, 217 | { 218 | "name": "stateType", 219 | "in": "query", 220 | "description": "工作流和任务节点的运行状态", 221 | "required": false, 222 | "schema": { 223 | "type": "string", 224 | "enum": [ 225 | "TaskExecutionStatus{code=0, desc='submit success'}", 226 | "TaskExecutionStatus{code=1, desc='running'}", 227 | "TaskExecutionStatus{code=3, desc='pause'}", 228 | "TaskExecutionStatus{code=5, desc='stop'}", 229 | "TaskExecutionStatus{code=6, desc='failure'}", 230 | "TaskExecutionStatus{code=7, desc='success'}", 231 | "TaskExecutionStatus{code=8, desc='need fault tolerance'}", 232 | "TaskExecutionStatus{code=9, desc='kill'}", 233 | "TaskExecutionStatus{code=12, desc='delay execution'}", 234 | "TaskExecutionStatus{code=13, desc='forced success'}", 235 | "TaskExecutionStatus{code=17, desc='dispatch'}" 236 | ] 237 | } 238 | }, 239 | { 240 | "name": "host", 241 | "in": "query", 242 | "description": "运行任务的主机IP地址", 243 | "required": false, 244 | "schema": { 245 | "type": "string" 246 | } 247 | }, 248 | { 249 | "name": "startDate", 250 | "in": "query", 251 | "description": "开始时间", 252 | "required": false, 253 | "schema": { 254 | "type": "string" 255 | } 256 | }, 257 | { 258 | "name": "endDate", 259 | "in": "query", 260 | "description": "结束时间", 261 | "required": false, 262 | "schema": { 263 | "type": "string" 264 | } 265 | }, 266 | { 267 | "name": "taskExecuteType", 268 | "in": "query", 269 | "description": "任务执行类型", 270 | "required": false, 271 | "schema": { 272 | "type": "string", 273 | "enum": [ 274 | "BATCH", 275 | "STREAM" 276 | ] 277 | } 278 | }, 279 | { 280 | "name": "pageNo", 281 | "in": "query", 282 | "description": "页码号", 283 | "required": true, 284 | "schema": { 285 | "type": "integer", 286 | "format": "int32" 287 | } 288 | }, 289 | { 290 | "name": "pageSize", 291 | "in": "query", 292 | "description": "页大小", 293 | "required": true, 294 | "schema": { 295 | "type": "integer", 296 | "format": "int32" 297 | } 298 | } 299 | ], 300 | "responses": { 301 | "200": { 302 | "description": "OK", 303 | "content": { 304 | "*/*": { 305 | "schema": { 306 | "$ref": "#/components/schemas/Result" 307 | } 308 | } 309 | } 310 | } 311 | } 312 | } 313 | }, 314 | "/projects/{projectCode}/task-instances/{id}/remove-cache": { 315 | "delete": { 316 | "tags": [ 317 | "任务实例相关操作" 318 | ], 319 | "summary": "remove-task-instance-cache", 320 | "description": "REMOVE_TASK_INSTANCE_CACHE", 321 | "operationId": "removeTaskInstanceCache", 322 | "parameters": [ 323 | { 324 | "name": "projectCode", 325 | "in": "path", 326 | "description": "项目Code", 327 | "required": true, 328 | "schema": { 329 | "type": "integer", 330 | "format": "int64" 331 | } 332 | }, 333 | { 334 | "name": "id", 335 | "in": "path", 336 | "description": "任务实例ID", 337 | "required": true, 338 | "schema": { 339 | "type": "integer", 340 | "format": "int32" 341 | } 342 | } 343 | ], 344 | "responses": { 345 | "200": { 346 | "description": "OK", 347 | "content": { 348 | "*/*": { 349 | "schema": { 350 | "$ref": "#/components/schemas/TaskInstanceRemoveCacheResponse" 351 | } 352 | } 353 | } 354 | } 355 | } 356 | } 357 | } 358 | } 359 | } ``` -------------------------------------------------------------------------------- /mcp-openapi-split/paths/17_process_task_relation_api.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "paths": { 3 | "/projects/{projectCode}/process-task-relation": { 4 | "post": { 5 | "tags": [ 6 | "工作流关系相关操作" 7 | ], 8 | "summary": "save", 9 | "description": "创建工作流任务关系", 10 | "operationId": "createProcessTaskRelation", 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": "preTaskCode", 34 | "in": "query", 35 | "description": "PRE_TASK_CODE", 36 | "required": true, 37 | "schema": { 38 | "type": "integer", 39 | "format": "int64" 40 | } 41 | }, 42 | { 43 | "name": "postTaskCode", 44 | "in": "query", 45 | "description": "POST_TASK_CODE", 46 | "required": true, 47 | "schema": { 48 | "type": "integer", 49 | "format": "int64" 50 | } 51 | } 52 | ], 53 | "responses": { 54 | "201": { 55 | "description": "Created", 56 | "content": { 57 | "*/*": { 58 | "schema": { 59 | "$ref": "#/components/schemas/Result" 60 | } 61 | } 62 | } 63 | } 64 | } 65 | } 66 | }, 67 | "/projects/{projectCode}/process-task-relation/{taskCode}/upstream": { 68 | "get": { 69 | "tags": [ 70 | "工作流关系相关操作" 71 | ], 72 | "summary": "queryUpstreamRelation", 73 | "description": "查询上游工作流任务关系", 74 | "operationId": "queryUpstreamRelation", 75 | "parameters": [ 76 | { 77 | "name": "projectCode", 78 | "in": "path", 79 | "description": "项目Code", 80 | "required": true, 81 | "schema": { 82 | "type": "integer", 83 | "format": "int64" 84 | } 85 | }, 86 | { 87 | "name": "taskCode", 88 | "in": "path", 89 | "description": "TASK_CODE", 90 | "required": true, 91 | "schema": { 92 | "type": "integer", 93 | "format": "int64" 94 | } 95 | } 96 | ], 97 | "responses": { 98 | "200": { 99 | "description": "OK", 100 | "content": { 101 | "*/*": { 102 | "schema": { 103 | "$ref": "#/components/schemas/Result" 104 | } 105 | } 106 | } 107 | } 108 | } 109 | }, 110 | "delete": { 111 | "tags": [ 112 | "工作流关系相关操作" 113 | ], 114 | "summary": "deleteUpstreamRelation", 115 | "description": "删除上游工作流任务关系", 116 | "operationId": "deleteUpstreamRelation", 117 | "parameters": [ 118 | { 119 | "name": "projectCode", 120 | "in": "path", 121 | "description": "项目Code", 122 | "required": true, 123 | "schema": { 124 | "type": "integer", 125 | "format": "int64" 126 | } 127 | }, 128 | { 129 | "name": "preTaskCodes", 130 | "in": "query", 131 | "description": "PRE_TASK_CODES", 132 | "required": true, 133 | "schema": { 134 | "type": "string" 135 | } 136 | }, 137 | { 138 | "name": "taskCode", 139 | "in": "path", 140 | "description": "TASK_CODE", 141 | "required": true, 142 | "schema": { 143 | "type": "integer", 144 | "format": "int64" 145 | } 146 | } 147 | ], 148 | "responses": { 149 | "200": { 150 | "description": "OK", 151 | "content": { 152 | "*/*": { 153 | "schema": { 154 | "$ref": "#/components/schemas/Result" 155 | } 156 | } 157 | } 158 | } 159 | } 160 | } 161 | }, 162 | "/projects/{projectCode}/process-task-relation/{taskCode}/downstream": { 163 | "get": { 164 | "tags": [ 165 | "工作流关系相关操作" 166 | ], 167 | "summary": "queryDownstreamRelation", 168 | "description": "查询下游工作流任务关系", 169 | "operationId": "queryDownstreamRelation", 170 | "parameters": [ 171 | { 172 | "name": "projectCode", 173 | "in": "path", 174 | "description": "项目Code", 175 | "required": true, 176 | "schema": { 177 | "type": "integer", 178 | "format": "int64" 179 | } 180 | }, 181 | { 182 | "name": "taskCode", 183 | "in": "path", 184 | "description": "TASK_CODE", 185 | "required": true, 186 | "schema": { 187 | "type": "integer", 188 | "format": "int64" 189 | } 190 | } 191 | ], 192 | "responses": { 193 | "200": { 194 | "description": "OK", 195 | "content": { 196 | "*/*": { 197 | "schema": { 198 | "$ref": "#/components/schemas/Result" 199 | } 200 | } 201 | } 202 | } 203 | } 204 | }, 205 | "delete": { 206 | "tags": [ 207 | "工作流关系相关操作" 208 | ], 209 | "summary": "deleteDownstreamRelation", 210 | "description": "删除下游工作流任务关系", 211 | "operationId": "deleteDownstreamRelation", 212 | "parameters": [ 213 | { 214 | "name": "projectCode", 215 | "in": "path", 216 | "description": "项目Code", 217 | "required": true, 218 | "schema": { 219 | "type": "integer", 220 | "format": "int64" 221 | } 222 | }, 223 | { 224 | "name": "postTaskCodes", 225 | "in": "query", 226 | "description": "POST_TASK_CODES", 227 | "required": true, 228 | "schema": { 229 | "type": "string" 230 | } 231 | }, 232 | { 233 | "name": "taskCode", 234 | "in": "path", 235 | "description": "TASK_CODE", 236 | "required": true, 237 | "schema": { 238 | "type": "integer", 239 | "format": "int64" 240 | } 241 | } 242 | ], 243 | "responses": { 244 | "200": { 245 | "description": "OK", 246 | "content": { 247 | "*/*": { 248 | "schema": { 249 | "$ref": "#/components/schemas/Result" 250 | } 251 | } 252 | } 253 | } 254 | } 255 | } 256 | }, 257 | "/projects/{projectCode}/process-task-relation/{taskCode}": { 258 | "delete": { 259 | "tags": [ 260 | "工作流关系相关操作" 261 | ], 262 | "summary": "deleteRelation", 263 | "description": "删除工作流任务关系", 264 | "operationId": "deleteTaskProcessRelation", 265 | "parameters": [ 266 | { 267 | "name": "projectCode", 268 | "in": "path", 269 | "description": "项目Code", 270 | "required": true, 271 | "schema": { 272 | "type": "integer", 273 | "format": "int64" 274 | } 275 | }, 276 | { 277 | "name": "processDefinitionCode", 278 | "in": "query", 279 | "description": "流程定义编码", 280 | "required": true, 281 | "schema": { 282 | "type": "integer", 283 | "format": "int64" 284 | } 285 | }, 286 | { 287 | "name": "taskCode", 288 | "in": "path", 289 | "description": "TASK_CODE", 290 | "required": true, 291 | "schema": { 292 | "type": "integer", 293 | "format": "int64" 294 | } 295 | } 296 | ], 297 | "responses": { 298 | "200": { 299 | "description": "OK", 300 | "content": { 301 | "*/*": { 302 | "schema": { 303 | "$ref": "#/components/schemas/Result" 304 | } 305 | } 306 | } 307 | } 308 | } 309 | } 310 | }, 311 | "/projects/{projectCode}/process-task-relation/{processDefinitionCode}/{preTaskCode}/{postTaskCode}": { 312 | "delete": { 313 | "tags": [ 314 | "工作流关系相关操作" 315 | ], 316 | "summary": "deleteEdge", 317 | "description": "删除工作流任务连接线", 318 | "operationId": "deleteEdge", 319 | "parameters": [ 320 | { 321 | "name": "projectCode", 322 | "in": "path", 323 | "description": "项目Code", 324 | "required": true, 325 | "schema": { 326 | "type": "integer", 327 | "format": "int64" 328 | } 329 | }, 330 | { 331 | "name": "processDefinitionCode", 332 | "in": "path", 333 | "description": "流程定义编码", 334 | "required": true, 335 | "schema": { 336 | "type": "integer", 337 | "format": "int64" 338 | } 339 | }, 340 | { 341 | "name": "preTaskCode", 342 | "in": "path", 343 | "description": "PRE_TASK_CODE", 344 | "required": true, 345 | "schema": { 346 | "type": "integer", 347 | "format": "int64" 348 | } 349 | }, 350 | { 351 | "name": "postTaskCode", 352 | "in": "path", 353 | "description": "POST_TASK_CODE", 354 | "required": true, 355 | "schema": { 356 | "type": "integer", 357 | "format": "int64" 358 | } 359 | } 360 | ], 361 | "responses": { 362 | "200": { 363 | "description": "OK", 364 | "content": { 365 | "*/*": { 366 | "schema": { 367 | "$ref": "#/components/schemas/Result" 368 | } 369 | } 370 | } 371 | } 372 | } 373 | } 374 | } 375 | } 376 | } ``` -------------------------------------------------------------------------------- /src/dolphinscheduler_mcp/tools_generated/project_tools.py: -------------------------------------------------------------------------------- ```python 1 | """Tools for project 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 GetProjects(FastMCPTool): 11 | """Tool to 通过项目id查询项目信息""" 12 | 13 | name = "get_projects" 14 | description = "通过项目ID查询项目信息" 15 | is_async = True 16 | schema = { 17 | "type": "object", 18 | "properties": { 19 | "code": { 20 | "type": "integer", 21 | "format": "int64", 22 | "description": "\u9879\u76eeCode" 23 | } 24 | }, 25 | "required": [ 26 | "code" 27 | ] 28 | } 29 | 30 | async def _run(self, code) -> Dict: 31 | """Execute the GET operation on /projects/{code}.""" 32 | client = DolphinSchedulerClient() 33 | try: 34 | response = await client.request( 35 | "GET", 36 | f"/projects/{code}" 37 | ) 38 | return {"success": True, "data": response} 39 | finally: 40 | await client.close() 41 | 42 | 43 | class UpdateProjects(FastMCPTool): 44 | """Tool to 更新项目""" 45 | 46 | name = "update_projects" 47 | description = "更新项目" 48 | is_async = True 49 | schema = { 50 | "type": "object", 51 | "properties": { 52 | "code": { 53 | "type": "integer", 54 | "format": "int64", 55 | "description": "\u9879\u76eeCode" 56 | }, 57 | "projectName": { 58 | "type": "string", 59 | "description": "\u9879\u76ee\u540d\u79f0" 60 | }, 61 | "description": { 62 | "type": "string", 63 | "description": "\u9879\u76ee\u63cf\u8ff0" 64 | } 65 | }, 66 | "required": [ 67 | "code", 68 | "projectName" 69 | ] 70 | } 71 | 72 | async def _run(self, code, projectName, description) -> Dict: 73 | """Execute the PUT operation on /projects/{code}.""" 74 | client = DolphinSchedulerClient() 75 | try: 76 | params = { 77 | "projectName": projectName, 78 | "description": description, 79 | } 80 | response = await client.request( 81 | "PUT", 82 | f"/projects/{code}", params=params 83 | ) 84 | return {"success": True, "data": response} 85 | finally: 86 | await client.close() 87 | 88 | 89 | class DeleteProjects(FastMCPTool): 90 | """Tool to 通过id删除项目""" 91 | 92 | name = "delete_projects" 93 | description = "通过ID删除项目" 94 | is_async = True 95 | schema = { 96 | "type": "object", 97 | "properties": { 98 | "code": { 99 | "type": "integer", 100 | "format": "int64", 101 | "description": "\u9879\u76eeCode" 102 | } 103 | }, 104 | "required": [ 105 | "code" 106 | ] 107 | } 108 | 109 | async def _run(self, code) -> Dict: 110 | """Execute the DELETE operation on /projects/{code}.""" 111 | client = DolphinSchedulerClient() 112 | try: 113 | response = await client.request( 114 | "DELETE", 115 | f"/projects/{code}" 116 | ) 117 | return {"success": True, "data": response} 118 | finally: 119 | await client.close() 120 | 121 | 122 | class GetProjects36(FastMCPTool): 123 | """Tool to 分页查询项目列表""" 124 | 125 | name = "get_projects36" 126 | description = "分页查询项目列表" 127 | is_async = True 128 | schema = { 129 | "type": "object", 130 | "properties": { 131 | "searchVal": { 132 | "type": "string", 133 | "description": "\u641c\u7d22\u503c" 134 | }, 135 | "pageSize": { 136 | "type": "integer", 137 | "format": "int32", 138 | "description": "\u9875\u5927\u5c0f" 139 | }, 140 | "pageNo": { 141 | "type": "integer", 142 | "format": "int32", 143 | "description": "\u9875\u7801\u53f7" 144 | } 145 | }, 146 | "required": [ 147 | "pageSize", 148 | "pageNo" 149 | ] 150 | } 151 | 152 | async def _run(self, searchVal, pageSize, pageNo) -> Dict: 153 | """Execute the GET operation on /projects.""" 154 | client = DolphinSchedulerClient() 155 | try: 156 | params = { 157 | "searchVal": searchVal, 158 | "pageSize": pageSize, 159 | "pageNo": pageNo, 160 | } 161 | response = await client.request( 162 | "GET", 163 | f"/projects", params=params 164 | ) 165 | return {"success": True, "data": response} 166 | finally: 167 | await client.close() 168 | 169 | 170 | class CreateProjects(FastMCPTool): 171 | """Tool to 创建项目""" 172 | 173 | name = "create_projects" 174 | description = "创建项目" 175 | is_async = True 176 | schema = { 177 | "type": "object", 178 | "properties": { 179 | "projectName": { 180 | "type": "string", 181 | "description": "\u9879\u76ee\u540d\u79f0" 182 | }, 183 | "description": { 184 | "type": "string", 185 | "description": "\u9879\u76ee\u63cf\u8ff0" 186 | } 187 | }, 188 | "required": [ 189 | "projectName" 190 | ] 191 | } 192 | 193 | async def _run(self, projectName, description) -> Dict: 194 | """Execute the POST operation on /projects.""" 195 | client = DolphinSchedulerClient() 196 | try: 197 | params = { 198 | "projectName": projectName, 199 | "description": description, 200 | } 201 | response = await client.request( 202 | "POST", 203 | f"/projects", params=params 204 | ) 205 | return {"success": True, "data": response} 206 | finally: 207 | await client.close() 208 | 209 | 210 | class GetProjectsUnauthProject(FastMCPTool): 211 | """Tool to 查询未授权的项目""" 212 | 213 | name = "get_projects_unauth_project" 214 | description = "查询未授权的项目" 215 | is_async = True 216 | schema = { 217 | "type": "object", 218 | "properties": { 219 | "userId": { 220 | "type": "integer", 221 | "format": "int32", 222 | "description": "\u7528\u6237ID" 223 | } 224 | }, 225 | "required": [ 226 | "userId" 227 | ] 228 | } 229 | 230 | async def _run(self, userId) -> Dict: 231 | """Execute the GET operation on /projects/unauth-project.""" 232 | client = DolphinSchedulerClient() 233 | try: 234 | params = { 235 | "userId": userId, 236 | } 237 | response = await client.request( 238 | "GET", 239 | f"/projects/unauth-project", params=params 240 | ) 241 | return {"success": True, "data": response} 242 | finally: 243 | await client.close() 244 | 245 | 246 | class GetProjectsProjectWithAuthorizedLevel(FastMCPTool): 247 | """Tool to query_project_authorized_level""" 248 | 249 | name = "get_projects_project_with_authorized_level" 250 | description = "QUERY_PROJECT_AUTHORIZED_LEVEL" 251 | is_async = True 252 | schema = { 253 | "type": "object", 254 | "properties": { 255 | "user_id": { 256 | "type": "integer", 257 | "format": "int32", 258 | "description": "\u7528\u6237ID" 259 | } 260 | }, 261 | "required": [ 262 | "user_id" 263 | ] 264 | } 265 | 266 | async def _run(self, user_id) -> Dict: 267 | """Execute the GET operation on /projects/project-with-authorized-level.""" 268 | client = DolphinSchedulerClient() 269 | try: 270 | params = { 271 | "userId": user_id, 272 | } 273 | response = await client.request( 274 | "GET", 275 | f"/projects/project-with-authorized-level", params=params 276 | ) 277 | return {"success": True, "data": response} 278 | finally: 279 | await client.close() 280 | 281 | 282 | class GetProjectsProjectWithAuthorizedLevelListPaging(FastMCPTool): 283 | """Tool to query_project_with_auth_level_list_paging_notes""" 284 | 285 | name = "get_projects_project_with_authorized_level_list_paging" 286 | description = "QUERY_PROJECT_WITH_AUTH_LEVEL_LIST_PAGING_NOTES" 287 | is_async = True 288 | schema = { 289 | "type": "object", 290 | "properties": { 291 | "user_id": { 292 | "type": "integer", 293 | "format": "int32", 294 | "description": "\u7528\u6237ID" 295 | }, 296 | "search_val": { 297 | "type": "string", 298 | "description": "\u641c\u7d22\u503c" 299 | }, 300 | "page_size": { 301 | "type": "integer", 302 | "format": "int32", 303 | "description": "\u9875\u5927\u5c0f" 304 | }, 305 | "page_no": { 306 | "type": "integer", 307 | "format": "int32", 308 | "description": "\u9875\u7801\u53f7" 309 | } 310 | }, 311 | "required": [ 312 | "user_id", 313 | "page_size", 314 | "page_no" 315 | ] 316 | } 317 | 318 | async def _run(self, user_id, search_val, page_size, page_no) -> Dict: 319 | """Execute the GET operation on /projects/project-with-authorized-level-list-paging.""" 320 | client = DolphinSchedulerClient() 321 | try: 322 | params = { 323 | "userId": user_id, 324 | "searchVal": search_val, 325 | "pageSize": page_size, 326 | "pageNo": page_no, 327 | } 328 | response = await client.request( 329 | "GET", 330 | f"/projects/project-with-authorized-level-list-paging", params=params 331 | ) 332 | return {"success": True, "data": response} 333 | finally: 334 | await client.close() 335 | 336 | 337 | class ListProjectsList(FastMCPTool): 338 | """Tool to 查询所有项目""" 339 | 340 | name = "list_projects_list" 341 | description = "查询所有项目" 342 | is_async = True 343 | 344 | async def _run(self) -> Dict: 345 | """Execute the GET operation on /projects/list.""" 346 | client = DolphinSchedulerClient() 347 | try: 348 | response = await client.request( 349 | "GET", 350 | f"/projects/list" 351 | ) 352 | return {"success": True, "data": response} 353 | finally: 354 | await client.close() 355 | 356 | 357 | class GetProjectsListDependent(FastMCPTool): 358 | """Tool to 查询dependent节点所有项目""" 359 | 360 | name = "get_projects_list_dependent" 361 | description = "查询Dependent节点所有项目" 362 | is_async = True 363 | 364 | async def _run(self) -> Dict: 365 | """Execute the GET operation on /projects/list-dependent.""" 366 | client = DolphinSchedulerClient() 367 | try: 368 | response = await client.request( 369 | "GET", 370 | f"/projects/list-dependent" 371 | ) 372 | return {"success": True, "data": response} 373 | finally: 374 | await client.close() 375 | 376 | 377 | class GetProjectsCreatedAndAuthed(FastMCPTool): 378 | """Tool to 查询授权和用户创建的项目""" 379 | 380 | name = "get_projects_created_and_authed" 381 | description = "查询授权和用户创建的项目" 382 | is_async = True 383 | 384 | async def _run(self) -> Dict: 385 | """Execute the GET operation on /projects/created-and-authed.""" 386 | client = DolphinSchedulerClient() 387 | try: 388 | response = await client.request( 389 | "GET", 390 | f"/projects/created-and-authed" 391 | ) 392 | return {"success": True, "data": response} 393 | finally: 394 | await client.close() 395 | 396 | 397 | class GetProjectsAuthedUser(FastMCPTool): 398 | """Tool to 查询拥有项目授权的用户""" 399 | 400 | name = "get_projects_authed_user" 401 | description = "查询拥有项目授权的用户" 402 | is_async = True 403 | schema = { 404 | "type": "object", 405 | "properties": { 406 | "project_code": { 407 | "type": "integer", 408 | "format": "int64", 409 | "description": "\u9879\u76eeCode" 410 | } 411 | }, 412 | "required": [ 413 | "project_code" 414 | ] 415 | } 416 | 417 | async def _run(self, project_code) -> Dict: 418 | """Execute the GET operation on /projects/authed-user.""" 419 | client = DolphinSchedulerClient() 420 | try: 421 | params = { 422 | "projectCode": project_code, 423 | } 424 | response = await client.request( 425 | "GET", 426 | f"/projects/authed-user", params=params 427 | ) 428 | return {"success": True, "data": response} 429 | finally: 430 | await client.close() 431 | 432 | 433 | class GetProjectsAuthedProject(FastMCPTool): 434 | """Tool to 查询授权项目""" 435 | 436 | name = "get_projects_authed_project" 437 | description = "查询授权项目" 438 | is_async = True 439 | schema = { 440 | "type": "object", 441 | "properties": { 442 | "user_id": { 443 | "type": "integer", 444 | "format": "int32", 445 | "description": "\u7528\u6237ID" 446 | } 447 | }, 448 | "required": [ 449 | "user_id" 450 | ] 451 | } 452 | 453 | async def _run(self, user_id) -> Dict: 454 | """Execute the GET operation on /projects/authed-project.""" 455 | client = DolphinSchedulerClient() 456 | try: 457 | params = { 458 | "userId": user_id, 459 | } 460 | response = await client.request( 461 | "GET", 462 | f"/projects/authed-project", params=params 463 | ) 464 | return {"success": True, "data": response} 465 | finally: 466 | await client.close() 467 | 468 | 469 | def register_project_tools(mcp): 470 | """Register project tools with FastMCP. 471 | 472 | Args: 473 | mcp: The FastMCP instance to register tools with. 474 | """ 475 | from ..fastmcp_compat import register_tool_class 476 | 477 | register_tool_class(mcp, CreateProjects) 478 | register_tool_class(mcp, DeleteProjects) 479 | register_tool_class(mcp, GetProjects) 480 | register_tool_class(mcp, GetProjects36) 481 | register_tool_class(mcp, GetProjectsAuthedProject) 482 | register_tool_class(mcp, GetProjectsAuthedUser) 483 | register_tool_class(mcp, GetProjectsCreatedAndAuthed) 484 | register_tool_class(mcp, GetProjectsListDependent) 485 | register_tool_class(mcp, GetProjectsProjectWithAuthorizedLevel) 486 | register_tool_class(mcp, GetProjectsProjectWithAuthorizedLevelListPaging) 487 | register_tool_class(mcp, GetProjectsUnauthProject) 488 | register_tool_class(mcp, ListProjectsList) 489 | register_tool_class(mcp, UpdateProjects) 490 | ``` -------------------------------------------------------------------------------- /mcp-openapi-split/paths/35_project_api.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "paths": { 3 | "/projects/{code}": { 4 | "get": { 5 | "tags": [ 6 | "项目相关操作" 7 | ], 8 | "summary": "queryProjectByCode", 9 | "description": "通过项目ID查询项目信息", 10 | "operationId": "queryProjectByCode", 11 | "parameters": [ 12 | { 13 | "name": "code", 14 | "in": "path", 15 | "description": "项目Code", 16 | "required": true, 17 | "schema": { 18 | "type": "integer", 19 | "format": "int64" 20 | } 21 | } 22 | ], 23 | "responses": { 24 | "200": { 25 | "description": "OK", 26 | "content": { 27 | "*/*": { 28 | "schema": { 29 | "$ref": "#/components/schemas/Result" 30 | } 31 | } 32 | } 33 | } 34 | } 35 | }, 36 | "put": { 37 | "tags": [ 38 | "项目相关操作" 39 | ], 40 | "summary": "update", 41 | "description": "更新项目", 42 | "operationId": "updateProject", 43 | "parameters": [ 44 | { 45 | "name": "code", 46 | "in": "path", 47 | "description": "项目Code", 48 | "required": true, 49 | "schema": { 50 | "type": "integer", 51 | "format": "int64" 52 | } 53 | }, 54 | { 55 | "name": "projectName", 56 | "in": "query", 57 | "description": "项目名称", 58 | "required": true, 59 | "schema": { 60 | "type": "string" 61 | } 62 | }, 63 | { 64 | "name": "description", 65 | "in": "query", 66 | "description": "项目描述", 67 | "required": false, 68 | "schema": { 69 | "type": "string" 70 | } 71 | } 72 | ], 73 | "responses": { 74 | "200": { 75 | "description": "OK", 76 | "content": { 77 | "*/*": { 78 | "schema": { 79 | "$ref": "#/components/schemas/Result" 80 | } 81 | } 82 | } 83 | } 84 | } 85 | }, 86 | "delete": { 87 | "tags": [ 88 | "项目相关操作" 89 | ], 90 | "summary": "delete", 91 | "description": "通过ID删除项目", 92 | "operationId": "deleteProject", 93 | "parameters": [ 94 | { 95 | "name": "code", 96 | "in": "path", 97 | "description": "项目Code", 98 | "required": true, 99 | "schema": { 100 | "type": "integer", 101 | "format": "int64" 102 | } 103 | } 104 | ], 105 | "responses": { 106 | "200": { 107 | "description": "OK", 108 | "content": { 109 | "*/*": { 110 | "schema": { 111 | "$ref": "#/components/schemas/Result" 112 | } 113 | } 114 | } 115 | } 116 | } 117 | } 118 | }, 119 | "/projects": { 120 | "get": { 121 | "tags": [ 122 | "项目相关操作" 123 | ], 124 | "summary": "queryProjectListPaging", 125 | "description": "分页查询项目列表", 126 | "operationId": "queryProjectListPaging", 127 | "parameters": [ 128 | { 129 | "name": "searchVal", 130 | "in": "query", 131 | "description": "搜索值", 132 | "required": false, 133 | "schema": { 134 | "type": "string" 135 | } 136 | }, 137 | { 138 | "name": "pageSize", 139 | "in": "query", 140 | "description": "页大小", 141 | "required": true, 142 | "schema": { 143 | "type": "integer", 144 | "format": "int32" 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 | "responses": { 159 | "200": { 160 | "description": "OK", 161 | "content": { 162 | "*/*": { 163 | "schema": { 164 | "$ref": "#/components/schemas/Result" 165 | } 166 | } 167 | } 168 | } 169 | } 170 | }, 171 | "post": { 172 | "tags": [ 173 | "项目相关操作" 174 | ], 175 | "summary": "create", 176 | "description": "创建项目", 177 | "operationId": "createProject", 178 | "parameters": [ 179 | { 180 | "name": "projectName", 181 | "in": "query", 182 | "description": "项目名称", 183 | "required": true, 184 | "schema": { 185 | "type": "string" 186 | } 187 | }, 188 | { 189 | "name": "description", 190 | "in": "query", 191 | "description": "项目描述", 192 | "required": false, 193 | "schema": { 194 | "type": "string" 195 | } 196 | } 197 | ], 198 | "responses": { 199 | "201": { 200 | "description": "Created", 201 | "content": { 202 | "*/*": { 203 | "schema": { 204 | "$ref": "#/components/schemas/Result" 205 | } 206 | } 207 | } 208 | } 209 | } 210 | } 211 | }, 212 | "/projects/unauth-project": { 213 | "get": { 214 | "tags": [ 215 | "项目相关操作" 216 | ], 217 | "summary": "queryUnauthorizedProject", 218 | "description": "查询未授权的项目", 219 | "operationId": "queryUnauthorizedProject", 220 | "parameters": [ 221 | { 222 | "name": "userId", 223 | "in": "query", 224 | "description": "用户ID", 225 | "required": true, 226 | "schema": { 227 | "type": "integer", 228 | "format": "int32" 229 | } 230 | } 231 | ], 232 | "responses": { 233 | "200": { 234 | "description": "OK", 235 | "content": { 236 | "*/*": { 237 | "schema": { 238 | "$ref": "#/components/schemas/Result" 239 | } 240 | } 241 | } 242 | } 243 | } 244 | } 245 | }, 246 | "/projects/project-with-authorized-level": { 247 | "get": { 248 | "tags": [ 249 | "项目相关操作" 250 | ], 251 | "summary": "queryProjectWithAuthorizedLevel", 252 | "description": "QUERY_PROJECT_AUTHORIZED_LEVEL", 253 | "operationId": "queryProjectWithAuthorizedLevel", 254 | "parameters": [ 255 | { 256 | "name": "userId", 257 | "in": "query", 258 | "description": "用户ID", 259 | "required": true, 260 | "schema": { 261 | "type": "integer", 262 | "format": "int32" 263 | } 264 | } 265 | ], 266 | "responses": { 267 | "200": { 268 | "description": "OK", 269 | "content": { 270 | "*/*": { 271 | "schema": { 272 | "$ref": "#/components/schemas/Result" 273 | } 274 | } 275 | } 276 | } 277 | } 278 | } 279 | }, 280 | "/projects/project-with-authorized-level-list-paging": { 281 | "get": { 282 | "tags": [ 283 | "项目相关操作" 284 | ], 285 | "summary": "queryProjectWithAuthorizedLevelListPaging", 286 | "description": "QUERY_PROJECT_WITH_AUTH_LEVEL_LIST_PAGING_NOTES", 287 | "operationId": "queryProjectWithAuthorizedLevelListPaging", 288 | "parameters": [ 289 | { 290 | "name": "userId", 291 | "in": "query", 292 | "description": "用户ID", 293 | "required": true, 294 | "schema": { 295 | "type": "integer", 296 | "format": "int32" 297 | } 298 | }, 299 | { 300 | "name": "searchVal", 301 | "in": "query", 302 | "description": "搜索值", 303 | "required": false, 304 | "schema": { 305 | "type": "string" 306 | } 307 | }, 308 | { 309 | "name": "pageSize", 310 | "in": "query", 311 | "description": "页大小", 312 | "required": true, 313 | "schema": { 314 | "type": "integer", 315 | "format": "int32" 316 | } 317 | }, 318 | { 319 | "name": "pageNo", 320 | "in": "query", 321 | "description": "页码号", 322 | "required": true, 323 | "schema": { 324 | "type": "integer", 325 | "format": "int32" 326 | } 327 | } 328 | ], 329 | "responses": { 330 | "200": { 331 | "description": "OK", 332 | "content": { 333 | "*/*": { 334 | "schema": { 335 | "$ref": "#/components/schemas/Result" 336 | } 337 | } 338 | } 339 | } 340 | } 341 | } 342 | }, 343 | "/projects/list": { 344 | "get": { 345 | "tags": [ 346 | "项目相关操作" 347 | ], 348 | "summary": "queryAllProjectList", 349 | "description": "查询所有项目", 350 | "operationId": "queryAllProjectList", 351 | "responses": { 352 | "200": { 353 | "description": "OK", 354 | "content": { 355 | "*/*": { 356 | "schema": { 357 | "$ref": "#/components/schemas/Result" 358 | } 359 | } 360 | } 361 | } 362 | } 363 | } 364 | }, 365 | "/projects/list-dependent": { 366 | "get": { 367 | "tags": [ 368 | "项目相关操作" 369 | ], 370 | "summary": "queryAllProjectListForDependent", 371 | "description": "查询Dependent节点所有项目", 372 | "operationId": "queryAllProjectListForDependent", 373 | "responses": { 374 | "200": { 375 | "description": "OK", 376 | "content": { 377 | "*/*": { 378 | "schema": { 379 | "$ref": "#/components/schemas/Result" 380 | } 381 | } 382 | } 383 | } 384 | } 385 | } 386 | }, 387 | "/projects/created-and-authed": { 388 | "get": { 389 | "tags": [ 390 | "项目相关操作" 391 | ], 392 | "summary": "queryProjectCreatedAndAuthorizedByUser", 393 | "description": "查询授权和用户创建的项目", 394 | "operationId": "queryProjectCreatedAndAuthorizedByUser", 395 | "responses": { 396 | "200": { 397 | "description": "OK", 398 | "content": { 399 | "*/*": { 400 | "schema": { 401 | "$ref": "#/components/schemas/Result" 402 | } 403 | } 404 | } 405 | } 406 | } 407 | } 408 | }, 409 | "/projects/authed-user": { 410 | "get": { 411 | "tags": [ 412 | "项目相关操作" 413 | ], 414 | "summary": "queryAuthorizedUser", 415 | "description": "查询拥有项目授权的用户", 416 | "operationId": "queryAuthorizedUser", 417 | "parameters": [ 418 | { 419 | "name": "projectCode", 420 | "in": "query", 421 | "description": "项目Code", 422 | "required": true, 423 | "schema": { 424 | "type": "integer", 425 | "format": "int64" 426 | } 427 | } 428 | ], 429 | "responses": { 430 | "200": { 431 | "description": "OK", 432 | "content": { 433 | "*/*": { 434 | "schema": { 435 | "$ref": "#/components/schemas/Result" 436 | } 437 | } 438 | } 439 | } 440 | } 441 | } 442 | }, 443 | "/projects/authed-project": { 444 | "get": { 445 | "tags": [ 446 | "项目相关操作" 447 | ], 448 | "summary": "queryAuthorizedProject", 449 | "description": "查询授权项目", 450 | "operationId": "queryAuthorizedProject", 451 | "parameters": [ 452 | { 453 | "name": "userId", 454 | "in": "query", 455 | "description": "用户ID", 456 | "required": true, 457 | "schema": { 458 | "type": "integer", 459 | "format": "int32" 460 | } 461 | } 462 | ], 463 | "responses": { 464 | "200": { 465 | "description": "OK", 466 | "content": { 467 | "*/*": { 468 | "schema": { 469 | "$ref": "#/components/schemas/Result" 470 | } 471 | } 472 | } 473 | } 474 | } 475 | } 476 | } 477 | } 478 | } ``` -------------------------------------------------------------------------------- /src/dolphinscheduler_mcp/tools_generated/datasource_tools.py: -------------------------------------------------------------------------------- ```python 1 | """Tools for data source 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 GetDatasources(FastMCPTool): 11 | """Tool to 查询数据源通过id""" 12 | 13 | name = "get_datasources" 14 | description = "查询数据源通过ID" 15 | is_async = True 16 | schema = { 17 | "type": "object", 18 | "properties": { 19 | "id": { 20 | "type": "integer", 21 | "format": "int32", 22 | "description": "\u6570\u636e\u6e90ID" 23 | } 24 | }, 25 | "required": [ 26 | "id" 27 | ] 28 | } 29 | 30 | async def _run(self, id) -> Dict: 31 | """Execute the GET operation on /datasources/{id}.""" 32 | client = DolphinSchedulerClient() 33 | try: 34 | response = await client.request( 35 | "GET", 36 | f"/datasources/{id}" 37 | ) 38 | return {"success": True, "data": response} 39 | finally: 40 | await client.close() 41 | 42 | 43 | class UpdateDatasources(FastMCPTool): 44 | """Tool to 更新数据源""" 45 | 46 | name = "update_datasources" 47 | description = "更新数据源" 48 | is_async = True 49 | schema = { 50 | "type": "object", 51 | "properties": { 52 | "id": { 53 | "type": "integer", 54 | "format": "int32", 55 | "description": "\u6570\u636e\u6e90ID" 56 | }, 57 | "data_source_param": { 58 | "type": "object", 59 | "description": "\u6570\u636e\u6e90\u53c2\u6570" 60 | } 61 | }, 62 | "required": [ 63 | "id", 64 | "data_source_param" 65 | ] 66 | } 67 | 68 | async def _run(self, id, data_source_param) -> Dict: 69 | """Execute the PUT operation on /datasources/{id}.""" 70 | client = DolphinSchedulerClient() 71 | try: 72 | response = await client.request( 73 | "PUT", 74 | f"/datasources/{id}" 75 | ) 76 | return {"success": True, "data": response} 77 | finally: 78 | await client.close() 79 | 80 | 81 | class DeleteDatasources(FastMCPTool): 82 | """Tool to 删除数据源""" 83 | 84 | name = "delete_datasources" 85 | description = "删除数据源" 86 | is_async = True 87 | schema = { 88 | "type": "object", 89 | "properties": { 90 | "id": { 91 | "type": "integer", 92 | "format": "int32", 93 | "description": "\u6570\u636e\u6e90ID" 94 | } 95 | }, 96 | "required": [ 97 | "id" 98 | ] 99 | } 100 | 101 | async def _run(self, id) -> Dict: 102 | """Execute the DELETE operation on /datasources/{id}.""" 103 | client = DolphinSchedulerClient() 104 | try: 105 | response = await client.request( 106 | "DELETE", 107 | f"/datasources/{id}" 108 | ) 109 | return {"success": True, "data": response} 110 | finally: 111 | await client.close() 112 | 113 | 114 | class GetDatasources2(FastMCPTool): 115 | """Tool to 分页查询数据源列表""" 116 | 117 | name = "get_datasources2" 118 | description = "分页查询数据源列表" 119 | is_async = True 120 | schema = { 121 | "type": "object", 122 | "properties": { 123 | "search_val": { 124 | "type": "string", 125 | "description": "\u641c\u7d22\u503c" 126 | }, 127 | "page_no": { 128 | "type": "integer", 129 | "format": "int32", 130 | "description": "\u9875\u7801\u53f7" 131 | }, 132 | "page_size": { 133 | "type": "integer", 134 | "format": "int32", 135 | "description": "\u9875\u5927\u5c0f" 136 | } 137 | }, 138 | "required": [ 139 | "page_no", 140 | "page_size" 141 | ] 142 | } 143 | 144 | async def _run(self, search_val, page_no, page_size) -> Dict: 145 | """Execute the GET operation on /datasources.""" 146 | client = DolphinSchedulerClient() 147 | try: 148 | params = { 149 | "searchVal": search_val, 150 | "pageNo": page_no, 151 | "pageSize": page_size, 152 | } 153 | response = await client.request( 154 | "GET", 155 | f"/datasources", params=params 156 | ) 157 | return {"success": True, "data": response} 158 | finally: 159 | await client.close() 160 | 161 | 162 | class CreateDatasources(FastMCPTool): 163 | """Tool to 创建数据源""" 164 | 165 | name = "create_datasources" 166 | description = "创建数据源" 167 | is_async = True 168 | 169 | async def _run(self) -> Dict: 170 | """Execute the POST operation on /datasources.""" 171 | client = DolphinSchedulerClient() 172 | try: 173 | response = await client.request( 174 | "POST", 175 | f"/datasources" 176 | ) 177 | return {"success": True, "data": response} 178 | finally: 179 | await client.close() 180 | 181 | 182 | class CreateDatasourcesConnect(FastMCPTool): 183 | """Tool to 连接数据源""" 184 | 185 | name = "create_datasources_connect" 186 | description = "连接数据源" 187 | is_async = True 188 | 189 | async def _run(self) -> Dict: 190 | """Execute the POST operation on /datasources/connect.""" 191 | client = DolphinSchedulerClient() 192 | try: 193 | response = await client.request( 194 | "POST", 195 | f"/datasources/connect" 196 | ) 197 | return {"success": True, "data": response} 198 | finally: 199 | await client.close() 200 | 201 | 202 | class GetDatasourcesConnectTest(FastMCPTool): 203 | """Tool to 连接数据源测试""" 204 | 205 | name = "get_datasources_connect_test" 206 | description = "连接数据源测试" 207 | is_async = True 208 | schema = { 209 | "type": "object", 210 | "properties": { 211 | "id": { 212 | "type": "integer", 213 | "format": "int32", 214 | "description": "\u6570\u636e\u6e90ID" 215 | } 216 | }, 217 | "required": [ 218 | "id" 219 | ] 220 | } 221 | 222 | async def _run(self, id) -> Dict: 223 | """Execute the GET operation on /datasources/{id}/connect-test.""" 224 | client = DolphinSchedulerClient() 225 | try: 226 | response = await client.request( 227 | "GET", 228 | f"/datasources/{id}/connect-test" 229 | ) 230 | return {"success": True, "data": response} 231 | finally: 232 | await client.close() 233 | 234 | 235 | class GetDatasourcesVerifyName(FastMCPTool): 236 | """Tool to 验证数据源""" 237 | 238 | name = "get_datasources_verify_name" 239 | description = "验证数据源" 240 | is_async = True 241 | schema = { 242 | "type": "object", 243 | "properties": { 244 | "name": { 245 | "type": "string", 246 | "description": "\u6570\u636e\u6e90\u540d\u79f0" 247 | } 248 | }, 249 | "required": [ 250 | "name" 251 | ] 252 | } 253 | 254 | async def _run(self, name) -> Dict: 255 | """Execute the GET operation on /datasources/verify-name.""" 256 | client = DolphinSchedulerClient() 257 | try: 258 | params = { 259 | "name": name, 260 | } 261 | response = await client.request( 262 | "GET", 263 | f"/datasources/verify-name", params=params 264 | ) 265 | return {"success": True, "data": response} 266 | finally: 267 | await client.close() 268 | 269 | 270 | class GetDatasourcesUnauthDatasource(FastMCPTool): 271 | """Tool to 未授权的数据源""" 272 | 273 | name = "get_datasources_unauth_datasource" 274 | description = "未授权的数据源" 275 | is_async = True 276 | schema = { 277 | "type": "object", 278 | "properties": { 279 | "user_id": { 280 | "type": "integer", 281 | "format": "int32", 282 | "description": "\u7528\u6237ID" 283 | } 284 | }, 285 | "required": [ 286 | "user_id" 287 | ] 288 | } 289 | 290 | async def _run(self, user_id) -> Dict: 291 | """Execute the GET operation on /datasources/unauth-datasource.""" 292 | client = DolphinSchedulerClient() 293 | try: 294 | params = { 295 | "userId": user_id, 296 | } 297 | response = await client.request( 298 | "GET", 299 | f"/datasources/unauth-datasource", params=params 300 | ) 301 | return {"success": True, "data": response} 302 | finally: 303 | await client.close() 304 | 305 | 306 | class ListDatasourcesTables(FastMCPTool): 307 | """Tool to 获取数据源表列表""" 308 | 309 | name = "list_datasources_tables" 310 | description = "获取数据源表列表" 311 | is_async = True 312 | schema = { 313 | "type": "object", 314 | "properties": { 315 | "datasource_id": { 316 | "type": "integer", 317 | "format": "int32", 318 | "description": "\u6570\u636e\u6e90ID" 319 | }, 320 | "database": { 321 | "type": "string", 322 | "description": "DATABASE" 323 | } 324 | }, 325 | "required": [ 326 | "datasource_id", 327 | "database" 328 | ] 329 | } 330 | 331 | async def _run(self, datasource_id, database) -> Dict: 332 | """Execute the GET operation on /datasources/tables.""" 333 | client = DolphinSchedulerClient() 334 | try: 335 | params = { 336 | "datasourceId": datasource_id, 337 | "database": database, 338 | } 339 | response = await client.request( 340 | "GET", 341 | f"/datasources/tables", params=params 342 | ) 343 | return {"success": True, "data": response} 344 | finally: 345 | await client.close() 346 | 347 | 348 | class ListDatasourcesTablecolumns(FastMCPTool): 349 | """Tool to 获取数据源表列名""" 350 | 351 | name = "list_datasources_tablecolumns" 352 | description = "获取数据源表列名" 353 | is_async = True 354 | schema = { 355 | "type": "object", 356 | "properties": { 357 | "datasource_id": { 358 | "type": "integer", 359 | "format": "int32", 360 | "description": "\u6570\u636e\u6e90ID" 361 | }, 362 | "table_name": { 363 | "type": "string", 364 | "description": "\u8868\u540d" 365 | }, 366 | "database": { 367 | "type": "string", 368 | "description": "DATABASE" 369 | } 370 | }, 371 | "required": [ 372 | "datasource_id", 373 | "table_name", 374 | "database" 375 | ] 376 | } 377 | 378 | async def _run(self, datasource_id, table_name, database) -> Dict: 379 | """Execute the GET operation on /datasources/tableColumns.""" 380 | client = DolphinSchedulerClient() 381 | try: 382 | params = { 383 | "datasourceId": datasource_id, 384 | "tableName": table_name, 385 | "database": database, 386 | } 387 | response = await client.request( 388 | "GET", 389 | f"/datasources/tableColumns", params=params 390 | ) 391 | return {"success": True, "data": response} 392 | finally: 393 | await client.close() 394 | 395 | 396 | class ListDatasourcesList(FastMCPTool): 397 | """Tool to 通过数据源类型查询数据源列表""" 398 | 399 | name = "list_datasources_list" 400 | description = "通过数据源类型查询数据源列表" 401 | is_async = True 402 | schema = { 403 | "type": "object", 404 | "properties": { 405 | "type": { 406 | "type": "string", 407 | "enum": [ 408 | "MYSQL", 409 | "POSTGRESQL", 410 | "HIVE", 411 | "SPARK", 412 | "CLICKHOUSE", 413 | "ORACLE", 414 | "SQLSERVER", 415 | "DB2", 416 | "PRESTO", 417 | "H2", 418 | "REDSHIFT", 419 | "ATHENA", 420 | "TRINO", 421 | "STARROCKS", 422 | "AZURESQL", 423 | "DAMENG", 424 | "OCEANBASE", 425 | "SSH", 426 | "KYUUBI", 427 | "DATABEND", 428 | "SNOWFLAKE", 429 | "VERTICA", 430 | "HANA", 431 | "DORIS", 432 | "ZEPPELIN", 433 | "SAGEMAKER" 434 | ], 435 | "description": "\u6570\u636e\u6e90\u7c7b\u578b" 436 | } 437 | }, 438 | "required": [ 439 | "type" 440 | ] 441 | } 442 | 443 | async def _run(self, type) -> Dict: 444 | """Execute the GET operation on /datasources/list.""" 445 | client = DolphinSchedulerClient() 446 | try: 447 | params = { 448 | "type": type, 449 | } 450 | response = await client.request( 451 | "GET", 452 | f"/datasources/list", params=params 453 | ) 454 | return {"success": True, "data": response} 455 | finally: 456 | await client.close() 457 | 458 | 459 | class GetDatasourcesKerberosStartupState(FastMCPTool): 460 | """Tool to 获取用户信息""" 461 | 462 | name = "get_datasources_kerberos_startup_state" 463 | description = "获取用户信息" 464 | is_async = True 465 | 466 | async def _run(self) -> Dict: 467 | """Execute the GET operation on /datasources/kerberos-startup-state.""" 468 | client = DolphinSchedulerClient() 469 | try: 470 | response = await client.request( 471 | "GET", 472 | f"/datasources/kerberos-startup-state" 473 | ) 474 | return {"success": True, "data": response} 475 | finally: 476 | await client.close() 477 | 478 | 479 | class ListDatasourcesDatabases(FastMCPTool): 480 | """Tool to get_datasource_database_notes""" 481 | 482 | name = "list_datasources_databases" 483 | description = "GET_DATASOURCE_DATABASE_NOTES" 484 | is_async = True 485 | schema = { 486 | "type": "object", 487 | "properties": { 488 | "datasource_id": { 489 | "type": "integer", 490 | "format": "int32", 491 | "description": "\u6570\u636e\u6e90ID" 492 | } 493 | }, 494 | "required": [ 495 | "datasource_id" 496 | ] 497 | } 498 | 499 | async def _run(self, datasource_id) -> Dict: 500 | """Execute the GET operation on /datasources/databases.""" 501 | client = DolphinSchedulerClient() 502 | try: 503 | params = { 504 | "datasourceId": datasource_id, 505 | } 506 | response = await client.request( 507 | "GET", 508 | f"/datasources/databases", params=params 509 | ) 510 | return {"success": True, "data": response} 511 | finally: 512 | await client.close() 513 | 514 | 515 | class GetDatasourcesAuthedDatasource(FastMCPTool): 516 | """Tool to 授权的数据源""" 517 | 518 | name = "get_datasources_authed_datasource" 519 | description = "授权的数据源" 520 | is_async = True 521 | schema = { 522 | "type": "object", 523 | "properties": { 524 | "user_id": { 525 | "type": "integer", 526 | "format": "int32", 527 | "description": "\u7528\u6237ID" 528 | } 529 | }, 530 | "required": [ 531 | "user_id" 532 | ] 533 | } 534 | 535 | async def _run(self, user_id) -> Dict: 536 | """Execute the GET operation on /datasources/authed-datasource.""" 537 | client = DolphinSchedulerClient() 538 | try: 539 | params = { 540 | "userId": user_id, 541 | } 542 | response = await client.request( 543 | "GET", 544 | f"/datasources/authed-datasource", params=params 545 | ) 546 | return {"success": True, "data": response} 547 | finally: 548 | await client.close() 549 | 550 | 551 | def register_datasource_tools(mcp): 552 | """Register datasource tools with FastMCP. 553 | 554 | Args: 555 | mcp: The FastMCP instance to register tools with. 556 | """ 557 | from ..fastmcp_compat import register_tool_class 558 | 559 | register_tool_class(mcp, CreateDatasources) 560 | register_tool_class(mcp, CreateDatasourcesConnect) 561 | register_tool_class(mcp, DeleteDatasources) 562 | register_tool_class(mcp, GetDatasources) 563 | register_tool_class(mcp, GetDatasources2) 564 | register_tool_class(mcp, GetDatasourcesAuthedDatasource) 565 | register_tool_class(mcp, GetDatasourcesConnectTest) 566 | register_tool_class(mcp, GetDatasourcesKerberosStartupState) 567 | register_tool_class(mcp, GetDatasourcesUnauthDatasource) 568 | register_tool_class(mcp, GetDatasourcesVerifyName) 569 | register_tool_class(mcp, ListDatasourcesDatabases) 570 | register_tool_class(mcp, ListDatasourcesList) 571 | register_tool_class(mcp, ListDatasourcesTablecolumns) 572 | register_tool_class(mcp, ListDatasourcesTables) 573 | register_tool_class(mcp, UpdateDatasources) 574 | ``` -------------------------------------------------------------------------------- /mcp-openapi-split/paths/11_task_group_api.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "paths": { 3 | "/task-group/update": { 4 | "post": { 5 | "tags": [ 6 | "任务组相关操作" 7 | ], 8 | "summary": "update", 9 | "description": "更新任务组", 10 | "operationId": "updateTaskGroup", 11 | "parameters": [ 12 | { 13 | "name": "id", 14 | "in": "query", 15 | "description": "任务组ID", 16 | "required": true, 17 | "schema": { 18 | "type": "integer", 19 | "format": "int32" 20 | } 21 | }, 22 | { 23 | "name": "name", 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": true, 36 | "schema": { 37 | "type": "string" 38 | } 39 | }, 40 | { 41 | "name": "groupSize", 42 | "in": "query", 43 | "description": "任务组大小", 44 | "required": true, 45 | "schema": { 46 | "type": "integer", 47 | "format": "int32" 48 | } 49 | } 50 | ], 51 | "responses": { 52 | "201": { 53 | "description": "Created", 54 | "content": { 55 | "*/*": { 56 | "schema": { 57 | "$ref": "#/components/schemas/Result" 58 | } 59 | } 60 | } 61 | } 62 | } 63 | } 64 | }, 65 | "/task-group/start-task-group": { 66 | "post": { 67 | "tags": [ 68 | "任务组相关操作" 69 | ], 70 | "summary": "startTaskGroup", 71 | "description": "启动任务组", 72 | "operationId": "startTaskGroup", 73 | "parameters": [ 74 | { 75 | "name": "id", 76 | "in": "query", 77 | "description": "任务组ID", 78 | "required": true, 79 | "schema": { 80 | "type": "integer", 81 | "format": "int32" 82 | } 83 | } 84 | ], 85 | "responses": { 86 | "201": { 87 | "description": "Created", 88 | "content": { 89 | "*/*": { 90 | "schema": { 91 | "$ref": "#/components/schemas/Result" 92 | } 93 | } 94 | } 95 | } 96 | } 97 | } 98 | }, 99 | "/task-group/modifyPriority": { 100 | "post": { 101 | "tags": [ 102 | "任务组相关操作" 103 | ], 104 | "summary": "modifyPriority", 105 | "description": "修改任务组优先级", 106 | "operationId": "modifyPriority", 107 | "parameters": [ 108 | { 109 | "name": "queueId", 110 | "in": "query", 111 | "description": "任务组队列ID", 112 | "required": true, 113 | "schema": { 114 | "type": "integer", 115 | "format": "int32" 116 | } 117 | }, 118 | { 119 | "name": "priority", 120 | "in": "query", 121 | "description": "任务队列优先级", 122 | "required": true, 123 | "schema": { 124 | "type": "integer", 125 | "format": "int32" 126 | } 127 | } 128 | ], 129 | "responses": { 130 | "201": { 131 | "description": "Created", 132 | "content": { 133 | "*/*": { 134 | "schema": { 135 | "$ref": "#/components/schemas/Result" 136 | } 137 | } 138 | } 139 | } 140 | } 141 | } 142 | }, 143 | "/task-group/forceStart": { 144 | "post": { 145 | "tags": [ 146 | "任务组相关操作" 147 | ], 148 | "summary": "forceStart", 149 | "description": "强制启动任务组", 150 | "operationId": "forceStart", 151 | "parameters": [ 152 | { 153 | "name": "queueId", 154 | "in": "query", 155 | "description": "任务组队列ID", 156 | "required": true, 157 | "schema": { 158 | "type": "integer", 159 | "format": "int32" 160 | } 161 | } 162 | ], 163 | "responses": { 164 | "201": { 165 | "description": "Created", 166 | "content": { 167 | "*/*": { 168 | "schema": { 169 | "$ref": "#/components/schemas/Result" 170 | } 171 | } 172 | } 173 | } 174 | } 175 | } 176 | }, 177 | "/task-group/create": { 178 | "post": { 179 | "tags": [ 180 | "任务组相关操作" 181 | ], 182 | "summary": "create", 183 | "description": "创建任务组", 184 | "operationId": "createTaskGroup", 185 | "parameters": [ 186 | { 187 | "name": "name", 188 | "in": "query", 189 | "description": "NAME", 190 | "required": true, 191 | "schema": { 192 | "type": "string" 193 | } 194 | }, 195 | { 196 | "name": "projectCode", 197 | "in": "query", 198 | "description": "项目Code", 199 | "required": false, 200 | "schema": { 201 | "type": "integer", 202 | "format": "int64" 203 | } 204 | }, 205 | { 206 | "name": "description", 207 | "in": "query", 208 | "description": "任务组描述", 209 | "required": true, 210 | "schema": { 211 | "type": "string" 212 | } 213 | }, 214 | { 215 | "name": "groupSize", 216 | "in": "query", 217 | "description": "任务组大小", 218 | "required": true, 219 | "schema": { 220 | "type": "integer", 221 | "format": "int32" 222 | } 223 | } 224 | ], 225 | "responses": { 226 | "201": { 227 | "description": "Created", 228 | "content": { 229 | "*/*": { 230 | "schema": { 231 | "$ref": "#/components/schemas/Result" 232 | } 233 | } 234 | } 235 | } 236 | } 237 | } 238 | }, 239 | "/task-group/close-task-group": { 240 | "post": { 241 | "tags": [ 242 | "任务组相关操作" 243 | ], 244 | "summary": "closeTaskGroup", 245 | "description": "关闭任务组", 246 | "operationId": "closeTaskGroup", 247 | "parameters": [ 248 | { 249 | "name": "id", 250 | "in": "query", 251 | "description": "ID", 252 | "required": true, 253 | "schema": { 254 | "type": "integer", 255 | "format": "int32" 256 | } 257 | } 258 | ], 259 | "responses": { 260 | "201": { 261 | "description": "Created", 262 | "content": { 263 | "*/*": { 264 | "schema": { 265 | "$ref": "#/components/schemas/Result" 266 | } 267 | } 268 | } 269 | } 270 | } 271 | } 272 | }, 273 | "/task-group/query-list-by-status": { 274 | "get": { 275 | "tags": [ 276 | "任务组相关操作" 277 | ], 278 | "summary": "queryTaskGroupByStatus", 279 | "description": "通过状态查询任务组", 280 | "operationId": "queryTaskGroupByStatus", 281 | "parameters": [ 282 | { 283 | "name": "pageNo", 284 | "in": "query", 285 | "description": "页码号", 286 | "required": true, 287 | "schema": { 288 | "type": "integer", 289 | "format": "int32" 290 | } 291 | }, 292 | { 293 | "name": "status", 294 | "in": "query", 295 | "description": "任务组状态", 296 | "required": true, 297 | "schema": { 298 | "type": "integer", 299 | "format": "int32" 300 | } 301 | }, 302 | { 303 | "name": "pageSize", 304 | "in": "query", 305 | "description": "页大小", 306 | "required": true, 307 | "schema": { 308 | "type": "integer", 309 | "format": "int32" 310 | } 311 | } 312 | ], 313 | "responses": { 314 | "200": { 315 | "description": "OK", 316 | "content": { 317 | "*/*": { 318 | "schema": { 319 | "$ref": "#/components/schemas/Result" 320 | } 321 | } 322 | } 323 | } 324 | } 325 | } 326 | }, 327 | "/task-group/query-list-by-projectCode": { 328 | "get": { 329 | "tags": [ 330 | "任务组相关操作" 331 | ], 332 | "summary": "queryTaskGroupByName", 333 | "description": "通过项目ID查询工作组列表", 334 | "operationId": "queryTaskGroupByCode", 335 | "parameters": [ 336 | { 337 | "name": "pageNo", 338 | "in": "query", 339 | "description": "页码号", 340 | "required": true, 341 | "schema": { 342 | "type": "integer", 343 | "format": "int32" 344 | } 345 | }, 346 | { 347 | "name": "projectCode", 348 | "in": "query", 349 | "description": "项目Code", 350 | "required": true, 351 | "schema": { 352 | "type": "string" 353 | } 354 | }, 355 | { 356 | "name": "pageSize", 357 | "in": "query", 358 | "description": "页大小", 359 | "required": true, 360 | "schema": { 361 | "type": "integer", 362 | "format": "int32" 363 | } 364 | } 365 | ], 366 | "responses": { 367 | "200": { 368 | "description": "OK", 369 | "content": { 370 | "*/*": { 371 | "schema": { 372 | "$ref": "#/components/schemas/Result" 373 | } 374 | } 375 | } 376 | } 377 | } 378 | } 379 | }, 380 | "/task-group/query-list-by-group-id": { 381 | "get": { 382 | "tags": [ 383 | "任务组相关操作" 384 | ], 385 | "summary": "queryTaskGroupQueuesByGroupId", 386 | "description": "QUERY_TASKS_GROUP_GROUP_QUEUES", 387 | "operationId": "queryTaskGroupQueues", 388 | "parameters": [ 389 | { 390 | "name": "groupId", 391 | "in": "query", 392 | "description": "GROUP_ID", 393 | "required": false, 394 | "schema": { 395 | "type": "integer", 396 | "format": "int32" 397 | } 398 | }, 399 | { 400 | "name": "taskInstanceName", 401 | "in": "query", 402 | "description": "任务实例名称", 403 | "required": false, 404 | "schema": { 405 | "type": "string" 406 | } 407 | }, 408 | { 409 | "name": "processInstanceName", 410 | "in": "query", 411 | "description": "流程实例名称", 412 | "required": false, 413 | "schema": { 414 | "type": "string" 415 | } 416 | }, 417 | { 418 | "name": "status", 419 | "in": "query", 420 | "description": "任务组状态", 421 | "required": false, 422 | "schema": { 423 | "type": "integer", 424 | "format": "int32" 425 | } 426 | }, 427 | { 428 | "name": "pageNo", 429 | "in": "query", 430 | "description": "页码号", 431 | "required": true, 432 | "schema": { 433 | "type": "integer", 434 | "format": "int32" 435 | } 436 | }, 437 | { 438 | "name": "pageSize", 439 | "in": "query", 440 | "description": "页大小", 441 | "required": true, 442 | "schema": { 443 | "type": "integer", 444 | "format": "int32" 445 | } 446 | } 447 | ], 448 | "responses": { 449 | "200": { 450 | "description": "OK", 451 | "content": { 452 | "*/*": { 453 | "schema": { 454 | "$ref": "#/components/schemas/Result" 455 | } 456 | } 457 | } 458 | } 459 | } 460 | } 461 | }, 462 | "/task-group/list-paging": { 463 | "get": { 464 | "tags": [ 465 | "任务组相关操作" 466 | ], 467 | "summary": "list-paging", 468 | "description": "查询所有任务组", 469 | "operationId": "queryAllTaskGroup", 470 | "parameters": [ 471 | { 472 | "name": "name", 473 | "in": "query", 474 | "description": "任务组名称", 475 | "required": false, 476 | "schema": { 477 | "type": "string" 478 | } 479 | }, 480 | { 481 | "name": "status", 482 | "in": "query", 483 | "required": false, 484 | "schema": { 485 | "type": "integer", 486 | "format": "int32" 487 | } 488 | }, 489 | { 490 | "name": "pageNo", 491 | "in": "query", 492 | "description": "页码号", 493 | "required": true, 494 | "schema": { 495 | "type": "integer", 496 | "format": "int32" 497 | } 498 | }, 499 | { 500 | "name": "pageSize", 501 | "in": "query", 502 | "description": "页大小", 503 | "required": true, 504 | "schema": { 505 | "type": "integer", 506 | "format": "int32" 507 | } 508 | } 509 | ], 510 | "responses": { 511 | "200": { 512 | "description": "OK", 513 | "content": { 514 | "*/*": { 515 | "schema": { 516 | "$ref": "#/components/schemas/Result" 517 | } 518 | } 519 | } 520 | } 521 | } 522 | } 523 | } 524 | } 525 | } ``` -------------------------------------------------------------------------------- /mcp-openapi-split/paths/19_datasource_api.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "paths": { 3 | "/datasources/{id}": { 4 | "get": { 5 | "tags": [ 6 | "数据源相关操作" 7 | ], 8 | "summary": "queryDataSource", 9 | "description": "查询数据源通过ID", 10 | "operationId": "queryDataSource", 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 | "responses": { 24 | "200": { 25 | "description": "OK", 26 | "content": { 27 | "*/*": { 28 | "schema": { 29 | "$ref": "#/components/schemas/ResultObject" 30 | } 31 | } 32 | } 33 | } 34 | } 35 | }, 36 | "put": { 37 | "tags": [ 38 | "数据源相关操作" 39 | ], 40 | "summary": "updateDataSource", 41 | "description": "更新数据源", 42 | "operationId": "updateDataSource", 43 | "parameters": [ 44 | { 45 | "name": "id", 46 | "in": "path", 47 | "description": "数据源ID", 48 | "required": true, 49 | "schema": { 50 | "type": "integer", 51 | "format": "int32" 52 | } 53 | }, 54 | { 55 | "name": "dataSourceParam", 56 | "description": "数据源参数", 57 | "required": true, 58 | "schema": { 59 | "$ref": "#/components/schemas/BaseDataSourceParamDTO" 60 | } 61 | } 62 | ], 63 | "requestBody": { 64 | "content": { 65 | "application/json": { 66 | "schema": { 67 | "type": "string" 68 | } 69 | } 70 | }, 71 | "required": true 72 | }, 73 | "responses": { 74 | "200": { 75 | "description": "OK", 76 | "content": { 77 | "*/*": { 78 | "schema": { 79 | "$ref": "#/components/schemas/ResultDataSource" 80 | } 81 | } 82 | } 83 | } 84 | } 85 | }, 86 | "delete": { 87 | "tags": [ 88 | "数据源相关操作" 89 | ], 90 | "summary": "deleteDataSource", 91 | "description": "删除数据源", 92 | "operationId": "deleteDataSource", 93 | "parameters": [ 94 | { 95 | "name": "id", 96 | "in": "path", 97 | "description": "数据源ID", 98 | "required": true, 99 | "schema": { 100 | "type": "integer", 101 | "format": "int32" 102 | } 103 | } 104 | ], 105 | "responses": { 106 | "200": { 107 | "description": "OK", 108 | "content": { 109 | "*/*": { 110 | "schema": { 111 | "$ref": "#/components/schemas/ResultBoolean" 112 | } 113 | } 114 | } 115 | } 116 | } 117 | } 118 | }, 119 | "/datasources": { 120 | "get": { 121 | "tags": [ 122 | "数据源相关操作" 123 | ], 124 | "summary": "queryDataSourceListPaging", 125 | "description": "分页查询数据源列表", 126 | "operationId": "queryDataSourceListPaging", 127 | "parameters": [ 128 | { 129 | "name": "searchVal", 130 | "in": "query", 131 | "description": "搜索值", 132 | "required": false, 133 | "schema": { 134 | "type": "string" 135 | } 136 | }, 137 | { 138 | "name": "pageNo", 139 | "in": "query", 140 | "description": "页码号", 141 | "required": true, 142 | "schema": { 143 | "type": "integer", 144 | "format": "int32" 145 | } 146 | }, 147 | { 148 | "name": "pageSize", 149 | "in": "query", 150 | "description": "页大小", 151 | "required": true, 152 | "schema": { 153 | "type": "integer", 154 | "format": "int32" 155 | } 156 | } 157 | ], 158 | "responses": { 159 | "200": { 160 | "description": "OK", 161 | "content": { 162 | "*/*": { 163 | "schema": { 164 | "$ref": "#/components/schemas/ResultObject" 165 | } 166 | } 167 | } 168 | } 169 | } 170 | }, 171 | "post": { 172 | "tags": [ 173 | "数据源相关操作" 174 | ], 175 | "summary": "createDataSource", 176 | "description": "创建数据源", 177 | "operationId": "createDataSource", 178 | "requestBody": { 179 | "content": { 180 | "application/json": { 181 | "schema": { 182 | "type": "string", 183 | "description": "数据源参数" 184 | } 185 | } 186 | }, 187 | "required": true 188 | }, 189 | "responses": { 190 | "201": { 191 | "description": "Created", 192 | "content": { 193 | "*/*": { 194 | "schema": { 195 | "$ref": "#/components/schemas/ResultDataSource" 196 | } 197 | } 198 | } 199 | } 200 | } 201 | } 202 | }, 203 | "/datasources/connect": { 204 | "post": { 205 | "tags": [ 206 | "数据源相关操作" 207 | ], 208 | "summary": "connectDataSource", 209 | "description": "连接数据源", 210 | "operationId": "connectDataSource", 211 | "requestBody": { 212 | "description": "dataSourceParam", 213 | "content": { 214 | "application/json": { 215 | "schema": { 216 | "type": "string" 217 | } 218 | } 219 | }, 220 | "required": true 221 | }, 222 | "responses": { 223 | "200": { 224 | "description": "OK", 225 | "content": { 226 | "*/*": { 227 | "schema": { 228 | "$ref": "#/components/schemas/ResultBoolean" 229 | } 230 | } 231 | } 232 | } 233 | } 234 | } 235 | }, 236 | "/datasources/{id}/connect-test": { 237 | "get": { 238 | "tags": [ 239 | "数据源相关操作" 240 | ], 241 | "summary": "connectionTest", 242 | "description": "连接数据源测试", 243 | "operationId": "connectionTest", 244 | "parameters": [ 245 | { 246 | "name": "id", 247 | "in": "path", 248 | "description": "数据源ID", 249 | "required": true, 250 | "schema": { 251 | "type": "integer", 252 | "format": "int32" 253 | } 254 | } 255 | ], 256 | "responses": { 257 | "200": { 258 | "description": "OK", 259 | "content": { 260 | "*/*": { 261 | "schema": { 262 | "$ref": "#/components/schemas/ResultBoolean" 263 | } 264 | } 265 | } 266 | } 267 | } 268 | } 269 | }, 270 | "/datasources/verify-name": { 271 | "get": { 272 | "tags": [ 273 | "数据源相关操作" 274 | ], 275 | "summary": "verifyDataSourceName", 276 | "description": "验证数据源", 277 | "operationId": "verifyDataSourceName", 278 | "parameters": [ 279 | { 280 | "name": "name", 281 | "in": "query", 282 | "description": "数据源名称", 283 | "required": true, 284 | "schema": { 285 | "type": "string" 286 | } 287 | } 288 | ], 289 | "responses": { 290 | "200": { 291 | "description": "OK", 292 | "content": { 293 | "*/*": { 294 | "schema": { 295 | "$ref": "#/components/schemas/ResultBoolean" 296 | } 297 | } 298 | } 299 | } 300 | } 301 | } 302 | }, 303 | "/datasources/unauth-datasource": { 304 | "get": { 305 | "tags": [ 306 | "数据源相关操作" 307 | ], 308 | "summary": "unauthorizedDatasource", 309 | "description": "未授权的数据源", 310 | "operationId": "unAuthDatasource", 311 | "parameters": [ 312 | { 313 | "name": "userId", 314 | "in": "query", 315 | "description": "用户ID", 316 | "required": true, 317 | "schema": { 318 | "type": "integer", 319 | "format": "int32" 320 | } 321 | } 322 | ], 323 | "responses": { 324 | "200": { 325 | "description": "OK", 326 | "content": { 327 | "*/*": { 328 | "schema": { 329 | "$ref": "#/components/schemas/ResultObject" 330 | } 331 | } 332 | } 333 | } 334 | } 335 | } 336 | }, 337 | "/datasources/tables": { 338 | "get": { 339 | "tags": [ 340 | "数据源相关操作" 341 | ], 342 | "summary": "tables", 343 | "description": "获取数据源表列表", 344 | "operationId": "getTables", 345 | "parameters": [ 346 | { 347 | "name": "datasourceId", 348 | "in": "query", 349 | "description": "数据源ID", 350 | "required": true, 351 | "schema": { 352 | "type": "integer", 353 | "format": "int32" 354 | } 355 | }, 356 | { 357 | "name": "database", 358 | "in": "query", 359 | "description": "DATABASE", 360 | "required": true, 361 | "schema": { 362 | "type": "string" 363 | } 364 | } 365 | ], 366 | "responses": { 367 | "200": { 368 | "description": "OK", 369 | "content": { 370 | "*/*": { 371 | "schema": { 372 | "$ref": "#/components/schemas/ResultObject" 373 | } 374 | } 375 | } 376 | } 377 | } 378 | } 379 | }, 380 | "/datasources/tableColumns": { 381 | "get": { 382 | "tags": [ 383 | "数据源相关操作" 384 | ], 385 | "summary": "tableColumns", 386 | "description": "获取数据源表列名", 387 | "operationId": "getTableColumns", 388 | "parameters": [ 389 | { 390 | "name": "datasourceId", 391 | "in": "query", 392 | "description": "数据源ID", 393 | "required": true, 394 | "schema": { 395 | "type": "integer", 396 | "format": "int32" 397 | } 398 | }, 399 | { 400 | "name": "tableName", 401 | "in": "query", 402 | "description": "表名", 403 | "required": true, 404 | "schema": { 405 | "type": "string" 406 | } 407 | }, 408 | { 409 | "name": "database", 410 | "in": "query", 411 | "description": "DATABASE", 412 | "required": true, 413 | "schema": { 414 | "type": "string" 415 | } 416 | } 417 | ], 418 | "responses": { 419 | "200": { 420 | "description": "OK", 421 | "content": { 422 | "*/*": { 423 | "schema": { 424 | "$ref": "#/components/schemas/ResultObject" 425 | } 426 | } 427 | } 428 | } 429 | } 430 | } 431 | }, 432 | "/datasources/list": { 433 | "get": { 434 | "tags": [ 435 | "数据源相关操作" 436 | ], 437 | "summary": "queryDataSourceList", 438 | "description": "通过数据源类型查询数据源列表", 439 | "operationId": "queryDataSourceList", 440 | "parameters": [ 441 | { 442 | "name": "type", 443 | "in": "query", 444 | "description": "数据源类型", 445 | "required": true, 446 | "schema": { 447 | "type": "string", 448 | "enum": [ 449 | "MYSQL", 450 | "POSTGRESQL", 451 | "HIVE", 452 | "SPARK", 453 | "CLICKHOUSE", 454 | "ORACLE", 455 | "SQLSERVER", 456 | "DB2", 457 | "PRESTO", 458 | "H2", 459 | "REDSHIFT", 460 | "ATHENA", 461 | "TRINO", 462 | "STARROCKS", 463 | "AZURESQL", 464 | "DAMENG", 465 | "OCEANBASE", 466 | "SSH", 467 | "KYUUBI", 468 | "DATABEND", 469 | "SNOWFLAKE", 470 | "VERTICA", 471 | "HANA", 472 | "DORIS", 473 | "ZEPPELIN", 474 | "SAGEMAKER" 475 | ] 476 | } 477 | } 478 | ], 479 | "responses": { 480 | "200": { 481 | "description": "OK", 482 | "content": { 483 | "*/*": { 484 | "schema": { 485 | "$ref": "#/components/schemas/ResultObject" 486 | } 487 | } 488 | } 489 | } 490 | } 491 | } 492 | }, 493 | "/datasources/kerberos-startup-state": { 494 | "get": { 495 | "tags": [ 496 | "数据源相关操作" 497 | ], 498 | "summary": "getKerberosStartupState", 499 | "description": "获取用户信息", 500 | "operationId": "getKerberosStartupState", 501 | "responses": { 502 | "200": { 503 | "description": "OK", 504 | "content": { 505 | "*/*": { 506 | "schema": { 507 | "$ref": "#/components/schemas/ResultObject" 508 | } 509 | } 510 | } 511 | } 512 | } 513 | } 514 | }, 515 | "/datasources/databases": { 516 | "get": { 517 | "tags": [ 518 | "数据源相关操作" 519 | ], 520 | "summary": "databases", 521 | "description": "GET_DATASOURCE_DATABASE_NOTES", 522 | "operationId": "getDatabases", 523 | "parameters": [ 524 | { 525 | "name": "datasourceId", 526 | "in": "query", 527 | "description": "数据源ID", 528 | "required": true, 529 | "schema": { 530 | "type": "integer", 531 | "format": "int32" 532 | } 533 | } 534 | ], 535 | "responses": { 536 | "200": { 537 | "description": "OK", 538 | "content": { 539 | "*/*": { 540 | "schema": { 541 | "$ref": "#/components/schemas/ResultObject" 542 | } 543 | } 544 | } 545 | } 546 | } 547 | } 548 | }, 549 | "/datasources/authed-datasource": { 550 | "get": { 551 | "tags": [ 552 | "数据源相关操作" 553 | ], 554 | "summary": "authedDatasource", 555 | "description": "授权的数据源", 556 | "operationId": "authedDatasource", 557 | "parameters": [ 558 | { 559 | "name": "userId", 560 | "in": "query", 561 | "description": "用户ID", 562 | "required": true, 563 | "schema": { 564 | "type": "integer", 565 | "format": "int32" 566 | } 567 | } 568 | ], 569 | "responses": { 570 | "200": { 571 | "description": "OK", 572 | "content": { 573 | "*/*": { 574 | "schema": { 575 | "$ref": "#/components/schemas/ResultObject" 576 | } 577 | } 578 | } 579 | } 580 | } 581 | } 582 | } 583 | } 584 | } ``` -------------------------------------------------------------------------------- /src/dolphinscheduler_mcp/tools_generated/process_task_relation_tools.py: -------------------------------------------------------------------------------- ```python 1 | """Process Task Relation related operations for DolphinScheduler MCP. 2 | 3 | This module provides tools for managing workflow task relationships in DolphinScheduler. 4 | """ 5 | 6 | from typing import Dict, List, Optional, Any 7 | import logging 8 | 9 | from ..fastmcp_compat import FastMCPTool 10 | from ..client import DolphinSchedulerClient 11 | 12 | # Set up logger 13 | logger = logging.getLogger(__name__) 14 | logger.setLevel(logging.DEBUG) 15 | logger.info("Loading process_task_relation tools module") 16 | 17 | 18 | class CreateProcessTaskRelation(FastMCPTool): 19 | """创建工作流任务关系""" 20 | 21 | name = "create-process-task-relation" 22 | description = "创建工作流任务关系" 23 | is_async = True 24 | schema = { 25 | "type": "object", 26 | "properties": { 27 | "projectCode": { 28 | "type": "integer", 29 | "format": "int64", 30 | "description": "项目Code" 31 | }, 32 | "processDefinitionCode": { 33 | "type": "integer", 34 | "format": "int64", 35 | "description": "流程定义编码" 36 | }, 37 | "preTaskCode": { 38 | "type": "integer", 39 | "format": "int64", 40 | "description": "上游任务编码" 41 | }, 42 | "postTaskCode": { 43 | "type": "integer", 44 | "format": "int64", 45 | "description": "下游任务编码" 46 | } 47 | }, 48 | "required": [ 49 | "projectCode", 50 | "processDefinitionCode", 51 | "preTaskCode", 52 | "postTaskCode" 53 | ] 54 | } 55 | 56 | async def _run(self, projectCode, processDefinitionCode, preTaskCode, postTaskCode) -> Dict: 57 | """执行创建工作流任务关系API请求 58 | 59 | Args: 60 | projectCode: 项目Code 61 | processDefinitionCode: 流程定义编码 62 | preTaskCode: 上游任务编码 63 | postTaskCode: 下游任务编码 64 | 65 | Returns: 66 | API响应 67 | """ 68 | client = DolphinSchedulerClient() 69 | try: 70 | # 确保路径参数正确处理 71 | projectCode = int(projectCode) if projectCode is not None else None 72 | if projectCode is None: 73 | return { 74 | "success": False, 75 | "error": "Missing required parameter: projectCode" 76 | } 77 | 78 | # 确保query参数正确处理 79 | processDefinitionCode = int(processDefinitionCode) if processDefinitionCode is not None else None 80 | preTaskCode = int(preTaskCode) if preTaskCode is not None else None 81 | postTaskCode = int(postTaskCode) if postTaskCode is not None else None 82 | 83 | if processDefinitionCode is None: 84 | return { 85 | "success": False, 86 | "error": "Missing required parameter: processDefinitionCode" 87 | } 88 | 89 | if preTaskCode is None: 90 | return { 91 | "success": False, 92 | "error": "Missing required parameter: preTaskCode" 93 | } 94 | 95 | if postTaskCode is None: 96 | return { 97 | "success": False, 98 | "error": "Missing required parameter: postTaskCode" 99 | } 100 | 101 | # 构建请求参数 (query parameters) 102 | params = { 103 | "processDefinitionCode": processDefinitionCode, 104 | "preTaskCode": preTaskCode, 105 | "postTaskCode": postTaskCode 106 | } 107 | 108 | response = await client.request( 109 | "POST", 110 | f"/projects/{projectCode}/process-task-relation", 111 | params=params # 这些是query参数 112 | ) 113 | return {"success": True, "data": response} 114 | except ValueError: 115 | return { 116 | "success": False, 117 | "error": "Invalid parameter format" 118 | } 119 | except Exception as e: 120 | return { 121 | "success": False, 122 | "error": str(e) 123 | } 124 | finally: 125 | await client.close() 126 | 127 | 128 | class QueryUpstreamRelation(FastMCPTool): 129 | """查询上游工作流任务关系""" 130 | 131 | name = "query-upstream-relation" 132 | description = "查询上游工作流任务关系" 133 | is_async = True 134 | schema = { 135 | "type": "object", 136 | "properties": { 137 | "projectCode": { 138 | "type": "integer", 139 | "format": "int64", 140 | "description": "项目Code" 141 | }, 142 | "taskCode": { 143 | "type": "integer", 144 | "format": "int64", 145 | "description": "任务编码" 146 | } 147 | }, 148 | "required": [ 149 | "projectCode", 150 | "taskCode" 151 | ] 152 | } 153 | 154 | async def _run(self, projectCode, taskCode) -> Dict: 155 | """执行查询上游工作流任务关系API请求 156 | 157 | Args: 158 | projectCode: 项目Code 159 | taskCode: 任务编码 160 | 161 | Returns: 162 | API响应 163 | """ 164 | client = DolphinSchedulerClient() 165 | try: 166 | # 确保path参数正确处理 167 | projectCode = int(projectCode) if projectCode is not None else None 168 | taskCode = int(taskCode) if taskCode is not None else None 169 | 170 | if projectCode is None: 171 | return { 172 | "success": False, 173 | "error": "Missing required parameter: projectCode" 174 | } 175 | 176 | if taskCode is None: 177 | return { 178 | "success": False, 179 | "error": "Missing required parameter: taskCode" 180 | } 181 | 182 | # 所有参数都在URL路径中,不需要额外的query参数 183 | response = await client.request( 184 | "GET", 185 | f"/projects/{projectCode}/process-task-relation/{taskCode}/upstream" 186 | ) 187 | return {"success": True, "data": response} 188 | except ValueError: 189 | return { 190 | "success": False, 191 | "error": "Invalid parameter format" 192 | } 193 | except Exception as e: 194 | return { 195 | "success": False, 196 | "error": str(e) 197 | } 198 | finally: 199 | await client.close() 200 | 201 | 202 | class DeleteUpstreamRelation(FastMCPTool): 203 | """删除上游工作流任务关系""" 204 | 205 | name = "delete-upstream-relation" 206 | description = "删除上游工作流任务关系" 207 | is_async = True 208 | schema = { 209 | "type": "object", 210 | "properties": { 211 | "projectCode": { 212 | "type": "integer", 213 | "format": "int64", 214 | "description": "项目Code" 215 | }, 216 | "taskCode": { 217 | "type": "integer", 218 | "format": "int64", 219 | "description": "任务编码" 220 | }, 221 | "preTaskCodes": { 222 | "type": "string", 223 | "description": "上游任务编码列表,多个用逗号分隔" 224 | } 225 | }, 226 | "required": [ 227 | "projectCode", 228 | "taskCode", 229 | "preTaskCodes" 230 | ] 231 | } 232 | 233 | async def _run(self, projectCode, taskCode, preTaskCodes) -> Dict: 234 | """执行删除上游工作流任务关系API请求 235 | 236 | Args: 237 | projectCode: 项目Code 238 | taskCode: 任务编码 239 | preTaskCodes: 上游任务编码列表,多个用逗号分隔 240 | 241 | Returns: 242 | API响应 243 | """ 244 | client = DolphinSchedulerClient() 245 | try: 246 | # 确保path参数正确处理 247 | projectCode = int(projectCode) if projectCode is not None else None 248 | taskCode = int(taskCode) if taskCode is not None else None 249 | 250 | if projectCode is None: 251 | return { 252 | "success": False, 253 | "error": "Missing required parameter: projectCode" 254 | } 255 | 256 | if taskCode is None: 257 | return { 258 | "success": False, 259 | "error": "Missing required parameter: taskCode" 260 | } 261 | 262 | # 确保query参数正确处理 263 | if preTaskCodes is None: 264 | return { 265 | "success": False, 266 | "error": "Missing required parameter: preTaskCodes" 267 | } 268 | 269 | # 构建请求参数 (query parameters) 270 | params = { 271 | "preTaskCodes": preTaskCodes 272 | } 273 | 274 | response = await client.request( 275 | "DELETE", 276 | f"/projects/{projectCode}/process-task-relation/{taskCode}/upstream", 277 | params=params # 这些是query参数 278 | ) 279 | return {"success": True, "data": response} 280 | except ValueError: 281 | return { 282 | "success": False, 283 | "error": "Invalid parameter format" 284 | } 285 | except Exception as e: 286 | return { 287 | "success": False, 288 | "error": str(e) 289 | } 290 | finally: 291 | await client.close() 292 | 293 | 294 | class QueryDownstreamRelation(FastMCPTool): 295 | """查询下游工作流任务关系""" 296 | 297 | name = "query-downstream-relation" 298 | description = "查询下游工作流任务关系" 299 | is_async = True 300 | schema = { 301 | "type": "object", 302 | "properties": { 303 | "projectCode": { 304 | "type": "integer", 305 | "format": "int64", 306 | "description": "项目Code" 307 | }, 308 | "taskCode": { 309 | "type": "integer", 310 | "format": "int64", 311 | "description": "任务编码" 312 | } 313 | }, 314 | "required": [ 315 | "projectCode", 316 | "taskCode" 317 | ] 318 | } 319 | 320 | async def _run(self, projectCode, taskCode) -> Dict: 321 | """执行查询下游工作流任务关系API请求 322 | 323 | Args: 324 | projectCode: 项目Code 325 | taskCode: 任务编码 326 | 327 | Returns: 328 | API响应 329 | """ 330 | client = DolphinSchedulerClient() 331 | try: 332 | # 确保path参数正确处理 333 | projectCode = int(projectCode) if projectCode is not None else None 334 | taskCode = int(taskCode) if taskCode is not None else None 335 | 336 | if projectCode is None: 337 | return { 338 | "success": False, 339 | "error": "Missing required parameter: projectCode" 340 | } 341 | 342 | if taskCode is None: 343 | return { 344 | "success": False, 345 | "error": "Missing required parameter: taskCode" 346 | } 347 | 348 | # 所有参数都在URL路径中,不需要额外的query参数 349 | response = await client.request( 350 | "GET", 351 | f"/projects/{projectCode}/process-task-relation/{taskCode}/downstream" 352 | ) 353 | return {"success": True, "data": response} 354 | except ValueError: 355 | return { 356 | "success": False, 357 | "error": "Invalid parameter format" 358 | } 359 | except Exception as e: 360 | return { 361 | "success": False, 362 | "error": str(e) 363 | } 364 | finally: 365 | await client.close() 366 | 367 | 368 | class DeleteDownstreamRelation(FastMCPTool): 369 | """删除下游工作流任务关系""" 370 | 371 | name = "delete-downstream-relation" 372 | description = "删除下游工作流任务关系" 373 | is_async = True 374 | schema = { 375 | "type": "object", 376 | "properties": { 377 | "projectCode": { 378 | "type": "integer", 379 | "format": "int64", 380 | "description": "项目Code" 381 | }, 382 | "taskCode": { 383 | "type": "integer", 384 | "format": "int64", 385 | "description": "任务编码" 386 | }, 387 | "postTaskCodes": { 388 | "type": "string", 389 | "description": "下游任务编码列表,多个用逗号分隔" 390 | } 391 | }, 392 | "required": [ 393 | "projectCode", 394 | "taskCode", 395 | "postTaskCodes" 396 | ] 397 | } 398 | 399 | async def _run(self, projectCode, taskCode, postTaskCodes) -> Dict: 400 | """执行删除下游工作流任务关系API请求 401 | 402 | Args: 403 | projectCode: 项目Code 404 | taskCode: 任务编码 405 | postTaskCodes: 下游任务编码列表,多个用逗号分隔 406 | 407 | Returns: 408 | API响应 409 | """ 410 | client = DolphinSchedulerClient() 411 | try: 412 | # 确保path参数正确处理 413 | projectCode = int(projectCode) if projectCode is not None else None 414 | taskCode = int(taskCode) if taskCode is not None else None 415 | 416 | if projectCode is None: 417 | return { 418 | "success": False, 419 | "error": "Missing required parameter: projectCode" 420 | } 421 | 422 | if taskCode is None: 423 | return { 424 | "success": False, 425 | "error": "Missing required parameter: taskCode" 426 | } 427 | 428 | # 确保query参数正确处理 429 | if postTaskCodes is None: 430 | return { 431 | "success": False, 432 | "error": "Missing required parameter: postTaskCodes" 433 | } 434 | 435 | # 构建请求参数 (query parameters) 436 | params = { 437 | "postTaskCodes": postTaskCodes 438 | } 439 | 440 | response = await client.request( 441 | "DELETE", 442 | f"/projects/{projectCode}/process-task-relation/{taskCode}/downstream", 443 | params=params # 这些是query参数 444 | ) 445 | return {"success": True, "data": response} 446 | except ValueError: 447 | return { 448 | "success": False, 449 | "error": "Invalid parameter format" 450 | } 451 | except Exception as e: 452 | return { 453 | "success": False, 454 | "error": str(e) 455 | } 456 | finally: 457 | await client.close() 458 | 459 | 460 | class DeleteTaskProcessRelation(FastMCPTool): 461 | """删除工作流任务关系""" 462 | 463 | name = "delete-task-process-relation" 464 | description = "删除工作流任务关系" 465 | is_async = True 466 | schema = { 467 | "type": "object", 468 | "properties": { 469 | "projectCode": { 470 | "type": "integer", 471 | "format": "int64", 472 | "description": "项目Code" 473 | }, 474 | "taskCode": { 475 | "type": "integer", 476 | "format": "int64", 477 | "description": "任务编码" 478 | }, 479 | "processDefinitionCode": { 480 | "type": "integer", 481 | "format": "int64", 482 | "description": "流程定义编码" 483 | } 484 | }, 485 | "required": [ 486 | "projectCode", 487 | "taskCode", 488 | "processDefinitionCode" 489 | ] 490 | } 491 | 492 | async def _run(self, projectCode, taskCode, processDefinitionCode) -> Dict: 493 | """执行删除工作流任务关系API请求 494 | 495 | Args: 496 | projectCode: 项目Code 497 | taskCode: 任务编码 498 | processDefinitionCode: 流程定义编码 499 | 500 | Returns: 501 | API响应 502 | """ 503 | client = DolphinSchedulerClient() 504 | try: 505 | # 确保path参数正确处理 506 | projectCode = int(projectCode) if projectCode is not None else None 507 | taskCode = int(taskCode) if taskCode is not None else None 508 | 509 | if projectCode is None: 510 | return { 511 | "success": False, 512 | "error": "Missing required parameter: projectCode" 513 | } 514 | 515 | if taskCode is None: 516 | return { 517 | "success": False, 518 | "error": "Missing required parameter: taskCode" 519 | } 520 | 521 | # 确保query参数正确处理 522 | processDefinitionCode = int(processDefinitionCode) if processDefinitionCode is not None else None 523 | if processDefinitionCode is None: 524 | return { 525 | "success": False, 526 | "error": "Missing required parameter: processDefinitionCode" 527 | } 528 | 529 | # 构建请求参数 (query parameters) 530 | params = { 531 | "processDefinitionCode": processDefinitionCode 532 | } 533 | 534 | response = await client.request( 535 | "DELETE", 536 | f"/projects/{projectCode}/process-task-relation/{taskCode}", 537 | params=params # 这些是query参数 538 | ) 539 | return {"success": True, "data": response} 540 | except ValueError: 541 | return { 542 | "success": False, 543 | "error": "Invalid parameter format" 544 | } 545 | except Exception as e: 546 | return { 547 | "success": False, 548 | "error": str(e) 549 | } 550 | finally: 551 | await client.close() 552 | 553 | 554 | class DeleteEdge(FastMCPTool): 555 | """删除工作流任务连接线""" 556 | 557 | name = "delete-edge" 558 | description = "删除工作流任务连接线" 559 | is_async = True 560 | schema = { 561 | "type": "object", 562 | "properties": { 563 | "projectCode": { 564 | "type": "integer", 565 | "format": "int64", 566 | "description": "项目Code" 567 | }, 568 | "processDefinitionCode": { 569 | "type": "integer", 570 | "format": "int64", 571 | "description": "流程定义编码" 572 | }, 573 | "preTaskCode": { 574 | "type": "integer", 575 | "format": "int64", 576 | "description": "上游任务编码" 577 | }, 578 | "postTaskCode": { 579 | "type": "integer", 580 | "format": "int64", 581 | "description": "下游任务编码" 582 | } 583 | }, 584 | "required": [ 585 | "projectCode", 586 | "processDefinitionCode", 587 | "preTaskCode", 588 | "postTaskCode" 589 | ] 590 | } 591 | 592 | async def _run(self, projectCode, processDefinitionCode, preTaskCode, postTaskCode) -> Dict: 593 | """执行删除工作流任务连接线API请求 594 | 595 | Args: 596 | projectCode: 项目Code 597 | processDefinitionCode: 流程定义编码 598 | preTaskCode: 上游任务编码 599 | postTaskCode: 下游任务编码 600 | 601 | Returns: 602 | API响应 603 | """ 604 | client = DolphinSchedulerClient() 605 | try: 606 | # 确保path参数正确处理 607 | projectCode = int(projectCode) if projectCode is not None else None 608 | processDefinitionCode = int(processDefinitionCode) if processDefinitionCode is not None else None 609 | preTaskCode = int(preTaskCode) if preTaskCode is not None else None 610 | postTaskCode = int(postTaskCode) if postTaskCode is not None else None 611 | 612 | if projectCode is None: 613 | return { 614 | "success": False, 615 | "error": "Missing required parameter: projectCode" 616 | } 617 | 618 | if processDefinitionCode is None: 619 | return { 620 | "success": False, 621 | "error": "Missing required parameter: processDefinitionCode" 622 | } 623 | 624 | if preTaskCode is None: 625 | return { 626 | "success": False, 627 | "error": "Missing required parameter: preTaskCode" 628 | } 629 | 630 | if postTaskCode is None: 631 | return { 632 | "success": False, 633 | "error": "Missing required parameter: postTaskCode" 634 | } 635 | 636 | # 所有参数都在URL路径中,不需要额外的query参数 637 | response = await client.request( 638 | "DELETE", 639 | f"/projects/{projectCode}/process-task-relation/{processDefinitionCode}/{preTaskCode}/{postTaskCode}" 640 | ) 641 | return {"success": True, "data": response} 642 | except ValueError: 643 | return { 644 | "success": False, 645 | "error": "Invalid parameter format" 646 | } 647 | except Exception as e: 648 | return { 649 | "success": False, 650 | "error": str(e) 651 | } 652 | finally: 653 | await client.close() 654 | 655 | 656 | def register_process_task_relation_tools(mcp): 657 | """Register process_task_relation tools with FastMCP. 658 | 659 | Args: 660 | mcp: The FastMCP instance to register tools with. 661 | """ 662 | from ..fastmcp_compat import register_tool_class 663 | 664 | logger.info("Registering process_task_relation tools") 665 | 666 | register_tool_class(mcp, CreateProcessTaskRelation) 667 | register_tool_class(mcp, QueryUpstreamRelation) 668 | register_tool_class(mcp, DeleteUpstreamRelation) 669 | register_tool_class(mcp, QueryDownstreamRelation) 670 | register_tool_class(mcp, DeleteDownstreamRelation) 671 | register_tool_class(mcp, DeleteTaskProcessRelation) 672 | register_tool_class(mcp, DeleteEdge) 673 | 674 | logger.info("Successfully registered 7 process_task_relation tools") ``` -------------------------------------------------------------------------------- /mcp-openapi-split/paths/08_task_definition_api.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "paths": { 3 | "/projects/{projectCode}/task-definition/{code}": { 4 | "get": { 5 | "tags": [ 6 | "任务定义相关操作" 7 | ], 8 | "summary": "queryTaskDefinitionByCode", 9 | "description": "查询任务定义详情", 10 | "operationId": "queryTaskDefinitionDetail", 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": "code", 24 | "in": "path", 25 | "description": "任务定义代码", 26 | "required": true, 27 | "schema": { 28 | "type": "integer", 29 | "format": "int64" 30 | } 31 | } 32 | ], 33 | "responses": { 34 | "200": { 35 | "description": "OK", 36 | "content": { 37 | "*/*": { 38 | "schema": { 39 | "$ref": "#/components/schemas/Result" 40 | } 41 | } 42 | } 43 | } 44 | } 45 | }, 46 | "put": { 47 | "tags": [ 48 | "任务定义相关操作" 49 | ], 50 | "summary": "update", 51 | "description": "更新任务定义", 52 | "operationId": "updateTaskDefinition", 53 | "parameters": [ 54 | { 55 | "name": "projectCode", 56 | "in": "path", 57 | "description": "项目Code", 58 | "required": true, 59 | "schema": { 60 | "type": "integer", 61 | "format": "int64" 62 | } 63 | }, 64 | { 65 | "name": "code", 66 | "in": "path", 67 | "description": "任务定义代码", 68 | "required": true, 69 | "schema": { 70 | "type": "integer", 71 | "format": "int64" 72 | } 73 | }, 74 | { 75 | "name": "taskDefinitionJsonObj", 76 | "in": "query", 77 | "description": "任务定义JSON", 78 | "required": true, 79 | "schema": { 80 | "type": "string" 81 | } 82 | } 83 | ], 84 | "responses": { 85 | "200": { 86 | "description": "OK", 87 | "content": { 88 | "*/*": { 89 | "schema": { 90 | "$ref": "#/components/schemas/Result" 91 | } 92 | } 93 | } 94 | } 95 | } 96 | }, 97 | "delete": { 98 | "tags": [ 99 | "任务定义相关操作" 100 | ], 101 | "summary": "deleteTaskDefinition", 102 | "description": "通过任务代码删除任务定义", 103 | "operationId": "deleteTaskDefinitionByCode", 104 | "parameters": [ 105 | { 106 | "name": "projectCode", 107 | "in": "path", 108 | "description": "项目Code", 109 | "required": true, 110 | "schema": { 111 | "type": "integer", 112 | "format": "int64" 113 | } 114 | }, 115 | { 116 | "name": "code", 117 | "in": "path", 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 | "/projects/{projectCode}/task-definition/{code}/with-upstream": { 141 | "put": { 142 | "tags": [ 143 | "任务定义相关操作" 144 | ], 145 | "summary": "updateWithUpstream", 146 | "description": "更新任务定义", 147 | "operationId": "updateTaskWithUpstream", 148 | "parameters": [ 149 | { 150 | "name": "projectCode", 151 | "in": "path", 152 | "description": "项目Code", 153 | "required": true, 154 | "schema": { 155 | "type": "integer", 156 | "format": "int64" 157 | } 158 | }, 159 | { 160 | "name": "code", 161 | "in": "path", 162 | "description": "任务定义代码", 163 | "required": true, 164 | "schema": { 165 | "type": "integer", 166 | "format": "int64" 167 | } 168 | }, 169 | { 170 | "name": "taskDefinitionJsonObj", 171 | "in": "query", 172 | "description": "任务定义JSON", 173 | "required": true, 174 | "schema": { 175 | "type": "string" 176 | } 177 | }, 178 | { 179 | "name": "upstreamCodes", 180 | "in": "query", 181 | "description": "上游代码列表", 182 | "required": false, 183 | "schema": { 184 | "type": "string" 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 | "/projects/{projectCode}/task-definition": { 203 | "get": { 204 | "tags": [ 205 | "任务定义相关操作" 206 | ], 207 | "summary": "queryTaskDefinitionListPaging", 208 | "description": "查询任务定义列表页面", 209 | "operationId": "queryTaskDefinitionListPaging", 210 | "parameters": [ 211 | { 212 | "name": "projectCode", 213 | "in": "path", 214 | "description": "项目Code", 215 | "required": true, 216 | "schema": { 217 | "type": "integer", 218 | "format": "int64" 219 | } 220 | }, 221 | { 222 | "name": "searchTaskName", 223 | "in": "query", 224 | "description": "查询任务名称", 225 | "required": false, 226 | "schema": { 227 | "type": "string" 228 | } 229 | }, 230 | { 231 | "name": "taskType", 232 | "in": "query", 233 | "description": "任务类型", 234 | "required": false, 235 | "schema": { 236 | "type": "string" 237 | } 238 | }, 239 | { 240 | "name": "taskExecuteType", 241 | "in": "query", 242 | "description": "任务执行类型", 243 | "required": false, 244 | "schema": { 245 | "type": "string", 246 | "enum": [ 247 | "BATCH", 248 | "STREAM" 249 | ] 250 | } 251 | }, 252 | { 253 | "name": "pageNo", 254 | "in": "query", 255 | "description": "页码号", 256 | "required": true, 257 | "schema": { 258 | "type": "integer", 259 | "format": "int32" 260 | } 261 | }, 262 | { 263 | "name": "pageSize", 264 | "in": "query", 265 | "description": "页大小", 266 | "required": true, 267 | "schema": { 268 | "type": "integer", 269 | "format": "int32" 270 | } 271 | }, 272 | { 273 | "name": "searchWorkflowName", 274 | "description": "查询工作量名称", 275 | "schema": { 276 | "type": "string" 277 | } 278 | } 279 | ], 280 | "responses": { 281 | "200": { 282 | "description": "OK", 283 | "content": { 284 | "*/*": { 285 | "schema": { 286 | "$ref": "#/components/schemas/Result" 287 | } 288 | } 289 | } 290 | } 291 | } 292 | }, 293 | "post": { 294 | "tags": [ 295 | "任务定义相关操作" 296 | ], 297 | "summary": "save", 298 | "description": "创建任务定义", 299 | "operationId": "createTaskDefinition", 300 | "parameters": [ 301 | { 302 | "name": "projectCode", 303 | "in": "path", 304 | "description": "项目Code", 305 | "required": true, 306 | "schema": { 307 | "type": "integer", 308 | "format": "int64" 309 | } 310 | }, 311 | { 312 | "name": "taskDefinitionJson", 313 | "in": "query", 314 | "description": "任务定义JSON", 315 | "required": true, 316 | "schema": { 317 | "type": "string" 318 | } 319 | } 320 | ], 321 | "responses": { 322 | "201": { 323 | "description": "Created", 324 | "content": { 325 | "*/*": { 326 | "schema": { 327 | "$ref": "#/components/schemas/Result" 328 | } 329 | } 330 | } 331 | } 332 | } 333 | } 334 | }, 335 | "/projects/{projectCode}/task-definition/{code}/release": { 336 | "post": { 337 | "tags": [ 338 | "任务定义相关操作" 339 | ], 340 | "summary": "releaseTaskDefinition", 341 | "description": "上线任务定义", 342 | "operationId": "releaseTaskDefinition", 343 | "parameters": [ 344 | { 345 | "name": "projectCode", 346 | "in": "path", 347 | "description": "项目Code", 348 | "required": true, 349 | "schema": { 350 | "type": "integer", 351 | "format": "int64" 352 | } 353 | }, 354 | { 355 | "name": "code", 356 | "in": "path", 357 | "description": "任务定义代码", 358 | "required": true, 359 | "schema": { 360 | "type": "integer", 361 | "format": "int64" 362 | } 363 | }, 364 | { 365 | "name": "releaseState", 366 | "in": "query", 367 | "description": "发布流程定义", 368 | "required": true, 369 | "schema": { 370 | "type": "string", 371 | "enum": [ 372 | "OFFLINE", 373 | "ONLINE" 374 | ] 375 | } 376 | } 377 | ], 378 | "responses": { 379 | "200": { 380 | "description": "OK", 381 | "content": { 382 | "*/*": { 383 | "schema": { 384 | "$ref": "#/components/schemas/Result" 385 | } 386 | } 387 | } 388 | } 389 | } 390 | } 391 | }, 392 | "/projects/{projectCode}/task-definition/save-single": { 393 | "post": { 394 | "tags": [ 395 | "任务定义相关操作" 396 | ], 397 | "summary": "saveSingle", 398 | "description": "创建单个任务定义", 399 | "operationId": "createTaskBindsWorkFlow", 400 | "parameters": [ 401 | { 402 | "name": "projectCode", 403 | "in": "path", 404 | "description": "项目Code", 405 | "required": true, 406 | "schema": { 407 | "type": "integer", 408 | "format": "int64" 409 | } 410 | }, 411 | { 412 | "name": "processDefinitionCode", 413 | "in": "query", 414 | "description": "流程定义编码", 415 | "required": true, 416 | "schema": { 417 | "type": "integer", 418 | "format": "int64" 419 | } 420 | }, 421 | { 422 | "name": "taskDefinitionJsonObj", 423 | "in": "query", 424 | "description": "任务定义JSON", 425 | "required": true, 426 | "schema": { 427 | "type": "string" 428 | } 429 | }, 430 | { 431 | "name": "upstreamCodes", 432 | "in": "query", 433 | "description": "上游代码列表", 434 | "required": false, 435 | "schema": { 436 | "type": "string" 437 | } 438 | } 439 | ], 440 | "responses": { 441 | "201": { 442 | "description": "Created", 443 | "content": { 444 | "*/*": { 445 | "schema": { 446 | "$ref": "#/components/schemas/Result" 447 | } 448 | } 449 | } 450 | } 451 | } 452 | } 453 | }, 454 | "/projects/{projectCode}/task-definition/{code}/versions": { 455 | "get": { 456 | "tags": [ 457 | "任务定义相关操作" 458 | ], 459 | "summary": "queryVersions", 460 | "description": "查询任务定义版本列表", 461 | "operationId": "queryTaskDefinitionVersions", 462 | "parameters": [ 463 | { 464 | "name": "projectCode", 465 | "in": "path", 466 | "description": "项目Code", 467 | "required": true, 468 | "schema": { 469 | "type": "integer", 470 | "format": "int64" 471 | } 472 | }, 473 | { 474 | "name": "code", 475 | "in": "path", 476 | "description": "任务定义代码", 477 | "required": true, 478 | "schema": { 479 | "type": "integer", 480 | "format": "int64" 481 | } 482 | }, 483 | { 484 | "name": "pageNo", 485 | "in": "query", 486 | "description": "页码号", 487 | "required": true, 488 | "schema": { 489 | "type": "integer", 490 | "format": "int32" 491 | } 492 | }, 493 | { 494 | "name": "pageSize", 495 | "in": "query", 496 | "description": "页大小", 497 | "required": true, 498 | "schema": { 499 | "type": "integer", 500 | "format": "int32" 501 | } 502 | } 503 | ], 504 | "responses": { 505 | "200": { 506 | "description": "OK", 507 | "content": { 508 | "*/*": { 509 | "schema": { 510 | "$ref": "#/components/schemas/Result" 511 | } 512 | } 513 | } 514 | } 515 | } 516 | } 517 | }, 518 | "/projects/{projectCode}/task-definition/{code}/versions/{version}": { 519 | "get": { 520 | "tags": [ 521 | "任务定义相关操作" 522 | ], 523 | "summary": "switchVersion", 524 | "description": "切换任务定义版本", 525 | "operationId": "switchTaskDefinitionVersion", 526 | "parameters": [ 527 | { 528 | "name": "projectCode", 529 | "in": "path", 530 | "description": "项目Code", 531 | "required": true, 532 | "schema": { 533 | "type": "integer", 534 | "format": "int64" 535 | } 536 | }, 537 | { 538 | "name": "code", 539 | "in": "path", 540 | "description": "任务定义代码", 541 | "required": true, 542 | "schema": { 543 | "type": "integer", 544 | "format": "int64" 545 | } 546 | }, 547 | { 548 | "name": "version", 549 | "in": "path", 550 | "description": "版本号", 551 | "required": true, 552 | "schema": { 553 | "type": "integer", 554 | "format": "int32" 555 | } 556 | } 557 | ], 558 | "responses": { 559 | "200": { 560 | "description": "OK", 561 | "content": { 562 | "*/*": { 563 | "schema": { 564 | "$ref": "#/components/schemas/Result" 565 | } 566 | } 567 | } 568 | } 569 | } 570 | }, 571 | "delete": { 572 | "tags": [ 573 | "任务定义相关操作" 574 | ], 575 | "summary": "deleteVersion", 576 | "description": "删除任务定义版本", 577 | "operationId": "deleteTaskDefinitionVersion", 578 | "parameters": [ 579 | { 580 | "name": "projectCode", 581 | "in": "path", 582 | "description": "项目Code", 583 | "required": true, 584 | "schema": { 585 | "type": "integer", 586 | "format": "int64" 587 | } 588 | }, 589 | { 590 | "name": "code", 591 | "in": "path", 592 | "description": "任务定义代码", 593 | "required": true, 594 | "schema": { 595 | "type": "integer", 596 | "format": "int64" 597 | } 598 | }, 599 | { 600 | "name": "version", 601 | "in": "path", 602 | "description": "版本号", 603 | "required": true, 604 | "schema": { 605 | "type": "integer", 606 | "format": "int32" 607 | } 608 | } 609 | ], 610 | "responses": { 611 | "200": { 612 | "description": "OK", 613 | "content": { 614 | "*/*": { 615 | "schema": { 616 | "$ref": "#/components/schemas/Result" 617 | } 618 | } 619 | } 620 | } 621 | } 622 | } 623 | }, 624 | "/projects/{projectCode}/task-definition/gen-task-codes": { 625 | "get": { 626 | "tags": [ 627 | "任务定义相关操作" 628 | ], 629 | "summary": "genTaskCodeList", 630 | "description": "查询任务代码列表", 631 | "operationId": "genTaskCodeList", 632 | "parameters": [ 633 | { 634 | "name": "genNum", 635 | "in": "query", 636 | "description": "总数", 637 | "required": true, 638 | "schema": { 639 | "type": "integer", 640 | "format": "int32" 641 | } 642 | } 643 | ], 644 | "responses": { 645 | "200": { 646 | "description": "OK", 647 | "content": { 648 | "*/*": { 649 | "schema": { 650 | "$ref": "#/components/schemas/Result" 651 | } 652 | } 653 | } 654 | } 655 | } 656 | } 657 | } 658 | } 659 | } ```