Adding New Tools
Adding New Tools
// In appropriate file (e.g., zetrix-client.ts)
server.setRequestHandler(CallToolRequestSchema, async (request) => {
if (request.params.name === "zetrix_new_tool") {
const { param1 } = request.params.arguments as { param1: string };
try {
const result = await yourFunction(param1);
return {
content: [{
type: "text",
text: JSON.stringify(result, null, 2)
}]
};
} catch (error) {
return {
content: [{
type: "text",
text: `Error: ${error.message}`
}],
isError: true
};
}
}
});Code Guidelines
Last updated