chore: improve tool input schema typing - #166
Conversation
There was a problem hiding this comment.
Before we merge this, what is the intent: documentation (+ code hints etc...) or strict typechecks?
If we want to enforce a strict typecheck, at the moment it's not enough because many modules define tools which have very simple schemas. Example for clearConsole:
inputSchema: {
type: 'object',
properties: {},
},
Because of this above, all the other Console tools' properties will not be strictly checked (it's apparently known as subtype reduction, but I don't know much about typescript). And as I said that's the case for most modules at the moment.
If we want to enforce it, we would need to annotate all tools with satisfies ToolDefinition.
While I am a bit worried about freezing the shape of schema based on the current tools, at least if we have consistent failures when a tool no longer matches it, it will be easy to maintain.
Can you annotate the tools as suggested?
|
Yes, the intent was compile time checking. The reason I initially didn't add I expected the I can add That should also let us make the schema typing stricter (adding stricter types for |
Same here, I was quite surprised it didn't work out of the box.
Yes, let's add the annotation, thanks! |
juliandescottes
left a comment
There was a problem hiding this comment.
Let's add the annotations :)
48b3044 to
9b55067
Compare
|
Added! |
Improving tools defination typing by adding interface for inputSchema.