diff --git a/go.mod b/go.mod index 140d511a..770c14e1 100644 --- a/go.mod +++ b/go.mod @@ -4,14 +4,11 @@ go 1.24.2 toolchain go1.24.4 -replace github.com/danielgtaylor/huma/v2 => github.com/gptscript-ai/huma v0.0.0-20250617131016-b2081da6c65b - require ( github.com/AlecAivazis/survey/v2 v2.3.7 github.com/BurntSushi/locker v0.0.0-20171006230638-a6e239ea1c69 github.com/adrg/xdg v0.4.0 github.com/chzyer/readline v1.5.1 - github.com/danielgtaylor/huma/v2 v2.32.1-0.20250509235652-c7ead6f3c67f github.com/docker/cli v26.0.0+incompatible github.com/docker/docker-credential-helpers v0.8.1 github.com/fatih/color v1.17.0 @@ -22,12 +19,13 @@ require ( github.com/gptscript-ai/broadcaster v0.0.0-20240625175512-c43682019b86 github.com/gptscript-ai/chat-completion-client v0.0.0-20250224164718-139cb4507b1d github.com/gptscript-ai/cmd v0.0.0-20250530150401-bc71fddf8070 - github.com/gptscript-ai/go-gptscript v0.9.6-0.20250617131750-9129819aea51 + github.com/gptscript-ai/go-gptscript v0.9.6-0.20250714170123-17ad44ae8c54 github.com/gptscript-ai/tui v0.0.0-20250419050840-5e79e16786c9 github.com/hexops/autogold/v2 v2.2.1 github.com/hexops/valast v1.4.4 github.com/jaytaylor/html2text v0.0.0-20230321000545-74c2419ad056 github.com/mholt/archives v0.1.0 + github.com/modelcontextprotocol/go-sdk v0.2.0 github.com/nanobot-ai/nanobot v0.0.6-0.20250623174223-c75713af7a09 github.com/pkoukk/tiktoken-go v0.1.7 github.com/pkoukk/tiktoken-go-loader v0.0.2-0.20240522064338-c17e8bc0f699 @@ -40,7 +38,7 @@ require ( github.com/tidwall/gjson v1.17.1 github.com/xeipuuv/gojsonschema v1.2.0 golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 - golang.org/x/sync v0.14.0 + golang.org/x/sync v0.15.0 golang.org/x/term v0.32.0 gopkg.in/yaml.v3 v3.0.1 gotest.tools/v3 v3.5.1 @@ -139,12 +137,12 @@ require ( github.com/yuin/goldmark v1.5.4 // indirect github.com/yuin/goldmark-emoji v1.0.2 // indirect go4.org v0.0.0-20230225012048-214862532bf5 // indirect - golang.org/x/crypto v0.38.0 // indirect - golang.org/x/mod v0.19.0 // indirect - golang.org/x/net v0.40.0 // indirect + golang.org/x/crypto v0.39.0 // indirect + golang.org/x/mod v0.25.0 // indirect + golang.org/x/net v0.41.0 // indirect golang.org/x/sys v0.33.0 // indirect - golang.org/x/text v0.25.0 // indirect - golang.org/x/tools v0.23.0 // indirect + golang.org/x/text v0.26.0 // indirect + golang.org/x/tools v0.34.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect mvdan.cc/gofumpt v0.6.0 // indirect ) diff --git a/go.sum b/go.sum index 9c280bad..e33f7f84 100644 --- a/go.sum +++ b/go.sum @@ -214,10 +214,8 @@ github.com/gptscript-ai/chat-completion-client v0.0.0-20250224164718-139cb4507b1 github.com/gptscript-ai/chat-completion-client v0.0.0-20250224164718-139cb4507b1d/go.mod h1:7P/o6/IWa1KqsntVf68hSnLKuu3+xuqm6lYhch1w4jo= github.com/gptscript-ai/cmd v0.0.0-20250530150401-bc71fddf8070 h1:xm5ZZFraWFwxyE7TBEncCXArubCDZTwG6s5bpMzqhSY= github.com/gptscript-ai/cmd v0.0.0-20250530150401-bc71fddf8070/go.mod h1:DJAo1xTht1LDkNYFNydVjTHd576TC7MlpsVRl3oloVw= -github.com/gptscript-ai/go-gptscript v0.9.6-0.20250617131750-9129819aea51 h1:9s53UDNVXF+ujMwhg/7LiZlIMYOpn2Ap8WBc1i4Pi/Y= -github.com/gptscript-ai/go-gptscript v0.9.6-0.20250617131750-9129819aea51/go.mod h1:LQ4E2g+t+L/it13Le5m9Hfgn4huS8bO4hcTawFlUzSY= -github.com/gptscript-ai/huma v0.0.0-20250617131016-b2081da6c65b h1:QReUetqY+ep2sj6g83oqldPHzwH2T2TG1sv0IWE2hL0= -github.com/gptscript-ai/huma v0.0.0-20250617131016-b2081da6c65b/go.mod h1:y2Eq35Y5Xy6+MZRPgn81/bjNBiEHqEQba+vY+fLigjU= +github.com/gptscript-ai/go-gptscript v0.9.6-0.20250714170123-17ad44ae8c54 h1:9OAiDBdOQUHVL89wmb38+/XOuewboMhgnk6NqoJiC00= +github.com/gptscript-ai/go-gptscript v0.9.6-0.20250714170123-17ad44ae8c54/go.mod h1:HLPvKBhDtsEkyyUWefJVhPpl98R3tZG6ps7+mQ+EKVI= github.com/gptscript-ai/tui v0.0.0-20250419050840-5e79e16786c9 h1:wQC8sKyeGA50WnCEG+Jo5FNRIkuX3HX8d3ubyWCCoI8= github.com/gptscript-ai/tui v0.0.0-20250419050840-5e79e16786c9/go.mod h1:iwHxuueg2paOak7zIg0ESBWx7A0wIHGopAratbgaPNY= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -265,8 +263,8 @@ github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgo github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.10/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c= github.com/klauspost/cpuid/v2 v2.0.12/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c= -github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE= -github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= +github.com/klauspost/cpuid/v2 v2.2.3 h1:sxCkb+qR91z4vsqw4vGGZlDgPz3G7gjaLyK3V8y70BU= +github.com/klauspost/cpuid/v2 v2.2.3/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= github.com/klauspost/pgzip v1.2.6 h1:8RXeL5crjEUFnR2/Sn6GJNWtSQ3Dk8pq4CL3jvdDyjU= github.com/klauspost/pgzip v1.2.6/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -307,6 +305,8 @@ github.com/mholt/archives v0.1.0 h1:FacgJyrjiuyomTuNA92X5GyRBRZjE43Y/lrzKIlF35Q= github.com/mholt/archives v0.1.0/go.mod h1:j/Ire/jm42GN7h90F5kzj6hf6ZFzEH66de+hmjEKu+I= github.com/microcosm-cc/bluemonday v1.0.26 h1:xbqSvqzQMeEHCqMi64VAs4d8uy6Mequs3rQ0k/Khz58= github.com/microcosm-cc/bluemonday v1.0.26/go.mod h1:JyzOCs9gkyQyjs+6h10UEVSe02CGwkhd72Xdqh78TWs= +github.com/modelcontextprotocol/go-sdk v0.2.0 h1:PESNYOmyM1c369tRkzXLY5hHrazj8x9CY1Xu0fLCryM= +github.com/modelcontextprotocol/go-sdk v0.2.0/go.mod h1:0sL9zUKKs2FTTkeCCVnKqbLJTw5TScefPAzojjU459E= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s= @@ -408,8 +408,8 @@ github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= -github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= -github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= +github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= +github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc= github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= @@ -445,8 +445,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= -golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8= -golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw= +golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM= +golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -479,8 +479,8 @@ golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.19.0 h1:fEdghXQSo20giMthA7cd28ZC+jts4amQ3YMXiP5oMQ8= -golang.org/x/mod v0.19.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.25.0 h1:n7a+ZbQKQA/Ysbyb0/6IbB1H/X41mKgbhfv7AfG/44w= +golang.org/x/mod v0.25.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -503,8 +503,8 @@ golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= -golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= -golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= +golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw= +golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -520,8 +520,8 @@ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= -golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ= -golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8= +golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -585,8 +585,8 @@ golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= -golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= +golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M= +golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -618,8 +618,8 @@ golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.8.0/go.mod h1:JxBZ99ISMI5ViVkT1tr6tdNmXeTrcpVSD3vZ1RsRdN4= golang.org/x/tools v0.12.0/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM= -golang.org/x/tools v0.23.0 h1:SGsXPZ+2l4JsgaCKkx+FQ9YZ5XEtA1GZYuoDjenLjvg= -golang.org/x/tools v0.23.0/go.mod h1:pnu6ufv6vQkll6szChhK3C3L/ruaIv5eBeztNG8wtsI= +golang.org/x/tools v0.34.0 h1:qIpSLOxeCYGg9TrcJokLBG4KFA6d795g0xkBkiESGlo= +golang.org/x/tools v0.34.0/go.mod h1:pAP9OwEaY1CAW3HOmg3hLZC5Z0CCmzjAF2UQMSqNARg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/pkg/loader/loader_test.go b/pkg/loader/loader_test.go index 7c480034..a39c2df9 100644 --- a/pkg/loader/loader_test.go +++ b/pkg/loader/loader_test.go @@ -131,13 +131,13 @@ func TestHelloWorld(t *testing.T) { "modelName": "gpt-4o", "internalPrompt": null, "arguments": { + "type": "object", "properties": { "input": { - "description": "Any string", - "type": "string" + "type": "string", + "description": "Any string" } - }, - "type": "object" + } }, "instructions": "echo \"${input}\"", "id": "https://get.gptscript.ai/echo.gpt:", diff --git a/pkg/loader/openapi.go b/pkg/loader/openapi.go index ef61adfb..ce8c5dc6 100644 --- a/pkg/loader/openapi.go +++ b/pkg/loader/openapi.go @@ -11,10 +11,10 @@ import ( "strings" "time" - humav2 "github.com/danielgtaylor/huma/v2" "github.com/getkin/kin-openapi/openapi3" "github.com/gptscript-ai/gptscript/pkg/openapi" "github.com/gptscript-ai/gptscript/pkg/types" + "github.com/modelcontextprotocol/go-sdk/jsonschema" ) var toolNameRegex = regexp.MustCompile(`[^a-zA-Z0-9_-]+`) @@ -151,9 +151,9 @@ func getOpenAPITools(t *openapi3.T, defaultHost, source, targetToolName string) Parameters: types.Parameters{ Name: toolName, Description: toolDesc, - Arguments: &humav2.Schema{ - Type: humav2.TypeObject, - Properties: make(map[string]*humav2.Schema), + Arguments: &jsonschema.Schema{ + Type: "object", + Properties: make(map[string]*jsonschema.Schema), }, }, }, @@ -174,7 +174,7 @@ func getOpenAPITools(t *openapi3.T, defaultHost, source, targetToolName string) } // Add the new arg to the tool's arguments - tool.Arguments.Properties[param.Value.Name] = openAPI3SchemaToHumaV2Schema(arg) + tool.Arguments.Properties[param.Value.Name] = openAPI3SchemaToJSONSchema(arg) // Check whether it is required if param.Value.Required { @@ -227,7 +227,7 @@ func getOpenAPITools(t *openapi3.T, defaultHost, source, targetToolName string) } // Unfortunately, the request body doesn't contain any good descriptor for it, // so we just use "requestBodyContent" as the name of the arg. - tool.Arguments.Properties["requestBodyContent"] = openAPI3SchemaToHumaV2Schema(arg) + tool.Arguments.Properties["requestBodyContent"] = openAPI3SchemaToJSONSchema(arg) break } @@ -373,22 +373,27 @@ func parseServer(server *openapi3.Server) (string, error) { return s, nil } -// openAPI3SchemaToHumaV2Schema converts an openapi3.Schema to a humav2.Schema -func openAPI3SchemaToHumaV2Schema(schema *openapi3.Schema) *humav2.Schema { +// openAPI3SchemaToJSONSchema converts an openapi3.Schema to a jsonschema.Schema +func openAPI3SchemaToJSONSchema(schema *openapi3.Schema) *jsonschema.Schema { if schema == nil { return nil } - result := &humav2.Schema{ + result := &jsonschema.Schema{ Title: schema.Title, Description: schema.Description, Format: schema.Format, - Nullable: schema.Nullable, } // Convert type if schema.Type != nil && len(*schema.Type) > 0 { - result.Type = (*schema.Type)[0] + result.Types = *schema.Type + } + + // In OpenAPI v3.0, there is a nullable field. + // In OpenAPI v3.1, nullable is specified by providing a separate type. + if schema.Nullable && !slices.Contains(result.Types, "null") { + result.Types = append(result.Types, "null") } // Convert enum @@ -463,52 +468,52 @@ func openAPI3SchemaToHumaV2Schema(schema *openapi3.Schema) *humav2.Schema { // Convert properties if schema.Properties != nil { - result.Properties = make(map[string]*humav2.Schema, len(schema.Properties)) + result.Properties = make(map[string]*jsonschema.Schema, len(schema.Properties)) for name, propRef := range schema.Properties { if propRef != nil && propRef.Value != nil { - result.Properties[name] = openAPI3SchemaToHumaV2Schema(propRef.Value) + result.Properties[name] = openAPI3SchemaToJSONSchema(propRef.Value) } } } // Convert items if schema.Items != nil && schema.Items.Value != nil { - result.Items = openAPI3SchemaToHumaV2Schema(schema.Items.Value) + result.Items = openAPI3SchemaToJSONSchema(schema.Items.Value) } // Convert oneOf if schema.OneOf != nil { - result.OneOf = make([]*humav2.Schema, len(schema.OneOf)) + result.OneOf = make([]*jsonschema.Schema, len(schema.OneOf)) for i, oneOfRef := range schema.OneOf { if oneOfRef != nil && oneOfRef.Value != nil { - result.OneOf[i] = openAPI3SchemaToHumaV2Schema(oneOfRef.Value) + result.OneOf[i] = openAPI3SchemaToJSONSchema(oneOfRef.Value) } } } // Convert anyOf if schema.AnyOf != nil { - result.AnyOf = make([]*humav2.Schema, len(schema.AnyOf)) + result.AnyOf = make([]*jsonschema.Schema, len(schema.AnyOf)) for i, anyOfRef := range schema.AnyOf { if anyOfRef != nil && anyOfRef.Value != nil { - result.AnyOf[i] = openAPI3SchemaToHumaV2Schema(anyOfRef.Value) + result.AnyOf[i] = openAPI3SchemaToJSONSchema(anyOfRef.Value) } } } // Convert allOf if schema.AllOf != nil { - result.AllOf = make([]*humav2.Schema, len(schema.AllOf)) + result.AllOf = make([]*jsonschema.Schema, len(schema.AllOf)) for i, allOfRef := range schema.AllOf { if allOfRef != nil && allOfRef.Value != nil { - result.AllOf[i] = openAPI3SchemaToHumaV2Schema(allOfRef.Value) + result.AllOf[i] = openAPI3SchemaToJSONSchema(allOfRef.Value) } } } // Convert not if schema.Not != nil && schema.Not.Value != nil { - result.Not = openAPI3SchemaToHumaV2Schema(schema.Not.Value) + result.Not = openAPI3SchemaToJSONSchema(schema.Not.Value) } return result @@ -543,11 +548,11 @@ func getOpenAPIToolsRevamp(t *openapi3.T, source, targetToolName string) ([]type Parameters: types.Parameters{ Name: types.ToolNormalizer("get-schema-" + t.Info.Title), Description: fmt.Sprintf("Get the JSONSchema for the arguments for an operation for %s. You must do this before you run the operation.", t.Info.Title), - Arguments: &humav2.Schema{ - Type: humav2.TypeObject, - Properties: map[string]*humav2.Schema{ + Arguments: &jsonschema.Schema{ + Type: "object", + Properties: map[string]*jsonschema.Schema{ "operation": { - Type: humav2.TypeString, + Type: "string", Title: "operation", Description: "the name of the operation to get the schema for", Required: []string{"operation"}, @@ -567,17 +572,17 @@ func getOpenAPIToolsRevamp(t *openapi3.T, source, targetToolName string) ([]type Parameters: types.Parameters{ Name: types.ToolNormalizer("run-operation-" + t.Info.Title), Description: fmt.Sprintf("Run an operation for %s. You MUST call %s for the operation before you use this tool.", t.Info.Title, openapi.GetSchemaTool), - Arguments: &humav2.Schema{ - Type: humav2.TypeObject, - Properties: map[string]*humav2.Schema{ + Arguments: &jsonschema.Schema{ + Type: "object", + Properties: map[string]*jsonschema.Schema{ "operation": { - Type: humav2.TypeString, + Type: "string", Title: "operation", Description: "the name of the operation to run", Required: []string{"operation"}, }, "args": { - Type: humav2.TypeString, + Type: "string", Title: "args", Description: "the JSON string containing arguments; must match the JSONSchema for the operation", Required: []string{"args"}, diff --git a/pkg/loader/testdata/openapi/TestOpenAPIv2.golden b/pkg/loader/testdata/openapi/TestOpenAPIv2.golden index d64c70ea..ebf29cb4 100644 --- a/pkg/loader/testdata/openapi/TestOpenAPIv2.golden +++ b/pkg/loader/testdata/openapi/TestOpenAPIv2.golden @@ -56,15 +56,17 @@ types.ToolSet{ Name: "listPets", Description: "List all pets", ModelName: "gpt-4o", - Arguments: &huma.Schema{ + Arguments: &jsonschema.Schema{ Type: "object", - Properties: map[string]*huma.Schema{ + Properties: map[string]*jsonschema.Schema{ "limit": { - Type: "integer", Description: "How many items to return at one time (max 100)", - Format: "int32", - Properties: map[string]*huma.Schema{}, - AllOf: []*huma.Schema{}, + Types: []string{ + "integer", + }, + Properties: map[string]*jsonschema.Schema{}, + AllOf: []*jsonschema.Schema{}, + Format: "int32", }, }, }, @@ -87,15 +89,15 @@ types.ToolSet{ Name: "showPetById", Description: "Info for a specific pet", ModelName: "gpt-4o", - Arguments: &huma.Schema{ - Type: "object", - Properties: map[string]*huma.Schema{"petId": { - Type: "string", + Arguments: &jsonschema.Schema{ + Type: "object", + Required: []string{"petId"}, + Properties: map[string]*jsonschema.Schema{"petId": { Description: "The id of the pet to retrieve", - Properties: map[string]*huma.Schema{}, - AllOf: []*huma.Schema{}, + Types: []string{"string"}, + Properties: map[string]*jsonschema.Schema{}, + AllOf: []*jsonschema.Schema{}, }}, - Required: []string{"petId"}, }, }, Instructions: `#!sys.openapi '{"server":"http://petstore.swagger.io/v1","path":"/pets/{petId}","method":"GET","bodyContentMIME":"","securityInfos":null,"queryParameters":null,"pathParameters":[{"name":"petId","style":"","explode":null}],"headerParameters":null,"cookieParameters":null}'`, diff --git a/pkg/loader/testdata/openapi/TestOpenAPIv2Revamp.golden b/pkg/loader/testdata/openapi/TestOpenAPIv2Revamp.golden index d89e976e..ac32cc58 100644 --- a/pkg/loader/testdata/openapi/TestOpenAPIv2Revamp.golden +++ b/pkg/loader/testdata/openapi/TestOpenAPIv2Revamp.golden @@ -36,13 +36,13 @@ types.ToolSet{ Name: "getSchemaSwaggerPetstore", Description: "Get the JSONSchema for the arguments for an operation for Swagger Petstore. You must do this before you run the operation.", ModelName: "gpt-4o", - Arguments: &huma.Schema{ + Arguments: &jsonschema.Schema{ Type: "object", - Properties: map[string]*huma.Schema{ + Properties: map[string]*jsonschema.Schema{ "operation": { - Type: "string", Title: "operation", Description: "the name of the operation to get the schema for", + Type: "string", Required: []string{ "operation", }, @@ -86,19 +86,19 @@ types.ToolSet{ Name: "runOperationSwaggerPetstore", Description: "Run an operation for Swagger Petstore. You MUST call get-schema for the operation before you use this tool.", ModelName: "gpt-4o", - Arguments: &huma.Schema{ + Arguments: &jsonschema.Schema{ Type: "object", - Properties: map[string]*huma.Schema{ + Properties: map[string]*jsonschema.Schema{ "args": { - Type: "string", Title: "args", Description: "the JSON string containing arguments; must match the JSONSchema for the operation", + Type: "string", Required: []string{"args"}, }, "operation": { - Type: "string", Title: "operation", Description: "the name of the operation to run", + Type: "string", Required: []string{"operation"}, }, }, diff --git a/pkg/loader/testdata/openapi/TestOpenAPIv3.golden b/pkg/loader/testdata/openapi/TestOpenAPIv3.golden index 710440cf..7e4a7993 100644 --- a/pkg/loader/testdata/openapi/TestOpenAPIv3.golden +++ b/pkg/loader/testdata/openapi/TestOpenAPIv3.golden @@ -37,23 +37,27 @@ types.ToolSet{ Name: "createPets", Description: "Create a pet", ModelName: "gpt-4o", - Arguments: &huma.Schema{ + Arguments: &jsonschema.Schema{ Type: "object", - Properties: map[string]*huma.Schema{ + Properties: map[string]*jsonschema.Schema{ "requestBodyContent": { - Type: "object", - Properties: map[string]*huma.Schema{ - "id": { - Type: "integer", - Format: "int64", - }, - "name": {Type: "string"}, - "tag": {Type: "string"}, + Types: []string{ + "object", }, Required: []string{ "id", "name", }, + Properties: map[string]*jsonschema.Schema{ + "id": { + Types: []string{ + "integer", + }, + Format: "int64", + }, + "name": {Types: []string{"string"}}, + "tag": {Types: []string{"string"}}, + }, }, }, }, @@ -76,13 +80,13 @@ types.ToolSet{ Name: "listPets", Description: "List all pets", ModelName: "gpt-4o", - Arguments: &huma.Schema{ + Arguments: &jsonschema.Schema{ Type: "object", - Properties: map[string]*huma.Schema{"limit": { - Type: "integer", + Properties: map[string]*jsonschema.Schema{"limit": { Description: "How many items to return at one time (max 100)", - Format: "int32", + Types: []string{"integer"}, Maximum: valast.Ptr(float64(100)), + Format: "int32", }}, }, }, @@ -104,13 +108,13 @@ types.ToolSet{ Name: "showPetById", Description: "Info for a specific pet", ModelName: "gpt-4o", - Arguments: &huma.Schema{ - Type: "object", - Properties: map[string]*huma.Schema{"petId": { - Type: "string", + Arguments: &jsonschema.Schema{ + Type: "object", + Required: []string{"petId"}, + Properties: map[string]*jsonschema.Schema{"petId": { Description: "The id of the pet to retrieve", + Types: []string{"string"}, }}, - Required: []string{"petId"}, }, }, Instructions: `#!sys.openapi '{"server":"http://petstore.swagger.io/v1","path":"/pets/{petId}","method":"GET","bodyContentMIME":"","securityInfos":null,"queryParameters":null,"pathParameters":[{"name":"petId","style":"","explode":null}],"headerParameters":null,"cookieParameters":null}'`, diff --git a/pkg/loader/testdata/openapi/TestOpenAPIv3NoOperationIDs.golden b/pkg/loader/testdata/openapi/TestOpenAPIv3NoOperationIDs.golden index c12c7834..5ebd8aa9 100644 --- a/pkg/loader/testdata/openapi/TestOpenAPIv3NoOperationIDs.golden +++ b/pkg/loader/testdata/openapi/TestOpenAPIv3NoOperationIDs.golden @@ -37,14 +37,16 @@ types.ToolSet{ Name: "get_pets", Description: "List all pets", ModelName: "gpt-4o", - Arguments: &huma.Schema{ + Arguments: &jsonschema.Schema{ Type: "object", - Properties: map[string]*huma.Schema{ + Properties: map[string]*jsonschema.Schema{ "limit": { - Type: "integer", Description: "How many items to return at one time (max 100)", - Format: "int32", - Maximum: valast.Ptr(float64(100)), + Types: []string{ + "integer", + }, + Maximum: valast.Ptr(float64(100)), + Format: "int32", }, }, }, @@ -67,13 +69,13 @@ types.ToolSet{ Name: "get_pets_petId", Description: "Info for a specific pet", ModelName: "gpt-4o", - Arguments: &huma.Schema{ - Type: "object", - Properties: map[string]*huma.Schema{"petId": { - Type: "string", + Arguments: &jsonschema.Schema{ + Type: "object", + Required: []string{"petId"}, + Properties: map[string]*jsonschema.Schema{"petId": { Description: "The id of the pet to retrieve", + Types: []string{"string"}, }}, - Required: []string{"petId"}, }, }, Instructions: `#!sys.openapi '{"server":"http://petstore.swagger.io/v1","path":"/pets/{petId}","method":"GET","bodyContentMIME":"","securityInfos":null,"queryParameters":null,"pathParameters":[{"name":"petId","style":"","explode":null}],"headerParameters":null,"cookieParameters":null}'`, @@ -94,22 +96,24 @@ types.ToolSet{ Name: "post_pets", Description: "Create a pet", ModelName: "gpt-4o", - Arguments: &huma.Schema{ + Arguments: &jsonschema.Schema{ Type: "object", - Properties: map[string]*huma.Schema{"requestBodyContent": { - Type: "object", - Properties: map[string]*huma.Schema{ - "id": { - Type: "integer", - Format: "int64", - }, - "name": {Type: "string"}, - "tag": {Type: "string"}, - }, + Properties: map[string]*jsonschema.Schema{"requestBodyContent": { + Types: []string{"object"}, Required: []string{ "id", "name", }, + Properties: map[string]*jsonschema.Schema{ + "id": { + Types: []string{ + "integer", + }, + Format: "int64", + }, + "name": {Types: []string{"string"}}, + "tag": {Types: []string{"string"}}, + }, }}, }, }, diff --git a/pkg/loader/testdata/openapi/TestOpenAPIv3NoOperationIDsRevamp.golden b/pkg/loader/testdata/openapi/TestOpenAPIv3NoOperationIDsRevamp.golden index d89e976e..ac32cc58 100644 --- a/pkg/loader/testdata/openapi/TestOpenAPIv3NoOperationIDsRevamp.golden +++ b/pkg/loader/testdata/openapi/TestOpenAPIv3NoOperationIDsRevamp.golden @@ -36,13 +36,13 @@ types.ToolSet{ Name: "getSchemaSwaggerPetstore", Description: "Get the JSONSchema for the arguments for an operation for Swagger Petstore. You must do this before you run the operation.", ModelName: "gpt-4o", - Arguments: &huma.Schema{ + Arguments: &jsonschema.Schema{ Type: "object", - Properties: map[string]*huma.Schema{ + Properties: map[string]*jsonschema.Schema{ "operation": { - Type: "string", Title: "operation", Description: "the name of the operation to get the schema for", + Type: "string", Required: []string{ "operation", }, @@ -86,19 +86,19 @@ types.ToolSet{ Name: "runOperationSwaggerPetstore", Description: "Run an operation for Swagger Petstore. You MUST call get-schema for the operation before you use this tool.", ModelName: "gpt-4o", - Arguments: &huma.Schema{ + Arguments: &jsonschema.Schema{ Type: "object", - Properties: map[string]*huma.Schema{ + Properties: map[string]*jsonschema.Schema{ "args": { - Type: "string", Title: "args", Description: "the JSON string containing arguments; must match the JSONSchema for the operation", + Type: "string", Required: []string{"args"}, }, "operation": { - Type: "string", Title: "operation", Description: "the name of the operation to run", + Type: "string", Required: []string{"operation"}, }, }, diff --git a/pkg/loader/testdata/openapi/TestOpenAPIv3Revamp.golden b/pkg/loader/testdata/openapi/TestOpenAPIv3Revamp.golden index d89e976e..ac32cc58 100644 --- a/pkg/loader/testdata/openapi/TestOpenAPIv3Revamp.golden +++ b/pkg/loader/testdata/openapi/TestOpenAPIv3Revamp.golden @@ -36,13 +36,13 @@ types.ToolSet{ Name: "getSchemaSwaggerPetstore", Description: "Get the JSONSchema for the arguments for an operation for Swagger Petstore. You must do this before you run the operation.", ModelName: "gpt-4o", - Arguments: &huma.Schema{ + Arguments: &jsonschema.Schema{ Type: "object", - Properties: map[string]*huma.Schema{ + Properties: map[string]*jsonschema.Schema{ "operation": { - Type: "string", Title: "operation", Description: "the name of the operation to get the schema for", + Type: "string", Required: []string{ "operation", }, @@ -86,19 +86,19 @@ types.ToolSet{ Name: "runOperationSwaggerPetstore", Description: "Run an operation for Swagger Petstore. You MUST call get-schema for the operation before you use this tool.", ModelName: "gpt-4o", - Arguments: &huma.Schema{ + Arguments: &jsonschema.Schema{ Type: "object", - Properties: map[string]*huma.Schema{ + Properties: map[string]*jsonschema.Schema{ "args": { - Type: "string", Title: "args", Description: "the JSON string containing arguments; must match the JSONSchema for the operation", + Type: "string", Required: []string{"args"}, }, "operation": { - Type: "string", Title: "operation", Description: "the name of the operation to run", + Type: "string", Required: []string{"operation"}, }, }, diff --git a/pkg/mcp/loader.go b/pkg/mcp/loader.go index 086f74bb..9469db7a 100644 --- a/pkg/mcp/loader.go +++ b/pkg/mcp/loader.go @@ -10,10 +10,10 @@ import ( "strings" "sync" - humav2 "github.com/danielgtaylor/huma/v2" "github.com/gptscript-ai/gptscript/pkg/hash" "github.com/gptscript-ai/gptscript/pkg/mvl" "github.com/gptscript-ai/gptscript/pkg/types" + "github.com/modelcontextprotocol/go-sdk/jsonschema" nmcp "github.com/nanobot-ai/nanobot/pkg/mcp" ) @@ -196,7 +196,7 @@ func (l *Local) sessionToTools(ctx context.Context, session *Session, toolName s continue } - var schema humav2.Schema + var schema jsonschema.Schema schemaData, err := json.Marshal(tool.InputSchema) if err != nil { diff --git a/pkg/openai/client.go b/pkg/openai/client.go index 69e6621d..7715c657 100644 --- a/pkg/openai/client.go +++ b/pkg/openai/client.go @@ -11,7 +11,6 @@ import ( "strings" "time" - humav2 "github.com/danielgtaylor/huma/v2" openai "github.com/gptscript-ai/chat-completion-client" "github.com/gptscript-ai/gptscript/pkg/cache" "github.com/gptscript-ai/gptscript/pkg/counter" @@ -406,7 +405,7 @@ func (c *Client) Call(ctx context.Context, messageRequest types.CompletionReques var params any = tool.Function.Parameters if tool.Function.Parameters == nil || len(tool.Function.Parameters.Properties) == 0 { params = map[string]any{ - "type": humav2.TypeObject, + "type": "object", "properties": map[string]any{}, } } diff --git a/pkg/parser/parser.go b/pkg/parser/parser.go index e7ec287d..3d26d9cc 100644 --- a/pkg/parser/parser.go +++ b/pkg/parser/parser.go @@ -10,8 +10,8 @@ import ( "strconv" "strings" - humav2 "github.com/danielgtaylor/huma/v2" "github.com/gptscript-ai/gptscript/pkg/types" + "github.com/modelcontextprotocol/go-sdk/jsonschema" ) var ( @@ -54,9 +54,9 @@ func csv(line string) (result []string) { func addArg(line string, tool *types.Tool) error { if tool.Arguments == nil { - tool.Arguments = &humav2.Schema{ + tool.Arguments = &jsonschema.Schema{ Type: "object", - Properties: make(map[string]*humav2.Schema, 1), + Properties: make(map[string]*jsonschema.Schema, 1), } } @@ -65,7 +65,7 @@ func addArg(line string, tool *types.Tool) error { return fmt.Errorf("invalid arg format: %s", line) } - tool.Arguments.Properties[key] = &humav2.Schema{ + tool.Arguments.Properties[key] = &jsonschema.Schema{ Description: strings.TrimSpace(value), Type: "string", } diff --git a/pkg/system/prompt.go b/pkg/system/prompt.go index a4fe5f26..04497854 100644 --- a/pkg/system/prompt.go +++ b/pkg/system/prompt.go @@ -5,7 +5,7 @@ import ( "os" "strings" - humav2 "github.com/danielgtaylor/huma/v2" + "github.com/modelcontextprotocol/go-sdk/jsonschema" ) // Suffix is default suffix of gptscript files @@ -26,9 +26,9 @@ You don't move to the next step until you have a result. // to just send pure text but the interface required JSON (as that is the fundamental interface of tools in OpenAI) var DefaultPromptParameter = "defaultPromptParameter" -var DefaultToolSchema = humav2.Schema{ +var DefaultToolSchema = jsonschema.Schema{ Type: "object", - Properties: map[string]*humav2.Schema{ + Properties: map[string]*jsonschema.Schema{ DefaultPromptParameter: { Description: "Prompt to send to the tool. This may be an instruction or question.", Type: "string", @@ -36,9 +36,9 @@ var DefaultToolSchema = humav2.Schema{ }, } -var DefaultChatSchema = humav2.Schema{ +var DefaultChatSchema = jsonschema.Schema{ Type: "object", - Properties: map[string]*humav2.Schema{ + Properties: map[string]*jsonschema.Schema{ DefaultPromptParameter: { Description: "Prompt to send to the assistant. This may be an instruction or question.", Type: "string", diff --git a/pkg/tests/runner2_test.go b/pkg/tests/runner2_test.go index 80131245..9668a98a 100644 --- a/pkg/tests/runner2_test.go +++ b/pkg/tests/runner2_test.go @@ -302,16 +302,16 @@ name: mcp "modelName": "gpt-4o", "internalPrompt": null, "arguments": { - "properties": { - "insight": { - "description": "Business insight discovered from data analysis", - "type": "string" - } - }, + "type": "object", "required": [ "insight" ], - "type": "object" + "properties": { + "insight": { + "type": "string", + "description": "Business insight discovered from data analysis" + } + } }, "instructions": "#!sys.mcp.invoke.append_insight e592cc0c9483290685611ba70bd8595829cc794f7eae0419eabb3388bf0d3529", "id": "inline:append_insight", @@ -335,16 +335,16 @@ name: mcp "modelName": "gpt-4o", "internalPrompt": null, "arguments": { - "properties": { - "query": { - "description": "CREATE TABLE SQL statement", - "type": "string" - } - }, + "type": "object", "required": [ "query" ], - "type": "object" + "properties": { + "query": { + "type": "string", + "description": "CREATE TABLE SQL statement" + } + } }, "instructions": "#!sys.mcp.invoke.create_table e592cc0c9483290685611ba70bd8595829cc794f7eae0419eabb3388bf0d3529", "id": "inline:create_table", @@ -368,16 +368,16 @@ name: mcp "modelName": "gpt-4o", "internalPrompt": null, "arguments": { - "properties": { - "table_name": { - "description": "Name of the table to describe", - "type": "string" - } - }, + "type": "object", "required": [ "table_name" ], - "type": "object" + "properties": { + "table_name": { + "type": "string", + "description": "Name of the table to describe" + } + } }, "instructions": "#!sys.mcp.invoke.describe_table e592cc0c9483290685611ba70bd8595829cc794f7eae0419eabb3388bf0d3529", "id": "inline:describe_table", @@ -494,16 +494,16 @@ name: mcp "modelName": "gpt-4o", "internalPrompt": null, "arguments": { - "properties": { - "query": { - "description": "SELECT SQL query to execute", - "type": "string" - } - }, + "type": "object", "required": [ "query" ], - "type": "object" + "properties": { + "query": { + "type": "string", + "description": "SELECT SQL query to execute" + } + } }, "instructions": "#!sys.mcp.invoke.read_query e592cc0c9483290685611ba70bd8595829cc794f7eae0419eabb3388bf0d3529", "id": "inline:read_query", @@ -527,16 +527,16 @@ name: mcp "modelName": "gpt-4o", "internalPrompt": null, "arguments": { - "properties": { - "query": { - "description": "SQL query to execute", - "type": "string" - } - }, + "type": "object", "required": [ "query" ], - "type": "object" + "properties": { + "query": { + "type": "string", + "description": "SQL query to execute" + } + } }, "instructions": "#!sys.mcp.invoke.write_query e592cc0c9483290685611ba70bd8595829cc794f7eae0419eabb3388bf0d3529", "id": "inline:write_query", diff --git a/pkg/tests/runner_test.go b/pkg/tests/runner_test.go index bb1193ea..bda3a5b6 100644 --- a/pkg/tests/runner_test.go +++ b/pkg/tests/runner_test.go @@ -264,13 +264,13 @@ func TestSubChat(t *testing.T) { "toolID": "testdata/TestSubChat/test.gpt:chatbot", "name": "chatbot", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the assistant. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the assistant. This may be an instruction or question." } - }, - "type": "object" + } } } } @@ -389,13 +389,13 @@ func TestSubChat(t *testing.T) { "toolID": "testdata/TestSubChat/test.gpt:chatbot", "name": "chatbot", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the assistant. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the assistant. This may be an instruction or question." } - }, - "type": "object" + } } } } diff --git a/pkg/tests/testdata/TestAgentOnly/call1.golden b/pkg/tests/testdata/TestAgentOnly/call1.golden index b63c6fd3..6fadf4ed 100644 --- a/pkg/tests/testdata/TestAgentOnly/call1.golden +++ b/pkg/tests/testdata/TestAgentOnly/call1.golden @@ -7,13 +7,13 @@ "toolID": "testdata/TestAgentOnly/test.gpt:agent2", "name": "agent2", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the assistant. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the assistant. This may be an instruction or question." } - }, - "type": "object" + } } } } diff --git a/pkg/tests/testdata/TestAgentOnly/call2.golden b/pkg/tests/testdata/TestAgentOnly/call2.golden index 7f6b155b..909faf53 100644 --- a/pkg/tests/testdata/TestAgentOnly/call2.golden +++ b/pkg/tests/testdata/TestAgentOnly/call2.golden @@ -7,13 +7,13 @@ "toolID": "testdata/TestAgentOnly/test.gpt:agent3", "name": "agent3", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the assistant. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the assistant. This may be an instruction or question." } - }, - "type": "object" + } } } }, @@ -22,13 +22,13 @@ "toolID": "testdata/TestAgentOnly/test.gpt:agent1", "name": "agent1", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the assistant. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the assistant. This may be an instruction or question." } - }, - "type": "object" + } } } } diff --git a/pkg/tests/testdata/TestAgentOnly/step1.golden b/pkg/tests/testdata/TestAgentOnly/step1.golden index 2cda2025..9bf8e319 100644 --- a/pkg/tests/testdata/TestAgentOnly/step1.golden +++ b/pkg/tests/testdata/TestAgentOnly/step1.golden @@ -15,13 +15,13 @@ "toolID": "testdata/TestAgentOnly/test.gpt:agent2", "name": "agent2", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the assistant. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the assistant. This may be an instruction or question." } - }, - "type": "object" + } } } } @@ -99,13 +99,13 @@ "toolID": "testdata/TestAgentOnly/test.gpt:agent3", "name": "agent3", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the assistant. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the assistant. This may be an instruction or question." } - }, - "type": "object" + } } } }, @@ -114,13 +114,13 @@ "toolID": "testdata/TestAgentOnly/test.gpt:agent1", "name": "agent1", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the assistant. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the assistant. This may be an instruction or question." } - }, - "type": "object" + } } } } diff --git a/pkg/tests/testdata/TestAgents/call1.golden b/pkg/tests/testdata/TestAgents/call1.golden index d3c4a86d..be85da0e 100644 --- a/pkg/tests/testdata/TestAgents/call1.golden +++ b/pkg/tests/testdata/TestAgents/call1.golden @@ -7,13 +7,13 @@ "toolID": "testdata/TestAgents/test.gpt:agent1", "name": "agent1", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the assistant. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the assistant. This may be an instruction or question." } - }, - "type": "object" + } } } }, @@ -22,13 +22,13 @@ "toolID": "testdata/TestAgents/test.gpt:agent2", "name": "agent2", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the assistant. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the assistant. This may be an instruction or question." } - }, - "type": "object" + } } } } diff --git a/pkg/tests/testdata/TestAgents/call2.golden b/pkg/tests/testdata/TestAgents/call2.golden index 950ad2ea..b0c301f8 100644 --- a/pkg/tests/testdata/TestAgents/call2.golden +++ b/pkg/tests/testdata/TestAgents/call2.golden @@ -7,13 +7,13 @@ "toolID": "testdata/TestAgents/test.gpt:agent2", "name": "agent2", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the assistant. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the assistant. This may be an instruction or question." } - }, - "type": "object" + } } } } diff --git a/pkg/tests/testdata/TestAgents/call3.golden b/pkg/tests/testdata/TestAgents/call3.golden index 5b1638e0..237c6c84 100644 --- a/pkg/tests/testdata/TestAgents/call3.golden +++ b/pkg/tests/testdata/TestAgents/call3.golden @@ -7,13 +7,13 @@ "toolID": "testdata/TestAgents/test.gpt:agent3", "name": "agent3", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the assistant. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the assistant. This may be an instruction or question." } - }, - "type": "object" + } } } }, @@ -22,13 +22,13 @@ "toolID": "testdata/TestAgents/test.gpt:agent1", "name": "agent1", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the assistant. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the assistant. This may be an instruction or question." } - }, - "type": "object" + } } } } diff --git a/pkg/tests/testdata/TestAgents/step1.golden b/pkg/tests/testdata/TestAgents/step1.golden index 72e01114..d97b6495 100644 --- a/pkg/tests/testdata/TestAgents/step1.golden +++ b/pkg/tests/testdata/TestAgents/step1.golden @@ -15,13 +15,13 @@ "toolID": "testdata/TestAgents/test.gpt:agent1", "name": "agent1", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the assistant. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the assistant. This may be an instruction or question." } - }, - "type": "object" + } } } }, @@ -30,13 +30,13 @@ "toolID": "testdata/TestAgents/test.gpt:agent2", "name": "agent2", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the assistant. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the assistant. This may be an instruction or question." } - }, - "type": "object" + } } } } @@ -110,13 +110,13 @@ "toolID": "testdata/TestAgents/test.gpt:agent2", "name": "agent2", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the assistant. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the assistant. This may be an instruction or question." } - }, - "type": "object" + } } } } @@ -181,13 +181,13 @@ "toolID": "testdata/TestAgents/test.gpt:agent3", "name": "agent3", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the assistant. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the assistant. This may be an instruction or question." } - }, - "type": "object" + } } } }, @@ -196,13 +196,13 @@ "toolID": "testdata/TestAgents/test.gpt:agent1", "name": "agent1", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the assistant. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the assistant. This may be an instruction or question." } - }, - "type": "object" + } } } } diff --git a/pkg/tests/testdata/TestAsterick/call1.golden b/pkg/tests/testdata/TestAsterick/call1.golden index 3f2fa0b1..d741da5d 100644 --- a/pkg/tests/testdata/TestAsterick/call1.golden +++ b/pkg/tests/testdata/TestAsterick/call1.golden @@ -6,13 +6,13 @@ "toolID": "testdata/TestAsterick/other.gpt:afoo", "name": "afoo", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the tool. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the tool. This may be an instruction or question." } - }, - "type": "object" + } } } }, @@ -21,13 +21,13 @@ "toolID": "testdata/TestAsterick/other.gpt:a", "name": "a", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the tool. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the tool. This may be an instruction or question." } - }, - "type": "object" + } } } } diff --git a/pkg/tests/testdata/TestCase/call1.golden b/pkg/tests/testdata/TestCase/call1.golden index 1e6d76a5..c9bbcbb2 100644 --- a/pkg/tests/testdata/TestCase/call1.golden +++ b/pkg/tests/testdata/TestCase/call1.golden @@ -7,13 +7,13 @@ "name": "Bob", "description": "I'm Bob, a friendly guy.", "parameters": { + "type": "object", "properties": { "question": { - "description": "The question to ask Bob.", - "type": "string" + "type": "string", + "description": "The question to ask Bob." } - }, - "type": "object" + } } } } diff --git a/pkg/tests/testdata/TestCase2/call1.golden b/pkg/tests/testdata/TestCase2/call1.golden index d9b446d0..fc7a5728 100644 --- a/pkg/tests/testdata/TestCase2/call1.golden +++ b/pkg/tests/testdata/TestCase2/call1.golden @@ -7,13 +7,13 @@ "name": "bob", "description": "I'm Bob, a friendly guy.", "parameters": { + "type": "object", "properties": { "question": { - "description": "The question to ask Bob.", - "type": "string" + "type": "string", + "description": "The question to ask Bob." } - }, - "type": "object" + } } } } diff --git a/pkg/tests/testdata/TestContextSubChat/call1.golden b/pkg/tests/testdata/TestContextSubChat/call1.golden index 225401db..fd641ecc 100644 --- a/pkg/tests/testdata/TestContextSubChat/call1.golden +++ b/pkg/tests/testdata/TestContextSubChat/call1.golden @@ -6,13 +6,13 @@ "toolID": "testdata/TestContextSubChat/test.gpt:chatbot", "name": "chatbot", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the assistant. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the assistant. This may be an instruction or question." } - }, - "type": "object" + } } } } diff --git a/pkg/tests/testdata/TestContextSubChat/call2.golden b/pkg/tests/testdata/TestContextSubChat/call2.golden index a6cf25c6..b5f30991 100644 --- a/pkg/tests/testdata/TestContextSubChat/call2.golden +++ b/pkg/tests/testdata/TestContextSubChat/call2.golden @@ -8,13 +8,13 @@ "name": "chatFinish", "description": "Concludes the conversation. This can not be used to ask a question.", "parameters": { + "type": "object", "properties": { "return": { - "description": "The instructed value to return or a summary of the dialog if no value is instructed", - "type": "string" + "type": "string", + "description": "The instructed value to return or a summary of the dialog if no value is instructed" } - }, - "type": "object" + } } } } diff --git a/pkg/tests/testdata/TestDualSubChat/call1.golden b/pkg/tests/testdata/TestDualSubChat/call1.golden index 2baf798a..52ab033a 100644 --- a/pkg/tests/testdata/TestDualSubChat/call1.golden +++ b/pkg/tests/testdata/TestDualSubChat/call1.golden @@ -6,13 +6,13 @@ "toolID": "testdata/TestDualSubChat/test.gpt:chatbot", "name": "chatbot", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the assistant. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the assistant. This may be an instruction or question." } - }, - "type": "object" + } } } }, @@ -21,13 +21,13 @@ "toolID": "testdata/TestDualSubChat/test.gpt:chatbot2", "name": "chatbot2", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the assistant. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the assistant. This may be an instruction or question." } - }, - "type": "object" + } } } } diff --git a/pkg/tests/testdata/TestDualSubChat/call2.golden b/pkg/tests/testdata/TestDualSubChat/call2.golden index a6cf25c6..b5f30991 100644 --- a/pkg/tests/testdata/TestDualSubChat/call2.golden +++ b/pkg/tests/testdata/TestDualSubChat/call2.golden @@ -8,13 +8,13 @@ "name": "chatFinish", "description": "Concludes the conversation. This can not be used to ask a question.", "parameters": { + "type": "object", "properties": { "return": { - "description": "The instructed value to return or a summary of the dialog if no value is instructed", - "type": "string" + "type": "string", + "description": "The instructed value to return or a summary of the dialog if no value is instructed" } - }, - "type": "object" + } } } } diff --git a/pkg/tests/testdata/TestDualSubChat/call3.golden b/pkg/tests/testdata/TestDualSubChat/call3.golden index ddcc81c9..ca431fc8 100644 --- a/pkg/tests/testdata/TestDualSubChat/call3.golden +++ b/pkg/tests/testdata/TestDualSubChat/call3.golden @@ -8,13 +8,13 @@ "name": "chatFinish", "description": "Concludes the conversation. This can not be used to ask a question.", "parameters": { + "type": "object", "properties": { "return": { - "description": "The instructed value to return or a summary of the dialog if no value is instructed", - "type": "string" + "type": "string", + "description": "The instructed value to return or a summary of the dialog if no value is instructed" } - }, - "type": "object" + } } } } diff --git a/pkg/tests/testdata/TestDualSubChat/call4.golden b/pkg/tests/testdata/TestDualSubChat/call4.golden index 600e3ba5..580fdb86 100644 --- a/pkg/tests/testdata/TestDualSubChat/call4.golden +++ b/pkg/tests/testdata/TestDualSubChat/call4.golden @@ -8,13 +8,13 @@ "name": "chatFinish", "description": "Concludes the conversation. This can not be used to ask a question.", "parameters": { + "type": "object", "properties": { "return": { - "description": "The instructed value to return or a summary of the dialog if no value is instructed", - "type": "string" + "type": "string", + "description": "The instructed value to return or a summary of the dialog if no value is instructed" } - }, - "type": "object" + } } } } diff --git a/pkg/tests/testdata/TestDualSubChat/call5.golden b/pkg/tests/testdata/TestDualSubChat/call5.golden index 54823934..de6a4a77 100644 --- a/pkg/tests/testdata/TestDualSubChat/call5.golden +++ b/pkg/tests/testdata/TestDualSubChat/call5.golden @@ -8,13 +8,13 @@ "name": "chatFinish", "description": "Concludes the conversation. This can not be used to ask a question.", "parameters": { + "type": "object", "properties": { "return": { - "description": "The instructed value to return or a summary of the dialog if no value is instructed", - "type": "string" + "type": "string", + "description": "The instructed value to return or a summary of the dialog if no value is instructed" } - }, - "type": "object" + } } } } diff --git a/pkg/tests/testdata/TestDualSubChat/call6.golden b/pkg/tests/testdata/TestDualSubChat/call6.golden index a9a8a1c4..d3bbb31d 100644 --- a/pkg/tests/testdata/TestDualSubChat/call6.golden +++ b/pkg/tests/testdata/TestDualSubChat/call6.golden @@ -8,13 +8,13 @@ "name": "chatFinish", "description": "Concludes the conversation. This can not be used to ask a question.", "parameters": { + "type": "object", "properties": { "return": { - "description": "The instructed value to return or a summary of the dialog if no value is instructed", - "type": "string" + "type": "string", + "description": "The instructed value to return or a summary of the dialog if no value is instructed" } - }, - "type": "object" + } } } } diff --git a/pkg/tests/testdata/TestDualSubChat/call7.golden b/pkg/tests/testdata/TestDualSubChat/call7.golden index ff19a0e8..de734587 100644 --- a/pkg/tests/testdata/TestDualSubChat/call7.golden +++ b/pkg/tests/testdata/TestDualSubChat/call7.golden @@ -6,13 +6,13 @@ "toolID": "testdata/TestDualSubChat/test.gpt:chatbot", "name": "chatbot", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the assistant. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the assistant. This may be an instruction or question." } - }, - "type": "object" + } } } }, @@ -21,13 +21,13 @@ "toolID": "testdata/TestDualSubChat/test.gpt:chatbot2", "name": "chatbot2", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the assistant. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the assistant. This may be an instruction or question." } - }, - "type": "object" + } } } } diff --git a/pkg/tests/testdata/TestDualSubChat/step1.golden b/pkg/tests/testdata/TestDualSubChat/step1.golden index f29dfd60..b866f976 100644 --- a/pkg/tests/testdata/TestDualSubChat/step1.golden +++ b/pkg/tests/testdata/TestDualSubChat/step1.golden @@ -14,13 +14,13 @@ "toolID": "testdata/TestDualSubChat/test.gpt:chatbot", "name": "chatbot", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the assistant. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the assistant. This may be an instruction or question." } - }, - "type": "object" + } } } }, @@ -29,13 +29,13 @@ "toolID": "testdata/TestDualSubChat/test.gpt:chatbot2", "name": "chatbot2", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the assistant. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the assistant. This may be an instruction or question." } - }, - "type": "object" + } } } } @@ -135,13 +135,13 @@ "name": "chatFinish", "description": "Concludes the conversation. This can not be used to ask a question.", "parameters": { + "type": "object", "properties": { "return": { - "description": "The instructed value to return or a summary of the dialog if no value is instructed", - "type": "string" + "type": "string", + "description": "The instructed value to return or a summary of the dialog if no value is instructed" } - }, - "type": "object" + } } } } @@ -200,13 +200,13 @@ "name": "chatFinish", "description": "Concludes the conversation. This can not be used to ask a question.", "parameters": { + "type": "object", "properties": { "return": { - "description": "The instructed value to return or a summary of the dialog if no value is instructed", - "type": "string" + "type": "string", + "description": "The instructed value to return or a summary of the dialog if no value is instructed" } - }, - "type": "object" + } } } } diff --git a/pkg/tests/testdata/TestDualSubChat/step2.golden b/pkg/tests/testdata/TestDualSubChat/step2.golden index 830a8e7c..8876c290 100644 --- a/pkg/tests/testdata/TestDualSubChat/step2.golden +++ b/pkg/tests/testdata/TestDualSubChat/step2.golden @@ -14,13 +14,13 @@ "toolID": "testdata/TestDualSubChat/test.gpt:chatbot", "name": "chatbot", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the assistant. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the assistant. This may be an instruction or question." } - }, - "type": "object" + } } } }, @@ -29,13 +29,13 @@ "toolID": "testdata/TestDualSubChat/test.gpt:chatbot2", "name": "chatbot2", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the assistant. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the assistant. This may be an instruction or question." } - }, - "type": "object" + } } } } @@ -142,13 +142,13 @@ "name": "chatFinish", "description": "Concludes the conversation. This can not be used to ask a question.", "parameters": { + "type": "object", "properties": { "return": { - "description": "The instructed value to return or a summary of the dialog if no value is instructed", - "type": "string" + "type": "string", + "description": "The instructed value to return or a summary of the dialog if no value is instructed" } - }, - "type": "object" + } } } } diff --git a/pkg/tests/testdata/TestDualSubChat/step3.golden b/pkg/tests/testdata/TestDualSubChat/step3.golden index 4f3b415a..1876df5b 100644 --- a/pkg/tests/testdata/TestDualSubChat/step3.golden +++ b/pkg/tests/testdata/TestDualSubChat/step3.golden @@ -14,13 +14,13 @@ "toolID": "testdata/TestDualSubChat/test.gpt:chatbot", "name": "chatbot", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the assistant. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the assistant. This may be an instruction or question." } - }, - "type": "object" + } } } }, @@ -29,13 +29,13 @@ "toolID": "testdata/TestDualSubChat/test.gpt:chatbot2", "name": "chatbot2", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the assistant. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the assistant. This may be an instruction or question." } - }, - "type": "object" + } } } } @@ -142,13 +142,13 @@ "name": "chatFinish", "description": "Concludes the conversation. This can not be used to ask a question.", "parameters": { + "type": "object", "properties": { "return": { - "description": "The instructed value to return or a summary of the dialog if no value is instructed", - "type": "string" + "type": "string", + "description": "The instructed value to return or a summary of the dialog if no value is instructed" } - }, - "type": "object" + } } } } diff --git a/pkg/tests/testdata/TestExport/call1.golden b/pkg/tests/testdata/TestExport/call1.golden index b700ee55..8b663ff3 100644 --- a/pkg/tests/testdata/TestExport/call1.golden +++ b/pkg/tests/testdata/TestExport/call1.golden @@ -6,13 +6,13 @@ "toolID": "testdata/TestExport/parent.gpt:frommain", "name": "frommain", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the tool. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the tool. This may be an instruction or question." } - }, - "type": "object" + } } } }, @@ -21,13 +21,13 @@ "toolID": "testdata/TestExport/sub/child.gpt:transient", "name": "transient", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the tool. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the tool. This may be an instruction or question." } - }, - "type": "object" + } } } }, @@ -36,13 +36,13 @@ "toolID": "testdata/TestExport/parent.gpt:parent-local", "name": "parentLocal", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the tool. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the tool. This may be an instruction or question." } - }, - "type": "object" + } } } } diff --git a/pkg/tests/testdata/TestExport/call3.golden b/pkg/tests/testdata/TestExport/call3.golden index d2abca0c..181980aa 100644 --- a/pkg/tests/testdata/TestExport/call3.golden +++ b/pkg/tests/testdata/TestExport/call3.golden @@ -6,13 +6,13 @@ "toolID": "testdata/TestExport/parent.gpt:frommain", "name": "frommain", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the tool. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the tool. This may be an instruction or question." } - }, - "type": "object" + } } } }, @@ -21,13 +21,13 @@ "toolID": "testdata/TestExport/sub/child.gpt:transient", "name": "transient", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the tool. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the tool. This may be an instruction or question." } - }, - "type": "object" + } } } }, @@ -36,13 +36,13 @@ "toolID": "testdata/TestExport/parent.gpt:parent-local", "name": "parentLocal", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the tool. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the tool. This may be an instruction or question." } - }, - "type": "object" + } } } } diff --git a/pkg/tests/testdata/TestExportContext/call1.golden b/pkg/tests/testdata/TestExportContext/call1.golden index 0ee8f9fe..7ba20676 100644 --- a/pkg/tests/testdata/TestExportContext/call1.golden +++ b/pkg/tests/testdata/TestExportContext/call1.golden @@ -6,13 +6,13 @@ "toolID": "testdata/TestExportContext/test.gpt:subtool", "name": "subtool", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the tool. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the tool. This may be an instruction or question." } - }, - "type": "object" + } } } }, @@ -22,13 +22,13 @@ "name": "sampletool", "description": "sample", "parameters": { + "type": "object", "properties": { "foo": { - "description": "foo description", - "type": "string" + "type": "string", + "description": "foo description" } - }, - "type": "object" + } } } } diff --git a/pkg/tests/testdata/TestSubChat/call1.golden b/pkg/tests/testdata/TestSubChat/call1.golden index 0d906395..f0e0b491 100644 --- a/pkg/tests/testdata/TestSubChat/call1.golden +++ b/pkg/tests/testdata/TestSubChat/call1.golden @@ -6,13 +6,13 @@ "toolID": "testdata/TestSubChat/test.gpt:chatbot", "name": "chatbot", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the assistant. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the assistant. This may be an instruction or question." } - }, - "type": "object" + } } } } diff --git a/pkg/tests/testdata/TestSysContext/call1.golden b/pkg/tests/testdata/TestSysContext/call1.golden index 4c9c51d0..f1926c33 100644 --- a/pkg/tests/testdata/TestSysContext/call1.golden +++ b/pkg/tests/testdata/TestSysContext/call1.golden @@ -7,13 +7,13 @@ "toolID": "testdata/TestSysContext/file.gpt:I am Superman Agent", "name": "iAmSuperman", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the tool. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the tool. This may be an instruction or question." } - }, - "type": "object" + } } } } diff --git a/pkg/tests/testdata/TestSysContext/step1.golden b/pkg/tests/testdata/TestSysContext/step1.golden index 426e5991..2755652a 100644 --- a/pkg/tests/testdata/TestSysContext/step1.golden +++ b/pkg/tests/testdata/TestSysContext/step1.golden @@ -15,13 +15,13 @@ "toolID": "testdata/TestSysContext/file.gpt:I am Superman Agent", "name": "iAmSuperman", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the tool. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the tool. This may be an instruction or question." } - }, - "type": "object" + } } } } diff --git a/pkg/tests/testdata/TestToolAs/call1.golden b/pkg/tests/testdata/TestToolAs/call1.golden index 55796fea..758f9cca 100644 --- a/pkg/tests/testdata/TestToolAs/call1.golden +++ b/pkg/tests/testdata/TestToolAs/call1.golden @@ -6,13 +6,13 @@ "toolID": "testdata/TestToolAs/test.gpt:infile", "name": "local", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the tool. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the tool. This may be an instruction or question." } - }, - "type": "object" + } } } }, @@ -21,13 +21,13 @@ "toolID": "testdata/TestToolAs/other.gpt:", "name": "remote", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the tool. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the tool. This may be an instruction or question." } - }, - "type": "object" + } } } } diff --git a/pkg/tests/testdata/TestToolRefAll/call1.golden b/pkg/tests/testdata/TestToolRefAll/call1.golden index 9289affa..2d7a7b08 100644 --- a/pkg/tests/testdata/TestToolRefAll/call1.golden +++ b/pkg/tests/testdata/TestToolRefAll/call1.golden @@ -6,13 +6,13 @@ "toolID": "testdata/TestToolRefAll/test.gpt:tool", "name": "tool", "parameters": { + "type": "object", "properties": { "toolArg": { - "description": "stuff", - "type": "string" + "type": "string", + "description": "stuff" } - }, - "type": "object" + } } } }, @@ -21,13 +21,13 @@ "toolID": "testdata/TestToolRefAll/test.gpt:agentAssistant", "name": "agentAssistant", "parameters": { + "type": "object", "properties": { "defaultPromptParameter": { - "description": "Prompt to send to the tool. This may be an instruction or question.", - "type": "string" + "type": "string", + "description": "Prompt to send to the tool. This may be an instruction or question." } - }, - "type": "object" + } } } }, @@ -36,13 +36,13 @@ "toolID": "testdata/TestToolRefAll/test.gpt:none", "name": "none", "parameters": { + "type": "object", "properties": { "noneArg": { - "description": "stuff", - "type": "string" + "type": "string", + "description": "stuff" } - }, - "type": "object" + } } } } diff --git a/pkg/tests/testdata/TestToolsChange/call1.golden b/pkg/tests/testdata/TestToolsChange/call1.golden index 69ab3d03..8bbc8ed5 100644 --- a/pkg/tests/testdata/TestToolsChange/call1.golden +++ b/pkg/tests/testdata/TestToolsChange/call1.golden @@ -8,13 +8,13 @@ "name": "ls", "description": "Lists the contents of a directory", "parameters": { + "type": "object", "properties": { "dir": { - "description": "The directory to list", - "type": "string" + "type": "string", + "description": "The directory to list" } - }, - "type": "object" + } } } }, @@ -24,13 +24,13 @@ "name": "read", "description": "Reads the contents of a file. Can only read plain text files, not binary files", "parameters": { + "type": "object", "properties": { "filename": { - "description": "The name of the file to read", - "type": "string" + "type": "string", + "description": "The name of the file to read" } - }, - "type": "object" + } } } }, @@ -40,17 +40,17 @@ "name": "write", "description": "Write the contents to a file", "parameters": { + "type": "object", "properties": { "content": { - "description": "The content to write", - "type": "string" + "type": "string", + "description": "The content to write" }, "filename": { - "description": "The name of the file to write to", - "type": "string" + "type": "string", + "description": "The name of the file to write to" } - }, - "type": "object" + } } } } diff --git a/pkg/tests/testdata/TestToolsChange/call2.golden b/pkg/tests/testdata/TestToolsChange/call2.golden index ad86b7ce..4abdfddf 100644 --- a/pkg/tests/testdata/TestToolsChange/call2.golden +++ b/pkg/tests/testdata/TestToolsChange/call2.golden @@ -8,13 +8,13 @@ "name": "ls", "description": "Lists the contents of a directory", "parameters": { + "type": "object", "properties": { "dir": { - "description": "The directory to list", - "type": "string" + "type": "string", + "description": "The directory to list" } - }, - "type": "object" + } } } }, @@ -24,17 +24,17 @@ "name": "write", "description": "Write the contents to a file", "parameters": { + "type": "object", "properties": { "content": { - "description": "The content to write", - "type": "string" + "type": "string", + "description": "The content to write" }, "filename": { - "description": "The name of the file to write to", - "type": "string" + "type": "string", + "description": "The name of the file to write to" } - }, - "type": "object" + } } } } diff --git a/pkg/tests/testdata/TestToolsChange/step1.golden b/pkg/tests/testdata/TestToolsChange/step1.golden index e26862ae..2274f8b0 100644 --- a/pkg/tests/testdata/TestToolsChange/step1.golden +++ b/pkg/tests/testdata/TestToolsChange/step1.golden @@ -16,13 +16,13 @@ "name": "ls", "description": "Lists the contents of a directory", "parameters": { + "type": "object", "properties": { "dir": { - "description": "The directory to list", - "type": "string" + "type": "string", + "description": "The directory to list" } - }, - "type": "object" + } } } }, @@ -32,13 +32,13 @@ "name": "read", "description": "Reads the contents of a file. Can only read plain text files, not binary files", "parameters": { + "type": "object", "properties": { "filename": { - "description": "The name of the file to read", - "type": "string" + "type": "string", + "description": "The name of the file to read" } - }, - "type": "object" + } } } }, @@ -48,17 +48,17 @@ "name": "write", "description": "Write the contents to a file", "parameters": { + "type": "object", "properties": { "content": { - "description": "The content to write", - "type": "string" + "type": "string", + "description": "The content to write" }, "filename": { - "description": "The name of the file to write to", - "type": "string" + "type": "string", + "description": "The name of the file to write to" } - }, - "type": "object" + } } } } diff --git a/pkg/tests/testdata/TestToolsChange/step2.golden b/pkg/tests/testdata/TestToolsChange/step2.golden index 9c9dbad7..ef99f90e 100644 --- a/pkg/tests/testdata/TestToolsChange/step2.golden +++ b/pkg/tests/testdata/TestToolsChange/step2.golden @@ -16,13 +16,13 @@ "name": "ls", "description": "Lists the contents of a directory", "parameters": { + "type": "object", "properties": { "dir": { - "description": "The directory to list", - "type": "string" + "type": "string", + "description": "The directory to list" } - }, - "type": "object" + } } } }, @@ -32,17 +32,17 @@ "name": "write", "description": "Write the contents to a file", "parameters": { + "type": "object", "properties": { "content": { - "description": "The content to write", - "type": "string" + "type": "string", + "description": "The content to write" }, "filename": { - "description": "The name of the file to write to", - "type": "string" + "type": "string", + "description": "The name of the file to write to" } - }, - "type": "object" + } } } } diff --git a/pkg/types/completion.go b/pkg/types/completion.go index fbd2fb3b..fa7781e5 100644 --- a/pkg/types/completion.go +++ b/pkg/types/completion.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - humav2 "github.com/danielgtaylor/huma/v2" + "github.com/modelcontextprotocol/go-sdk/jsonschema" ) type CompletionRequest struct { @@ -31,10 +31,10 @@ type ChatCompletionTool struct { } type CompletionFunctionDefinition struct { - ToolID string `json:"toolID,omitempty"` - Name string `json:"name"` - Description string `json:"description,omitempty"` - Parameters *humav2.Schema `json:"parameters"` + ToolID string `json:"toolID,omitempty"` + Name string `json:"name"` + Description string `json:"description,omitempty"` + Parameters *jsonschema.Schema `json:"parameters"` } // Chat message role defined by the OpenAI API. diff --git a/pkg/types/jsonschema.go b/pkg/types/jsonschema.go index b88e37b6..38b0e3df 100644 --- a/pkg/types/jsonschema.go +++ b/pkg/types/jsonschema.go @@ -1,17 +1,17 @@ package types -import humav2 "github.com/danielgtaylor/huma/v2" +import "github.com/modelcontextprotocol/go-sdk/jsonschema" -func ObjectSchema(kv ...string) *humav2.Schema { - s := &humav2.Schema{ - Type: humav2.TypeObject, - Properties: make(map[string]*humav2.Schema, len(kv)/2), +func ObjectSchema(kv ...string) *jsonschema.Schema { + s := &jsonschema.Schema{ + Type: "object", + Properties: make(map[string]*jsonschema.Schema, len(kv)/2), } for i, v := range kv { if i%2 == 1 { - s.Properties[kv[i-1]] = &humav2.Schema{ + s.Properties[kv[i-1]] = &jsonschema.Schema{ Description: v, - Type: humav2.TypeString, + Type: "string", } } } diff --git a/pkg/types/tool.go b/pkg/types/tool.go index c5346319..2edeefd6 100644 --- a/pkg/types/tool.go +++ b/pkg/types/tool.go @@ -9,9 +9,9 @@ import ( "sort" "strings" - humav2 "github.com/danielgtaylor/huma/v2" "github.com/google/shlex" "github.com/gptscript-ai/gptscript/pkg/system" + "github.com/modelcontextprotocol/go-sdk/jsonschema" "golang.org/x/exp/maps" ) @@ -120,33 +120,33 @@ func (p Program) SetBlocking() Program { type BuiltinFunc func(ctx context.Context, env []string, input string, progress chan<- string) (string, error) type Parameters struct { - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - MaxTokens int `json:"maxTokens,omitempty"` - ModelName string `json:"modelName,omitempty"` - ModelProvider bool `json:"modelProvider,omitempty"` - JSONResponse bool `json:"jsonResponse,omitempty"` - Chat bool `json:"chat,omitempty"` - Temperature *float32 `json:"temperature,omitempty"` - Cache *bool `json:"cache,omitempty"` - InternalPrompt *bool `json:"internalPrompt"` - Arguments *humav2.Schema `json:"arguments,omitempty"` - Tools []string `json:"tools,omitempty"` - GlobalTools []string `json:"globalTools,omitempty"` - GlobalModelName string `json:"globalModelName,omitempty"` - Context []string `json:"context,omitempty"` - ExportContext []string `json:"exportContext,omitempty"` - Export []string `json:"export,omitempty"` - Agents []string `json:"agents,omitempty"` - Credentials []string `json:"credentials,omitempty"` - ExportCredentials []string `json:"exportCredentials,omitempty"` - InputFilters []string `json:"inputFilters,omitempty"` - ExportInputFilters []string `json:"exportInputFilters,omitempty"` - OutputFilters []string `json:"outputFilters,omitempty"` - ExportOutputFilters []string `json:"exportOutputFilters,omitempty"` - Blocking bool `json:"-"` - Stdin bool `json:"stdin,omitempty"` - Type ToolType `json:"type,omitempty"` + Name string `json:"name,omitempty"` + Description string `json:"description,omitempty"` + MaxTokens int `json:"maxTokens,omitempty"` + ModelName string `json:"modelName,omitempty"` + ModelProvider bool `json:"modelProvider,omitempty"` + JSONResponse bool `json:"jsonResponse,omitempty"` + Chat bool `json:"chat,omitempty"` + Temperature *float32 `json:"temperature,omitempty"` + Cache *bool `json:"cache,omitempty"` + InternalPrompt *bool `json:"internalPrompt"` + Arguments *jsonschema.Schema `json:"arguments,omitempty"` + Tools []string `json:"tools,omitempty"` + GlobalTools []string `json:"globalTools,omitempty"` + GlobalModelName string `json:"globalModelName,omitempty"` + Context []string `json:"context,omitempty"` + ExportContext []string `json:"exportContext,omitempty"` + Export []string `json:"export,omitempty"` + Agents []string `json:"agents,omitempty"` + Credentials []string `json:"credentials,omitempty"` + ExportCredentials []string `json:"exportCredentials,omitempty"` + InputFilters []string `json:"inputFilters,omitempty"` + ExportInputFilters []string `json:"exportInputFilters,omitempty"` + OutputFilters []string `json:"outputFilters,omitempty"` + ExportOutputFilters []string `json:"exportOutputFilters,omitempty"` + Blocking bool `json:"-"` + Stdin bool `json:"stdin,omitempty"` + Type ToolType `json:"type,omitempty"` } func (p Parameters) allExports() []string {