@@ -19,7 +19,7 @@ import (
1919
2020func resolveBlockIdFromPrefix (tab * waveobj.Tab , blockIdPrefix string ) (string , error ) {
2121 if len (blockIdPrefix ) != 8 {
22- return "" , fmt .Errorf ("block ID prefix must be 8 characters" )
22+ return "" , fmt .Errorf ("widget_id must be 8 characters" )
2323 }
2424
2525 for _ , blockId := range tab .BlockIds {
@@ -28,7 +28,7 @@ func resolveBlockIdFromPrefix(tab *waveobj.Tab, blockIdPrefix string) (string, e
2828 }
2929 }
3030
31- return "" , fmt .Errorf ("block not found with prefix %s " , blockIdPrefix )
31+ return "" , fmt .Errorf ("widget_id not found: %q " , blockIdPrefix )
3232}
3333
3434func makeTabCaptureBlockScreenshot (tabId string ) func (any ) (string , error ) {
@@ -38,9 +38,9 @@ func makeTabCaptureBlockScreenshot(tabId string) func(any) (string, error) {
3838 return "" , fmt .Errorf ("invalid input format" )
3939 }
4040
41- blockIdPrefix , ok := inputMap ["blockid " ].(string )
41+ blockIdPrefix , ok := inputMap ["widget_id " ].(string )
4242 if ! ok {
43- return "" , fmt .Errorf ("missing or invalid blockid parameter" )
43+ return "" , fmt .Errorf ("missing or invalid widget_id parameter" )
4444 }
4545
4646 ctx , cancelFn := context .WithTimeout (context .Background (), 5 * time .Second )
@@ -79,68 +79,14 @@ func GetCaptureScreenshotToolDefinition(tabId string) uctypes.ToolDefinition {
7979 InputSchema : map [string ]any {
8080 "type" : "object" ,
8181 "properties" : map [string ]any {
82- "blockid " : map [string ]any {
82+ "widget_id " : map [string ]any {
8383 "type" : "string" ,
84- "description" : "8-character block ID of the widget to screenshot" ,
84+ "description" : "8-character widget ID of the widget to screenshot" ,
8585 },
8686 },
87- "required" : []string {"blockid " },
87+ "required" : []string {"widget_id " },
8888 "additionalProperties" : false ,
8989 },
9090 ToolTextCallback : makeTabCaptureBlockScreenshot (tabId ),
9191 }
9292}
93-
94- func GetAdderToolDefinition () uctypes.ToolDefinition {
95- return uctypes.ToolDefinition {
96- Name : "adder" ,
97- DisplayName : "Adder" ,
98- Description : "Add an array of numbers together and return their sum" ,
99- Strict : true ,
100- InputSchema : map [string ]any {
101- "type" : "object" ,
102- "properties" : map [string ]any {
103- "values" : map [string ]any {
104- "type" : "array" ,
105- "items" : map [string ]any {
106- "type" : "integer" ,
107- },
108- "description" : "Array of numbers to add together" ,
109- },
110- },
111- "required" : []string {"values" },
112- "additionalProperties" : false ,
113- },
114- ToolAnyCallback : func (input any ) (any , error ) {
115- inputMap , ok := input .(map [string ]any )
116- if ! ok {
117- return nil , fmt .Errorf ("invalid input format" )
118- }
119-
120- valuesInterface , ok := inputMap ["values" ]
121- if ! ok {
122- return nil , fmt .Errorf ("missing values parameter" )
123- }
124-
125- valuesSlice , ok := valuesInterface .([]any )
126- if ! ok {
127- return nil , fmt .Errorf ("values must be an array" )
128- }
129-
130- if len (valuesSlice ) == 0 {
131- return 0 , nil
132- }
133-
134- sum := 0
135- for i , val := range valuesSlice {
136- floatVal , ok := val .(float64 )
137- if ! ok {
138- return nil , fmt .Errorf ("value at index %d is not a number" , i )
139- }
140- sum += int (floatVal )
141- }
142-
143- return sum , nil
144- },
145- }
146- }
0 commit comments