@mseep/apisix-mcp
Version:
[](https://smithery.ai/server/@api7/apisix-mcp)
15 lines (14 loc) • 618 B
JavaScript
import makeAdminAPIRequest from "../utils/adminAPI.js";
import { CreateOrUpdateProtoSchema } from "../schemas/protos.js";
const setupProtoTools = (server) => {
server.tool("create_or_update_proto", "Create a proto, if the proto already exists, it will be updated", CreateOrUpdateProtoSchema.shape, async (args) => {
const protoId = args.id;
if (protoId) {
return await makeAdminAPIRequest(`/protos/${protoId}`, "PUT", args.proto);
}
else {
return await makeAdminAPIRequest("/protos", "POST", args.proto);
}
});
};
export default setupProtoTools;