Files
ClaudeMCP/src/mcpTools/listTools.ts
T
azykov@mail.ru 1ce23cfa6e
Build & Deploy / build-app (push) Canceled after 0s
Build & Deploy / deploy (push) Canceled after 0s
calendar event formatting. outputSchema support
2026-07-26 11:50:35 +03:00

29 lines
869 B
TypeScript

import z from "zod";
import { zodToJsonSchema } from "zod-to-json-schema";
import { server } from "../server";
server.registerTool({
title: "list_tools",
config: {
description: "Return the authoritative current list of available local tools with their schemas.",
inputSchema: {},
},
handler: async () => ({
content: [{
type: "text",
text: JSON.stringify(
Object.values(server.tools)
.map((tool) => ({
...tool,
config: {
...tool.config,
inputSchema: zodToJsonSchema(z.object(tool.config.inputSchema ?? {}), { target: "jsonSchema7" }),
}
})),
null,
2,
)
}],
}),
});