Revert "chore: Access params by maps for execute-sql tools" (#1095)

This reverts commit 6455ba964b.
This commit is contained in:
Wenxin Du
2025-08-06 16:13:36 -04:00
committed by GitHub
parent 6455ba964b
commit 5fda4d4ed1
6 changed files with 18 additions and 18 deletions

View File

@@ -118,10 +118,10 @@ type Tool struct {
}
func (t Tool) Invoke(ctx context.Context, params tools.ParamValues) (any, error) {
paramsMap := params.AsMap()
sql, ok := paramsMap["sql"].(string)
sliceParams := params.AsSlice()
sql, ok := sliceParams[0].(string)
if !ok {
return nil, fmt.Errorf("unable to get cast %s", paramsMap["sql"])
return nil, fmt.Errorf("unable to get cast %s", sliceParams[0])
}
// Log the query executed for debugging.

View File

@@ -118,10 +118,10 @@ type Tool struct {
}
func (t Tool) Invoke(ctx context.Context, params tools.ParamValues) (any, error) {
paramsMap := params.AsMap()
sql, ok := paramsMap["sql"].(string)
sliceParams := params.AsSlice()
sql, ok := sliceParams[0].(string)
if !ok {
return nil, fmt.Errorf("unable to get cast %s", paramsMap["sql"])
return nil, fmt.Errorf("unable to get cast %s", sliceParams[0])
}
// Log the query executed for debugging.

View File

@@ -124,10 +124,10 @@ type Tool struct {
}
func (t Tool) Invoke(ctx context.Context, params tools.ParamValues) (any, error) {
paramsMap := params.AsMap()
cypherStr, ok := paramsMap["sql"].(string)
sliceParams := params.AsSlice()
cypherStr, ok := sliceParams[0].(string)
if !ok {
return nil, fmt.Errorf("unable to get cast %s", paramsMap["sql"])
return nil, fmt.Errorf("unable to get cast %s", sliceParams[0])
}
if cypherStr == "" {

View File

@@ -120,10 +120,10 @@ type Tool struct {
}
func (t Tool) Invoke(ctx context.Context, params tools.ParamValues) (any, error) {
paramsMap := params.AsMap()
sql, ok := paramsMap["sql"].(string)
sliceParams := params.AsSlice()
sql, ok := sliceParams[0].(string)
if !ok {
return nil, fmt.Errorf("unable to get cast %s", paramsMap["sql"])
return nil, fmt.Errorf("unable to get cast %s", sliceParams[0])
}
// Log the query executed for debugging.
logger, err := util.LoggerFromContext(ctx)

View File

@@ -146,10 +146,10 @@ func processRows(iter *spanner.RowIterator) ([]any, error) {
}
func (t Tool) Invoke(ctx context.Context, params tools.ParamValues) (any, error) {
paramsMap := params.AsMap()
sql, ok := paramsMap["sql"].(string)
sliceParams := params.AsSlice()
sql, ok := sliceParams[0].(string)
if !ok {
return nil, fmt.Errorf("unable to get cast %s", paramsMap["sql"])
return nil, fmt.Errorf("unable to get cast %s", sliceParams[0])
}
// Log the query executed for debugging.

View File

@@ -116,10 +116,10 @@ type Tool struct {
}
func (t Tool) Invoke(ctx context.Context, params tools.ParamValues) (any, error) {
paramsMap := params.AsMap()
sql, ok := paramsMap["sql"].(string)
sliceParams := params.AsSlice()
sql, ok := sliceParams[0].(string)
if !ok {
return nil, fmt.Errorf("unable to get cast %s", paramsMap["sql"])
return nil, fmt.Errorf("unable to get cast %s", sliceParams[0])
}
// Log the query executed for debugging.