(block *waveobj.Block, rtInfo *waveobj.ObjRTInfo, status *blockcontroller.BlockControllerRuntimeStatus)
| 170 | } |
| 171 | |
| 172 | func GetTsunamiSetConfigToolDefinition(block *waveobj.Block, rtInfo *waveobj.ObjRTInfo, status *blockcontroller.BlockControllerRuntimeStatus) *uctypes.ToolDefinition { |
| 173 | blockIdPrefix := block.OID[:8] |
| 174 | toolName := fmt.Sprintf("tsunami_setconfig_%s", blockIdPrefix) |
| 175 | |
| 176 | var inputSchema map[string]any |
| 177 | if rtInfo != nil && rtInfo.TsunamiSchemas != nil { |
| 178 | if schemasMap, ok := rtInfo.TsunamiSchemas.(map[string]any); ok { |
| 179 | if configSchema, exists := schemasMap["config"]; exists { |
| 180 | inputSchema = configSchema.(map[string]any) |
| 181 | } |
| 182 | } |
| 183 | } |
| 184 | |
| 185 | if inputSchema == nil { |
| 186 | return nil |
| 187 | } |
| 188 | |
| 189 | desc := "tsunami widget" |
| 190 | if shortDesc := getTsunamiShortDesc(rtInfo); shortDesc != "" { |
| 191 | desc = shortDesc |
| 192 | } |
| 193 | |
| 194 | return &uctypes.ToolDefinition{ |
| 195 | Name: toolName, |
| 196 | ToolLogName: "tsunami:setconfig", |
| 197 | InputSchema: inputSchema, |
| 198 | ToolCallDesc: func(input any, output any, toolUseData *uctypes.UIMessageDataToolUse) string { |
| 199 | return fmt.Sprintf("updating config for %s (%s)", desc, blockIdPrefix) |
| 200 | }, |
| 201 | ToolAnyCallback: makeTsunamiPostCallback(status, "/api/config"), |
| 202 | } |
| 203 | } |
no test coverage detected