initial commit
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import z from "zod";
|
||||
import { zodToJsonSchema } from "zod-to-json-schema";
|
||||
import { server } from "../server";
|
||||
import { ToolDef } from "../types";
|
||||
import { logged } from "../utils/logged";
|
||||
|
||||
export const listToolsTool: ToolDef = {
|
||||
title: "list_tools",
|
||||
config: {
|
||||
description: "Return the authoritative current list of available local tools with their schemas.",
|
||||
inputSchema: {},
|
||||
},
|
||||
handler: logged('list_tools', 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,
|
||||
)
|
||||
}],
|
||||
})),
|
||||
}
|
||||
Reference in New Issue
Block a user