Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6347e4b211 | ||
|
|
83dea1f728 | ||
|
|
060ac0820a |
@@ -17,7 +17,6 @@
|
|||||||
"engines": {
|
"engines": {
|
||||||
"pnpm": ">=11.4.0 <12"
|
"pnpm": ">=11.4.0 <12"
|
||||||
},
|
},
|
||||||
"type": "module",
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@modelcontextprotocol/sdk": "^1.13.1",
|
"@modelcontextprotocol/sdk": "^1.13.1",
|
||||||
"fastify": "^5.2.1",
|
"fastify": "^5.2.1",
|
||||||
|
|||||||
@@ -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,
|
||||||
))
|
)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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,
|
||||||
)
|
)
|
||||||
|
|||||||
+1
-2
@@ -1,8 +1,7 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ES2022",
|
"target": "ES2022",
|
||||||
"module": "ESNext",
|
"module": "CommonJS",
|
||||||
"moduleResolution": "Bundler",
|
|
||||||
"lib": ["ES2022"],
|
"lib": ["ES2022"],
|
||||||
"outDir": "dist",
|
"outDir": "dist",
|
||||||
"rootDir": "src",
|
"rootDir": "src",
|
||||||
|
|||||||
Reference in New Issue
Block a user