Uploaded image for project: 'Quarkus'
  1. Quarkus
  2. QUARKUS-6945

MCP Server passes wrong values to tools when running on virtualised environemnts

XMLWordPrintable

    • False
    • Hide

      None

      Show
      None
    • False
    • Hide
      podman run --name fedora --rm -it fedora:latest /bin/b_ash # remove the underscore, there is some problem with Jira and the short name of "Bourne Again Shell"
      dnf update
      dnf install git wget xz curl zip unzip
      
      curl -s "https://get.sdkman.io" | bash
      source "/root/.sdkman/bin/sdkman-init.sh"
      
      sdk install java 21.0.8-tem
      sdk install maven 3.9.9
      
      wget -q -O node.tar.xz https://nodejs.org/dist/v22.20.0/node-v22.20.0-linux-x64.tar.xz
      mkdir node
      tar -xf node.tar.xz --directory=node --strip-components=1
      PATH=$PATH:$(readlink -f node)/bin
      export PATH
      
      git clone  https://github.com/quarkiverse/quarkus-langchain4j
      cd quarkus-langchain4j/samples/
      API_KEY=__YOUR_API_KEY
      mvn clean verify -V -B --no-transfer-progress -fae -Dquarkus.langchain4j.openai.api-key=$API_KEY -Dquarkus.platform.version=3.27.1 -Dquarkus.platform.group-id=io.quarkus.platform -Dplatform-deps -DskipTests=false -pl mcp-tools
      
      Show
      podman run --name fedora --rm -it fedora:latest /bin/b_ash # remove the underscore, there is some problem with Jira and the short name of "Bourne Again Shell" dnf update dnf install git wget xz curl zip unzip curl -s "https://get.sdkman.io" | bash source "/root/.sdkman/bin/sdkman-init.sh" sdk install java 21.0.8-tem sdk install maven 3.9.9 wget -q -O node.tar.xz https://nodejs.org/dist/v22.20.0/node-v22.20.0-linux-x64.tar.xz mkdir node tar -xf node.tar.xz --directory=node --strip-components=1 PATH= $PATH :$(readlink -f node)/bin export PATH git clone https://github.com/quarkiverse/quarkus-langchain4j cd quarkus-langchain4j/samples/ API_KEY=__YOUR_API_KEY mvn clean verify -V -B --no-transfer-progress -fae -Dquarkus.langchain4j.openai.api-key=$API_KEY -Dquarkus.platform.version=3.27.1 -Dquarkus.platform.group-id=io.quarkus.platform -Dplatform-deps -DskipTests=false -pl mcp-tools
    • ---

      I got the following error when running samples/mcp tools tests:

      dev.langchain4j.exception.ToolExecutionException: Error: Invalid arguments for read_file: [
        {
          "expected": "string",
          "code": "invalid_type",
          "path": [
            "path"
          ],
          "message": "Invalid input: expected string, received undefined"
        }
      ]
      

      It looks like this error always happens on OSes, which run on VMs. I was able to reproduce it on RHEL on Openstack VM as well as Fedora and Ubuntu on podman and was not able to reproduce it on a bare-metal Fedora.
      According to the logs, it is caused on Quarkus/Langchain4j side, which sends an empty request to the tool: Attempting to execute tool ToolExecutionRequest { id = "call_<edited>", name = "read_file", arguments = "{}" }. In usual conditions, the command looks differently: Attempting to execute tool ToolExecutionRequest { id = "call_<edited>", name = "read_file", arguments = "

      {"path":"playground/hello.txt"}

      " }

      This issue affects both RHBQ and upstream of 3.27.0 and 3.27.1 but not 3.26.3

              jmartisk@redhat.com Jan Martiska
              rhn-support-fdudinsk Fedor Dudinskii
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: