route_create
Create a new route for Edge Routine (ER) with options for mode, rule, and sequence. Set bypass and enable status to manage routing configurations directly through the ESA MCP Server.
Instructions
Create a new route associated with an Edge Routine (ER).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bypass | Yes | The bypass of the route, default is off | |
| mode | Yes | The mode of the route, default is simple | |
| route | No | The route of the route, if mode is simple, this field is required. For example: test.example.com/* | |
| routeEnable | Yes | The enable of the route, default is on | |
| routeName | Yes | The name of the route, use to identify the route. For example: test-route | |
| routineName | Yes | The name of the routine | |
| rule | Yes | The rule of the route, if mode is custom, this field is required | |
| sequence | No | The sequence of the route, if not passed, default is the current number of routes | |
| siteId | Yes | The ID of the site |
Implementation Reference
- src/tools/er/route.ts:233-254 (handler)The handler function for the 'route_create' tool. It processes the input arguments, handles 'simple' and 'custom' modes by calling the appropriate API method, and returns the result.export const route_create = async (request: CallToolRequest) => { const { mode, route } = request.params.arguments as CreateRoutineRouteRequest; if (mode === 'simple') { const res = await api.createRoutineRoute({ ...request.params.arguments, rule: transferRouteToRuleString(route), } as unknown as CreateRoutineRouteRequest); return { content: [{ type: 'text', text: JSON.stringify(res) }], success: true, }; } else { const res = await api.createRoutineRoute( request.params.arguments as CreateRoutineRouteRequest, ); return { content: [{ type: 'text', text: JSON.stringify(res) }], success: true, }; } };
- src/tools/er/route.ts:13-73 (schema)The schema definition for the 'route_create' tool, including input validation schema with required fields and properties.export const ROUTE_CREATE_TOOL: Tool = { name: 'route_create', description: 'Create a new route associated with an Edge Routine (ER).', inputSchema: { type: 'object', properties: { siteId: { type: 'number', description: 'The ID of the site', }, mode: { type: 'enum', enum: ['simple', 'custom'], description: 'The mode of the route, default is simple', }, route: { type: 'string', description: 'The route of the route, if mode is simple, this field is required. For example: test.example.com/*', }, rule: { type: 'string', description: 'The rule of the route, if mode is custom, this field is required', }, routineName: { type: 'string', description: 'The name of the routine', }, routeName: { type: 'string', description: 'The name of the route, use to identify the route. For example: test-route', }, bypass: { type: 'enum', enum: ['on', 'off'], description: 'The bypass of the route, default is off', }, routeEnable: { type: 'enum', enum: ['on', 'off'], description: 'The enable of the route, default is on', }, sequence: { type: 'number', description: 'The sequence of the route, if not passed, default is the current number of routes', }, }, required: [ 'siteId', 'mode', 'rule', 'routineName', 'routeName', 'bypass', 'routeEnable', ], }, };
- src/tools/list-esa-function.ts:103-123 (registration)Registration of the ROUTE_CREATE_TOOL schema in the ESA_OPENAPI_ER_LIST array, which aggregates ER-related tools.export const ESA_OPENAPI_ER_LIST = [ HTML_DEPLOY_TOOL, ROUTINE_CREATE_TOOL, ROUTINE_DELETE_TOOL, ROUTINE_LIST_TOOL, ROUTINE_GET_TOOL, ROUTINE_CODE_COMMIT_TOOL, ROUTINE_CODE_DEPLOY_TOOL, ROUTINE_ROUTE_LIST_TOOL, DEPLOYMENT_DELETE_TOOL, SITE_ACTIVE_LIST_TOOL, SITE_ROUTE_LIST_TOOL, ROUTE_CREATE_TOOL, ROUTE_DELETE_TOOL, ROUTE_UPDATE_TOOL, ROUTE_GET_TOOL, SITE_MATCH_TOOL, ER_RECORD_CREATE_TOOL, ER_RECORD_DELETE_TOOL, ER_RECORD_LIST_TOOL, ];
- src/tools/list-esa-function.ts:164-208 (registration)Registration of the route_create handler function in the esaHandlers object, mapping tool names to their execution functions.export const esaHandlers: ToolHandlers = { site_active_list, site_match, site_route_list, site_record_list, routine_create, routine_code_commit, routine_delete, routine_list, routine_get, routine_code_deploy, routine_route_list, deployment_delete, route_create, route_delete, route_update, route_get, er_record_create, er_record_delete, er_record_list, html_deploy, create_site, update_site_pause, get_site_pause, create_site_mx_record, create_site_ns_record, create_site_txt_record, create_site_cname_record, create_site_a_or_aaaa_record, update_record, list_records, get_record, delete_record, update_ipv6, get_ipv6, update_managed_transform, get_managed_transform, set_certificate, apply_certificate, get_certificate, delete_certificate, list_certificates, get_certificate_quota, list_sites, };