55 "fmt"
66 "time"
77
8- "github.com/cyclimse/mcp-scaleway-functions/internal/constants"
98 "github.com/modelcontextprotocol/go-sdk/mcp"
109 function "github.com/scaleway/scaleway-sdk-go/api/function/v1beta1"
1110 "github.com/scaleway/scaleway-sdk-go/scw"
@@ -82,7 +81,7 @@ func (req CreateAndDeployFunctionRequest) ToSDK(
8281 Seconds : int64 (timeout .Seconds ()),
8382 },
8483 Description : & req .Description ,
85- Tags : setCreatedByTagIfAbsent (req .Tags ),
84+ Tags : setCreatedByTag (req .Tags ),
8685 EnvironmentVariables : & req .EnvironmentVariables ,
8786 SecretEnvironmentVariables : secrets ,
8887 MinScale : req .MinScale ,
@@ -91,6 +90,7 @@ func (req CreateAndDeployFunctionRequest) ToSDK(
9190 }, nil
9291}
9392
93+ //nolint:funlen
9494func (t * Tools ) CreateAndDeployFunction (
9595 ctx context.Context ,
9696 req * mcp.CallToolRequest ,
@@ -122,7 +122,7 @@ func (t *Tools) CreateAndDeployFunction(
122122 return nil , Function {}, fmt .Errorf ("creating archive: %w" , err )
123123 }
124124
125- tags := append (fun .Tags , constants . TagCodeArchiveDigest + archive .Digest )
125+ tags := setCodeArchiveDigestTag (fun .Tags , archive .Digest )
126126
127127 // However, as a side-effect of doing creation first, we need to
128128 // update the function to add the code archive digest tag (which helps
@@ -133,7 +133,10 @@ func (t *Tools) CreateAndDeployFunction(
133133 Tags : scw .StringsPtr (tags ),
134134 }, scw .WithContext (ctx ))
135135 if err != nil {
136- return nil , Function {}, fmt .Errorf ("updating function with code archive digest tag: %w" , err )
136+ return nil , Function {}, fmt .Errorf (
137+ "updating function with code archive digest tag: %w" ,
138+ err ,
139+ )
137140 }
138141
139142 presignedURLResp , err := t .functionsAPI .GetFunctionUploadURL (
0 commit comments