@mseep/apisix-mcp
Version:
[](https://smithery.ai/server/@api7/apisix-mcp)
18 lines (17 loc) • 780 B
JavaScript
import makeAdminAPIRequest from "../utils/adminAPI.js";
import { CreateRouteSchema, UpdateRouteSchema } from "../schemas/route.js";
const setupRouteTools = (server) => {
server.tool("create_route", "Create a route", CreateRouteSchema.shape, async (args) => {
const routeId = args.id;
if (routeId) {
return await makeAdminAPIRequest(`/routes/${routeId}`, "PUT", args.route);
}
else {
return await makeAdminAPIRequest(`/routes`, "POST", args.route);
}
});
server.tool("update_route", "Update specific attributes of an existing route", UpdateRouteSchema.shape, async (args) => {
return await makeAdminAPIRequest(`/routes/${args.id}`, "PATCH", args.route);
});
};
export default setupRouteTools;