Skip to content

Error when using parameters of type array #701

@ngocquang2797

Description

@ngocquang2797

Prerequisites

  • I've searched the current open issues
  • I've updated to the latest version of Toolbox

Toolbox version

toolbox version 0.7.0

Environment

  1. OS=darwin/arm64

Client

  1. Client:
  2. Version:
  3. Example: If possible, please include your code of configuration:
# Code goes here! 

Expected Behavior

get "MCP error -32001: Error POSTing to endpoint (HTTP 500): "

Current Behavior

panic: runtime error: hash of unhashable type []interface {}

 -> github.com/googleapis/genai-toolbox/internal/tools.ParamValues.AsReversedMap
 ->   /workspace/internal/tools/parameters.go:69

    github.com/googleapis/genai-toolbox/internal/tools/bigquery.Tool.Invoke
      /workspace/internal/tools/bigquery/bigquery.go:122
    github.com/googleapis/genai-toolbox/internal/server/mcp.ToolCall
      /workspace/internal/server/mcp/method.go:54
    github.com/googleapis/genai-toolbox/internal/server.processMcpMessage
      /workspace/internal/server/mcp.go:466
    github.com/googleapis/genai-toolbox/internal/server.httpHandler
      /workspace/internal/server/mcp.go:318
    github.com/googleapis/genai-toolbox/internal/server.mcpRouter.func2
      /workspace/internal/server/mcp.go:179
    net/http.HandlerFunc.ServeHTTP
      /usr/local/go/src/net/http/server.go:2294
    github.com/go-chi/chi/v5.(*Mux).routeHTTP
      /gopath/pkg/mod/github.com/go-chi/chi/v5@v5.2.1/mux.go:480
    net/http.HandlerFunc.ServeHTTP
      /usr/local/go/src/net/http/server.go:2294
    github.com/googleapis/genai-toolbox/internal/server.mcpRouter.SetContentType.func4.1
      /gopath/pkg/mod/github.com/go-chi/render@v1.0.3/content_type.go:52
    net/http.HandlerFunc.ServeHTTP
      /usr/local/go/src/net/http/server.go:2294
    github.com/go-chi/chi/v5/middleware.StripSlashes.func1
      /gopath/pkg/mod/github.com/go-chi/chi/v5@v5.2.1/middleware/strip.go:30
    net/http.HandlerFunc.ServeHTTP
      /usr/local/go/src/net/http/server.go:2294
    github.com/go-chi/chi/v5/middleware.AllowContentType.func1.1
      /gopath/pkg/mod/github.com/go-chi/chi/v5@v5.2.1/middleware/content_type.go:37
    net/http.HandlerFunc.ServeHTTP
      /usr/local/go/src/net/http/server.go:2294
    github.com/go-chi/chi/v5.(*Mux).ServeHTTP
      /gopath/pkg/mod/github.com/go-chi/chi/v5@v5.2.1/mux.go:73
    github.com/go-chi/chi/v5.(*Mux).Mount.func1
      /gopath/pkg/mod/github.com/go-chi/chi/v5@v5.2.1/mux.go:327
    net/http.HandlerFunc.ServeHTTP
      /usr/local/go/src/net/http/server.go:2294
    github.com/go-chi/chi/v5.(*Mux).routeHTTP
      /gopath/pkg/mod/github.com/go-chi/chi/v5@v5.2.1/mux.go:480
    net/http.HandlerFunc.ServeHTTP
      /usr/local/go/src/net/http/server.go:2294
    github.com/go-chi/chi/v5/middleware.Recoverer.func1
      /gopath/pkg/mod/github.com/go-chi/chi/v5@v5.2.1/middleware/recoverer.go:45
    net/http.HandlerFunc.ServeHTTP
      /usr/local/go/src/net/http/server.go:2294
    github.com/googleapis/genai-toolbox/internal/server.NewServer.RequestLogger.Handler.func7.1
      /gopath/pkg/mod/github.com/go-chi/httplog/v2@v2.1.1/httplog.go:111
    net/http.HandlerFunc.ServeHTTP
      /usr/local/go/src/net/http/server.go:2294
    github.com/go-chi/chi/v5/middleware.RequestID.func1
      /gopath/pkg/mod/github.com/go-chi/chi/v5@v5.2.1/middleware/request_id.go:76
    net/http.HandlerFunc.ServeHTTP
      /usr/local/go/src/net/http/server.go:2294
    github.com/go-chi/chi/v5.(*ChainHandler).ServeHTTP
      /gopath/pkg/mod/github.com/go-chi/chi/v5@v5.2.1/chain.go:31
    github.com/go-chi/chi/v5/middleware.Recoverer.func1
      /gopath/pkg/mod/github.com/go-chi/chi/v5@v5.2.1/middleware/recoverer.go:45
    net/http.HandlerFunc.ServeHTTP
      /usr/local/go/src/net/http/server.go:2294
    github.com/go-chi/chi/v5.(*Mux).ServeHTTP
      /gopath/pkg/mod/github.com/go-chi/chi/v5@v5.2.1/mux.go:90
    net/http.serverHandler.ServeHTTP
      /usr/local/go/src/net/http/server.go:3301
    net/http.(*conn).serve
      /usr/local/go/src/net/http/server.go:2102
    created by net/http.(*Server).Serve in goroutine 14
      /usr/local/go/src/net/http/server.go:3454

2025-06-12T14:31:01.279564+07:00 ERROR Response: 500 Server Error - runtime error: hash of unhashable type []interface {}

Steps to reproduce?

when using MCP Inspector v0.14.0 call the tool I get response

Image

Additional Details

I'm using array parameter

get-tracking-codes:
    kind: bigquery-sql
    source: my-source
    description: Retrieve shipment tracking codes.
    parameters:
      - name: shipment_ids
        type: array
        description: Shipment IDs
        items:
          type: integer
          description: Shipment ID
    statement: |
      SELECT id, tracking_code
      FROM `dataset.table`
      WHERE id IN UNNEST(@shipment_ids)

Metadata

Metadata

Assignees

Labels

type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions