MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / GetTsunamiSetConfigToolDefinition

Function GetTsunamiSetConfigToolDefinition

pkg/aiusechat/tools_tsunami.go:172–203  ·  view source on GitHub ↗
(block *waveobj.Block, rtInfo *waveobj.ObjRTInfo, status *blockcontroller.BlockControllerRuntimeStatus)

Source from the content-addressed store, hash-verified

170}
171
172func 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}

Callers 1

Calls 2

getTsunamiShortDescFunction · 0.85
makeTsunamiPostCallbackFunction · 0.85

Tested by

no test coverage detected