TS2589 fixes

TS2589 fixes

TS2589
This commit is contained in:
azykov@mail.ru
2026-07-01 13:15:10 +03:00
parent 060ac0820a
commit 83dea1f728
2 changed files with 21 additions and 11 deletions
+7 -3
View File
@@ -51,11 +51,15 @@ export default class McpSession {
this.registeredTools.push( this.registeredTools.push(
...toolsToRegister ...toolsToRegister
.map((tool) => this.mcp.registerTool( .map(
(tool) => this.mcp.registerTool(
tool.title, tool.title,
tool.config, // ugly workaround for TS2589 error
// eslint-disable-next-line @typescript-eslint/no-explicit-any
tool.config as any,
tool.handler, tool.handler,
)) )
)
); );
} }
+9 -3
View File
@@ -15,13 +15,19 @@ export const listToolsTool: ToolDef = {
type: "text", type: "text",
text: JSON.stringify( text: JSON.stringify(
Object.values(server.tools) Object.values(server.tools)
.map((tool) => ({ .map((tool) => {
// ugly workaround for TS2589 error
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const zodObject = (z.object as any)(tool.config.inputSchema);
const inputSchema = zodToJsonSchema(zodObject, { target: "jsonSchema7" });
return {
...tool, ...tool,
config: { config: {
...tool.config, ...tool.config,
inputSchema: zodToJsonSchema(z.object(tool.config.inputSchema), { target: "jsonSchema7" }), inputSchema,
} }
})), }
}),
null, null,
2, 2,
) )