@@ -43,7 +43,15 @@ func (e *Engine) runOpenAPIRevamp(tool types.Tool, input string) (*Return, error
43
43
return nil , fmt .Errorf ("failed to load OpenAPI file %s: %w" , source , err )
44
44
}
45
45
46
- opList , err := openapi .List (t , filter , "getSchema" + strings .TrimPrefix (tool .Name , "listOperations" ))
46
+ // The name of the getSchema tool will depend on whether the tool comes from GitHub or a local OpenAPI file.
47
+ // If it comes from GitHub, it will be "getSchema{OpenAPI Title}".
48
+ // If it comes from a file, it will be "{listOperationsToolName}0" (i.e. "openapi0").
49
+ // Something in the tool normalization logic is what causes this difference.
50
+ getSchemaToolName := tool .Name + "0"
51
+ if strings .HasPrefix (tool .Name , "listOperations" ) {
52
+ getSchemaToolName = "getSchema" + strings .TrimPrefix (tool .Name , "listOperations" )
53
+ }
54
+ opList , err := openapi .List (t , filter , getSchemaToolName )
47
55
if err != nil {
48
56
return nil , fmt .Errorf ("failed to list operations: %w" , err )
49
57
}
@@ -85,7 +93,15 @@ func (e *Engine) runOpenAPIRevamp(tool types.Tool, input string) (*Return, error
85
93
defaultHost = u .Scheme + "://" + u .Hostname ()
86
94
}
87
95
88
- schema , _ , found , err := openapi .GetSchema (operation , defaultHost , "runOperation" + strings .TrimPrefix (tool .Name , "getSchema" ), t )
96
+ // The name of the run tool will depend on whether the tool comes from GitHub or a local OpenAPI file.
97
+ // If it comes from GitHub, it will be "runOperation{OpenAPI Title}".
98
+ // If it comes from a file, it will be "{getSchemaToolName}0" (i.e. "openapi00").
99
+ // Something in the tool normalization logic is what causes this difference.
100
+ runToolName := tool .Name + "0"
101
+ if strings .HasPrefix (tool .Name , "getSchema" ) {
102
+ runToolName = "runOperation" + strings .TrimPrefix (tool .Name , "getSchema" )
103
+ }
104
+ schema , _ , found , err := openapi .GetSchema (operation , defaultHost , runToolName , t )
89
105
if err != nil {
90
106
return nil , fmt .Errorf ("failed to get schema: %w" , err )
91
107
}
0 commit comments