update_record
Modify DNS records including A/AAAA, CNAME, MX, TXT, and others by updating values, priorities, TTL, and authentication settings for secure domain management.
Instructions
This operation allows you to update multiple types of DNS records, including but not limited to A/AAAA, CNAME, NS, MX, TXT, CAA, SRV, and URI. You can modify the record content by providing the necessary fields such as Value, Priority, and Flag. For origins added in CNAME records such as OSS and S3, the API enables you to configure authentication details to ensure secure access. Usage notes: The record value (Value) must match the record type. For example, the CNAME record should correspond to the target domain name. You must specify a priority (Priority) for some record types, such as MX and SRV. You must specify specific fields such as Flag and Tag for CAA records. When you update security records such as CERT and SSHFP, you must accurately set fields such as Type and Algorithm.If your origin type is OSS or S3, configure the authentication details in AuthConf based on the permissions.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| recordId | Yes | The record ID, which can be obtained by calling ListRecords . | |
| ttl | No | The TTL of the record. Unit: seconds. The range is 30 to 86,400, or 1. If the value is 1, the TTL of the record is determined by the system. | |
| proxied | No | Specifies whether to proxy the record. Only CNAME and A/AAAA records can be proxied. Valid values: true,false | |
| type | No | The type of the DNS record. For example, A/AAAA, TXT, MX, NS, SRV, CAA, CERT, SMIMEA, SSHFP, TLSA, URI or CNAME. | |
| data | Yes | The DNS record information. The format of this field varies based on the record type. For more information, see https://www.alibabacloud.com/help/doc-detail/2708761.html | |
| sourceType | No | The type of the origin for the CNAME record. This parameter is required when you add a CNAME record. Valid values: OSS : OSS origin. S3 : S3 origin. LB: Load Balancer origin. OP: origin in an origin pool. Domain: common domain name. If you leave the parameter empty or set its value as null, the default is Domain, which is common domain name. | |
| bizName | No | The business scenario of the record for acceleration. Leave the parameter empty if your record is not proxied. Valid values: video_image: video and image. api: API. web: web page. | |
| comment | No | The comments of the record. | |
| authConf | No | The origin authentication information of the CNAME record. | |
| hostPolicy | No | The origin host policy. This policy takes effect when the record type is CNAME. You can set the policy in two modes: follow_hostname: match the requested domain name. follow_origin_domain: match the origin's domain name. |
Implementation Reference
- src/tools/site/record.ts:730-739 (handler)The handler function that implements the core logic of the 'update_record' tool. It parses the input arguments as UpdateRecordRequest, calls the API service to update the record, and returns the response as JSON.export const update_record = async (request: CallToolRequest) => { const req = request.params.arguments as UpdateRecordRequest; const res = await api.updateRecord(req); return { content: [{ type: 'text', text: JSON.stringify(res) }], success: true, }; };
- src/tools/site/record.ts:324-518 (schema)The tool definition including the name 'update_record', detailed description, and comprehensive inputSchema for validation of parameters like recordId, ttl, proxied, type, data, etc.export const UPDATE_RECORD_TOOL: Tool = { name: 'update_record', description: 'This operation allows you to update multiple types of DNS records, including but not limited to A/AAAA, CNAME, NS, MX, TXT, CAA, SRV, and URI. You can modify the record content by providing the necessary fields such as Value, Priority, and Flag. For origins added in CNAME records such as OSS and S3, the API enables you to configure authentication details to ensure secure access. Usage notes: The record value (Value) must match the record type. For example, the CNAME record should correspond to the target domain name. You must specify a priority (Priority) for some record types, such as MX and SRV. You must specify specific fields such as Flag and Tag for CAA records. When you update security records such as CERT and SSHFP, you must accurately set fields such as Type and Algorithm.If your origin type is OSS or S3, configure the authentication details in AuthConf based on the permissions.', inputSchema: { type: 'object', properties: { recordId: { type: 'number', description: 'The record ID, which can be obtained by calling ListRecords .', examples: [1234567890123], }, ttl: { type: 'number', description: 'The TTL of the record. Unit: seconds. The range is 30 to 86,400, or 1. If the value is 1, the TTL of the record is determined by the system.', examples: [30], }, proxied: { type: 'boolean', description: 'Specifies whether to proxy the record. Only CNAME and A/AAAA records can be proxied. Valid values: true,false', enum: [true, false], examples: [true], }, type: { type: 'string', description: 'The type of the DNS record. For example, A/AAAA, TXT, MX, NS, SRV, CAA, CERT, SMIMEA, SSHFP, TLSA, URI or CNAME.', enum: ['A/AAA', 'TXT', 'MX', 'NS', 'SRV', 'CAA', 'CERT', 'SMIMEA', 'SSHFP', 'TLSA', 'URI', 'CNAME'], examples: ['A/AAA'], }, data: { type: 'object', description: 'The DNS record information. The format of this field varies based on the record type. For more information, see https://www.alibabacloud.com/help/doc-detail/2708761.html', properties: { value: { type: 'string', description: 'The record value or part of the record content. This parameter is required when you add A/AAAA, CNAME, NS, MX, TXT, CAA, SRV, and URI records. It has different meanings based on different types of records:A/AAAA: the IP address(es). Separate multiple IPs with commas (,). You must have at least one IPv4 address. CNAME: the target domain name. NS: the name servers for the domain name. MX: a valid domain name of the target mail server. TXT: a valid text string. CAA: a valid domain name of the certificate authority. SRV: a valid domain name of the target host. URI: a valid URI string.', example: ['example.com'], }, priority: { type: 'number', description: 'The priority of the record, specified within the range of 0 to 65,535. A smaller value indicates a higher priority. This parameter is required when you add MX, SRV, and URI records.', example: [10], }, flag: { type: 'number', description: 'The flag bit of the record. The Flag for a CAA record indicates its priority and how it is processed, specified within the range of 0 to 255. This parameter is required when you add a CAA record.', example: [128], }, tag: { type: 'string', description: 'The label of the record. The Tag of a CAA record indicate its specific type and usage. This parameter is required when you add a CAA record.', example: ['issue'], }, weight: { type: 'number', description: 'The weight of the record, specified within the range of 0 to 65,535. This parameter is required when you add SRV or URI records.', example: [0], }, port: { type: 'number', description: 'The port of the record, specified within the range of 0 to 65,535. This parameter is required when you add an SRV record.', example: [0], }, type: { type: 'number', description: 'The certificate type of the record (in CERT records), or the public key type (in SSHFP records). This parameter is required when you add CERT or SSHFP records.', example: [0], }, keyTag: { type: 'number', description: 'The public key identification for the record, specified within the range of 0 to 65,535. This parameter is required when you add a CAA record.', example: [0], }, algorithm: { type: 'number', description: 'The encryption algorithm used for the record, specified within the range from 0 to 255. This parameter is required when you add CERT or SSHFP records.', example: [0], }, certificate: { type: 'string', description: 'The public key of the certificate. This parameter is required when you add CERT, SMIMEA, or TLSA records.', example: ['dGVzdGFkYWxrcw=='], }, usage: { type: 'number', description: 'The usage identifier of the record, specified within the range of 0 to 255. This parameter is required when you add SMIMEA or TLSA records.', example: [0], }, selector: { type: 'number', description: 'The type of certificate or public key, specified within the range of 0 to 255. This parameter is required when you add SMIMEA or TLSA records.', example: [0], }, matchingType: { type: 'number', description: 'The algorithm policy used to match or validate the certificate, specified within the range 0 to 255. This parameter is required when you add SMIMEA or TLSA records.', example: [0], }, fingerprint: { type: 'string', description: 'The public key fingerprint of the record. This parameter is required when you add a SSHFP record.', example: ['abcdef1234567890'], }, }, }, sourceType: { type: 'string', description: 'The type of the origin for the CNAME record. This parameter is required when you add a CNAME record. Valid values: OSS : OSS origin. S3 : S3 origin. LB: Load Balancer origin. OP: origin in an origin pool. Domain: common domain name. If you leave the parameter empty or set its value as null, the default is Domain, which is common domain name.', enum: ['OSS', 'S3', 'LB', 'OP', 'Domain', 'IP'], examples: ['OSS'], }, bizName: { type: 'string', description: 'The business scenario of the record for acceleration. Leave the parameter empty if your record is not proxied. Valid values: video_image: video and image. api: API. web: web page.', enum: ['api', 'web', 'video_image'], examples: ['web'], }, comment: { type: 'string', description: 'The comments of the record.', example: ['This is a remark.'], }, authConf: { type: 'object', description: 'The origin authentication information of the CNAME record.', properties: { authType: { type: 'string', description: 'The authentication type of the origin server. Different origins support different authentication types. The type of origin refers to the SourceType parameter in this operation. If the type of origin is OSS or S3, you must specify the authentication type of the origin. Valid values: public: public read. Select this value when the origin type is OSS or S3 and the origin access is public read. private: private read. Select this value when the origin type is S3 and the origin access is private read.private_same_account: private read under the same account. Select this value when the origin type is OSS, the origins belong to the same Alibaba Cloud account, and the origins have private read access.', enum: ['private', 'public', 'private_same_account', 'private_cross_account'], examples: ['private'], }, secretKey: { type: 'string', description: 'The secret access key of the account to which the origin server belongs. This parameter is required when the SourceType is OSS, and AuthType is private_same_account, or when the SourceType is S3 and AuthType is private.', example: ['u0Nkg5gBK*******QF5wvKMM504JUHt'], }, accessKey: { type: 'string', description: 'The access key of the account to which the origin server belongs. This parameter is required when the SourceType is OSS, and AuthType is private_same_account, or when the SourceType is S3 and AuthType is private.', example: ['VIxuvJSA2S03f******kp208dy5w7'], }, region: { type: 'string', description: 'The version of the signature algorithm. This parameter is required when the origin type is S3 and AuthType is private. The following two types are supported: v2 v4. If you leave this parameter empty, the default value v4 is used.', enum: ['v2', 'v4'], examples: ['v2'], }, version: { type: 'string', description: 'The region of the origin. If the origin type is S3, you must specify this value. You can get the region information from the official website of S3.', example: ['us-east-1'], }, }, }, hostPolicy: { type: 'string', description: 'The origin host policy. This policy takes effect when the record type is CNAME. You can set the policy in two modes: follow_hostname: match the requested domain name. follow_origin_domain: match the origin\'s domain name.', enum: ['follow_hostname', 'follow_origin_domain'], example: ['follow_hostname'], }, }, required: ['recordId', 'data'], annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, }, }, };
- src/tools/list-esa-function.ts:125-139 (registration)Registration of the UPDATE_RECORD_TOOL in the ESA_OPENAPI_SITE_LIST array, which collects site-related tools for the MCP server.export const ESA_OPENAPI_SITE_LIST = [ LIST_SITES_TOOL, CREATE_SITE_TOOL, UPDATE_SITE_PAUSE_TOOL, GET_SITE_PAUSE_TOOL, UPDATE_RECORD_TOOL, CREATE_SITE_MX_RECORD_TOOL, CREATE_SITE_NS_RECORD_TOOL, CREATE_SITE_TXT_RECORD_TOOL, CREATE_SITE_CNAME_RECORD_TOOL, CREATE_SITE_A_OR_AAAA_RECORD_TOOL, DELETE_RECORD_TOOL, LIST_RECORDS_TOOL, GET_RECORD_TOOL, ];
- src/tools/list-esa-function.ts:164-208 (registration)Mapping of the 'update_record' handler function in the esaHandlers object, used to dispatch tool calls to the correct implementation.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, };
- src/utils/service.ts:422-431 (helper)The API wrapper method in the service client that performs the actual UpdateRecordRequest call to the Alibaba Cloud ESA API.updateRecord(params: UpdateRecordRequest) { const request = new UpdateRecordRequest(params); return this.callApi( this.client.updateRecord.bind(this.client) as ApiMethod< UpdateRecordRequest, UpdateRecordResponse >, request, ); }