From 00ce56350433a51189726bd67915302c745e422e Mon Sep 17 00:00:00 2001 From: XZB-1248 <28593573+XZB-1248@users.noreply.github.com> Date: Thu, 19 Feb 2026 23:07:43 +0800 Subject: [PATCH] optimize: params description for message tool --- pkg/tools/message.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/tools/message.go b/pkg/tools/message.go index a14770f8e..5e2bf7261 100644 --- a/pkg/tools/message.go +++ b/pkg/tools/message.go @@ -3,6 +3,7 @@ package tools import ( "context" "fmt" + "path/filepath" "github.com/sipeed/picoclaw/pkg/bus" ) @@ -58,14 +59,14 @@ func (t *MessageTool) Parameters() map[string]interface{} { "properties": map[string]interface{}{ "path": map[string]interface{}{ "type": "string", - "description": "Absolute file path to attach", + "description": "File path to attach (absolute or relative to workspace)", }, "filename": map[string]interface{}{ "type": "string", - "description": "Filename to use for the attachment", + "description": "Filename to use for the attachment (defaults to the base name of the path)", }, }, - "required": []string{"path", "filename"}, + "required": []string{"path"}, }, }, }, @@ -128,7 +129,7 @@ func (t *MessageTool) Execute(ctx context.Context, args map[string]interface{}) filename, filenameOk := attachMap["filename"].(string) if !filenameOk || filename == "" { - return ErrorResult(fmt.Sprintf("attachments[%d]: missing or invalid \"filename\" field", i)) + filename = filepath.Base(path) // Default to the base name of the file if filename not provided } resolvedPath, err := validatePath(path, t.allowedDir, t.restrict)