@@ -65,13 +65,19 @@ func BuildRunCommand(spec *types.RegistryEntry, tempName, image string) []string
6565 // Add environment variables
6666 if spec .ImageMetadata .EnvVars != nil {
6767 for _ , envVar := range spec .ImageMetadata .EnvVars {
68- if envVar .Secret {
69- // For secrets, use placeholder values if required
70- if envVar .Required {
71- builder .AddEnvVar (envVar .Name , "placeholder" )
72- }
73- } else if envVar .Default != "" {
68+ // Precedence: explicit default from spec > required flag > secret flag
69+ if envVar .Default != "" {
7470 builder .AddEnvVar (envVar .Name , envVar .Default )
71+ continue
72+ }
73+ if envVar .Required {
74+ // Inject a dummy value to allow server startup and tool discovery
75+ builder .AddEnvVar (envVar .Name , "placeholder" )
76+ continue
77+ }
78+ if envVar .Secret {
79+ // Even when not required, inject a dummy for secrets to surface optional tools
80+ builder .AddEnvVar (envVar .Name , "placeholder" )
7581 }
7682 }
7783 }
@@ -85,5 +91,16 @@ func BuildRunCommand(spec *types.RegistryEntry, tempName, image string) []string
8591 // Add the image as the last positional argument
8692 builder .AddPositional (image )
8793
94+ // Append registry-specified args after the image using the standard "--" separator
95+ // per ToolHive docs (arguments after "--" are passed to the server process).
96+ if spec .ImageMetadata != nil && len (spec .Args ) > 0 {
97+ builder .AddPositional ("--" )
98+ for _ , a := range spec .Args {
99+ if a != "" {
100+ builder .AddPositional (a )
101+ }
102+ }
103+ }
104+
88105 return builder .Build ()
89106}
0 commit comments