diff --git a/internal/mcp/server_test.go b/internal/mcp/server_test.go index ba94b91e..4ed0d47e 100644 --- a/internal/mcp/server_test.go +++ b/internal/mcp/server_test.go @@ -98,8 +98,8 @@ func TestOpenAIFileMetadataMatchesDeclaredSchemas(t *testing.T) { if !ok { t.Fatalf("%s file input path %q missing from input schema", def.Name, path) } - if property["type"] != "string" || property["format"] != "binary" { - t.Fatalf("%s file input %q must be string/binary: %#v", def.Name, path, property) + if property["type"] != "object" || property["additionalProperties"] != true { + t.Fatalf("%s file input %q must be an open object: %#v", def.Name, path, property) } } if len(def.FileArgRewritePaths) > 0 { diff --git a/internal/tool/media/contract.go b/internal/tool/media/contract.go index fd03255a..9507c6dd 100644 --- a/internal/tool/media/contract.go +++ b/internal/tool/media/contract.go @@ -52,7 +52,7 @@ func InputSchema(name string) (map[string]any, bool) { } return schema, true case ToolFilePublish: - props["file"] = map[string]any{"type": "string", "format": "binary", "description": "Top-level file parameter. Connector runtimes should pass the mounted local path when available."} + props["file"] = toolcontract.OpenObject("Top-level connector file object. Connector runtimes may rewrite this object with mounted local-path metadata before the tool call reaches AgentDock.") props["path"] = stringProp("Local file or directory path visible to this AgentDock instance. Relative paths resolve from ~/AgentDock.") props["retention_seconds"] = boundedIntProp("Signed URL retention seconds. Zero uses the default 86400 and values are capped at 604800.", 0, int(publicartifacts.MaxRetention/time.Second)) default: diff --git a/internal/tool/media/request.go b/internal/tool/media/request.go index e4229f89..b0d807a9 100644 --- a/internal/tool/media/request.go +++ b/internal/tool/media/request.go @@ -24,7 +24,8 @@ type ViewImageRequest struct { Crop *CropRequest `json:"crop,omitempty"` } -// FilePublishRequest.File 是 connector 文件重写产生的动态叶子;Path 是普通本地路径入口。 +// FilePublishRequest.File 是 connector 文件重写产生的动态对象;Path 是普通本地路径入口。 +// File 保持 any 以兼容不同 connector 注入的文件对象形状,以及旧客户端仍可能发送的路径字符串。 type FilePublishRequest struct { File any `json:"file,omitempty"` Path string `json:"path,omitempty"`