TS2589 fixes
TS2589 fixes TS2589
This commit is contained in:
@@ -51,11 +51,15 @@ export default class McpSession {
|
|||||||
|
|
||||||
this.registeredTools.push(
|
this.registeredTools.push(
|
||||||
...toolsToRegister
|
...toolsToRegister
|
||||||
.map((tool) => this.mcp.registerTool(
|
.map(
|
||||||
tool.title,
|
(tool) => this.mcp.registerTool(
|
||||||
tool.config,
|
tool.title,
|
||||||
tool.handler,
|
// ugly workaround for TS2589 error
|
||||||
))
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
tool.config as any,
|
||||||
|
tool.handler,
|
||||||
|
)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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) => {
|
||||||
...tool,
|
// ugly workaround for TS2589 error
|
||||||
config: {
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
...tool.config,
|
const zodObject = (z.object as any)(tool.config.inputSchema);
|
||||||
inputSchema: zodToJsonSchema(z.object(tool.config.inputSchema), { target: "jsonSchema7" }),
|
const inputSchema = zodToJsonSchema(zodObject, { target: "jsonSchema7" });
|
||||||
|
return {
|
||||||
|
...tool,
|
||||||
|
config: {
|
||||||
|
...tool.config,
|
||||||
|
inputSchema,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})),
|
}),
|
||||||
null,
|
null,
|
||||||
2,
|
2,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user