feat(main): 修改 workflow extraContext 参数名称
将 workflow[extraContext] 参数名更改为 workflow_extraContext, 以避免方括号在某些系统中可能引起的解析问题。 同时更新了版本号从 0.1.7 到 0.1.8
This commit is contained in:
@@ -219,10 +219,10 @@ async def handle_list_tools() -> list[types.Tool]:
|
|||||||
logger.warning("sqlParams 和 inputJsonSchema 都不存在,使用空 schema")
|
logger.warning("sqlParams 和 inputJsonSchema 都不存在,使用空 schema")
|
||||||
input_schema = {"type": "object", "properties": {}, "required": []}
|
input_schema = {"type": "object", "properties": {}, "required": []}
|
||||||
|
|
||||||
# 添加 workflow[extraContext] 字段到 schema,可以接收任何类型(非必填)
|
# 添加 workflow_extraContext 字段到 schema,可以接收任何类型(非必填)
|
||||||
if "properties" not in input_schema:
|
if "properties" not in input_schema:
|
||||||
input_schema["properties"] = {}
|
input_schema["properties"] = {}
|
||||||
input_schema["properties"]["workflow[extraContext]"] = {
|
input_schema["properties"]["workflow_extraContext"] = {
|
||||||
"description": "工作流额外的上下文参数(如环境变量等),可以是任何类型,非必填"
|
"description": "工作流额外的上下文参数(如环境变量等),可以是任何类型,非必填"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,20 +263,20 @@ async def handle_call_tool(
|
|||||||
workflow_id = tool_config.get("workflowId") or get_workflow_id()
|
workflow_id = tool_config.get("workflowId") or get_workflow_id()
|
||||||
logger.info(f"使用工作流ID: {workflow_id}")
|
logger.info(f"使用工作流ID: {workflow_id}")
|
||||||
|
|
||||||
# 提取 workflow[extraContext] 字段并合并到 inputs
|
# 提取 workflow_extraContext 字段并合并到 inputs
|
||||||
inputs = arguments or {}
|
inputs = arguments or {}
|
||||||
workflow_extra_context = inputs.pop("workflow[extraContext]", None)
|
workflow_extra_context = inputs.pop("workflow_extraContext", None)
|
||||||
|
|
||||||
# 如果 workflow[extraContext] 存在,将其内容合并到 inputs
|
# 如果 workflow_extraContext 存在,将其内容合并到 inputs
|
||||||
if workflow_extra_context is not None:
|
if workflow_extra_context is not None:
|
||||||
if isinstance(workflow_extra_context, dict):
|
if isinstance(workflow_extra_context, dict):
|
||||||
# 如果 workflow[extraContext] 是字典,合并到 inputs
|
# 如果 workflow_extraContext 是字典,合并到 inputs
|
||||||
inputs.update(workflow_extra_context)
|
inputs.update(workflow_extra_context)
|
||||||
logger.info(f"workflow[extraContext] 是字典类型,已合并到 inputs: {json.dumps(workflow_extra_context, ensure_ascii=False)}")
|
logger.info(f"workflow_extraContext 是字典类型,已合并到 inputs: {json.dumps(workflow_extra_context, ensure_ascii=False)}")
|
||||||
else:
|
else:
|
||||||
# 如果 workflow[extraContext] 不是字典,作为 workflow[extraContext] 字段保留
|
# 如果 workflow_extraContext 不是字典,作为 workflow_extraContext 字段保留
|
||||||
inputs["workflow[extraContext]"] = workflow_extra_context
|
inputs["workflow_extraContext"] = workflow_extra_context
|
||||||
logger.info(f"workflow[extraContext] 是 {type(workflow_extra_context).__name__} 类型,保留为 workflow[extraContext] 字段")
|
logger.info(f"workflow_extraContext 是 {type(workflow_extra_context).__name__} 类型,保留为 workflow_extraContext 字段")
|
||||||
|
|
||||||
# 构建请求数据
|
# 构建请求数据
|
||||||
request_data = {
|
request_data = {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "lzwcai-workflow-to-mcp"
|
name = "lzwcai-workflow-to-mcp"
|
||||||
version = "0.1.7"
|
version = "0.1.8"
|
||||||
description = "MCP server for executing business SQL queries with dynamic tool generation"
|
description = "MCP server for executing business SQL queries with dynamic tool generation"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.10"
|
||||||
|
|||||||
Reference in New Issue
Block a user