File tree Expand file tree Collapse file tree 3 files changed +24
-6
lines changed
ts-framework/functions/src Expand file tree Collapse file tree 3 files changed +24
-6
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @gram-ai/functions " : patch
3+ ---
4+
5+ Updated the ` manifest() ` method of the Gram Functions TS framework to avoid
6+ JSON-serializing the input schema for tool definitions. This was a mistake since
7+ the server is expecting a literal object for the schema.
Original file line number Diff line number Diff line change @@ -284,17 +284,28 @@ test("generates a manifest", () => {
284284 tools : [
285285 {
286286 name : "echo" ,
287- inputSchema : expect . stringContaining ( "message" ) ,
287+ inputSchema : expect . objectContaining ( {
288+ type : "object" ,
289+ properties : { message : { type : "string" } } ,
290+ required : [ "message" ] ,
291+ } ) ,
288292 } ,
289293 {
290294 name : "add" ,
291295 description : "Add two numbers" ,
292- inputSchema : expect . stringContaining ( `"required":["a","b"]` ) ,
296+ inputSchema : expect . objectContaining ( {
297+ type : "object" ,
298+ properties : { a : { type : "number" } , b : { type : "number" } } ,
299+ required : [ "a" , "b" ] ,
300+ } ) ,
293301 } ,
294302 {
295303 name : "shout" ,
296304 description : "Shouts the input" ,
297- inputSchema : expect . any ( String ) ,
305+ inputSchema : expect . objectContaining ( {
306+ type : "object" ,
307+ properties : { } ,
308+ } ) ,
298309 variables : {
299310 MESSAGE : { description : "The message to shout" } ,
300311 } ,
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ export type Manifest = {
4949 tools : Array < {
5050 name : string ;
5151 description ?: string ;
52- inputSchema : string ;
52+ inputSchema : unknown ;
5353 variables ?: Record < string , VarDef > ;
5454 } > ;
5555} ;
@@ -223,11 +223,11 @@ export class Gram<
223223 const result : {
224224 name : string ;
225225 description ?: string ;
226- inputSchema : string ;
226+ inputSchema : unknown ;
227227 variables ?: Record < string , VarDef > ;
228228 } = {
229229 name : tool . name ,
230- inputSchema : JSON . stringify ( inputSchema ) ,
230+ inputSchema : inputSchema ,
231231 } ;
232232 if ( tool . description != null ) {
233233 result . description = tool . description ;
You can’t perform that action at this time.
0 commit comments