Skip to main content
Glama

as__CreateLifyCycleHook

Adds a lifecycle hook to a scaling group to pause instances during launch or termination, letting you run custom setup or cleanup actions before timeout or manual callback.

Instructions

[AS] 创建生命周期挂钩,可为伸缩组添加一个或多个生命周期挂钩,最多添加5个。添加生命周期挂钩后,当伸缩组进行伸缩活动时,实例将被生命周期挂钩挂起并置于等待状态(正在加入伸缩组或正在移出伸缩组),实例将保持此状态直至超时时间结束或者用户手动回调。用户能够在实例保持等待状态的时间段内执行自定义操作,例如,用户可以在新启动的实例上安装或配置软件,也可以在实例终止前从实例中下载日志文件。

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "lifecycle_hook_name": "<lifecycle_hook_name>",
      "lifecycle_hook_type": "<lifecycle_hook_type>",
      "notification_topic_urn": "<notification_topic_urn>",
      "project_id": "<project_id>",
      "scaling_group_id": "<scaling_group_id>"
    },
    "name": "as__CreateLifyCycleHook"
  }
}

Input Schema

NameRequiredDescriptionDefault
project_idYes项目ID
default_resultNo生命周期挂钩默认回调操作。默认情况下,到达超时时间后执行的操作。ABANDON;CONTINUE;如果实例正在启动,则 CONTINUE 表示用户自定义操作已成功,可将实例投入使用。否则,ABANDON 表示用户自定义操作未成功,终止实例,伸缩活动置为失败,重新创建新实例。如果实例正在终止,则 ABANDON 和 CONTINUE 都允许终止实例。不过,ABANDON 将停止其他生命周期挂钩,而 CONTINUE 将允许完成其他生命周期挂钩。该字段缺省时默认为 ABANDON。
default_timeoutNo生命周期挂钩超时时间,取值范围60-86400,默认为3600,单位是秒。默认情况下,实例保持等待状态的时间。您可以延长超时时间,也可以在超时时间结束前进行 CONTINUE 或 ABANDON 操作。
scaling_group_idYes伸缩组标识。
lifecycle_hook_nameYes生命周期挂钩名称(1-32个字符),只能包含字母、数字、下划线或中划线。
lifecycle_hook_typeYes生命周期挂钩类型。INSTANCE_TERMINATING。INSTANCE_LAUNCHING。INSTANCE_TERMINATING 类型的挂钩负责在实例终止时将实例挂起,INSTANCE_LAUNCHING 类型的挂钩则是在实例启动时将实例挂起。
notification_metadataNo自定义通知消息,长度不超过256位,不能包含字符< > & ' ( )当配置了通知目标时,可向其发送用户自定义的通知内容。
notification_topic_urnYesSMN 服务中 Topic 的唯一的资源标识。为生命周期挂钩定义一个通知目标,当实例被生命周期挂钩挂起时向该通知目标发送消息。该消息包含实例的基本信息、用户自定义通知消息,以及可用于控制生命周期操作的令牌信息。

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.4.0

TDQS

A3.7/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations supplied, the description carries the full behavioral burden and does well: it explains that instances are suspended in a waiting state when joining or leaving the group, that the wait ends at timeout or manual callback, and that users can run custom actions in that window. Gaps remain on permissions/authorization requirements and on what identifies the created hook in the response, but the side-effect profile of this mutation is clearly conveyed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose and quota are front-loaded in the first clause, and the remaining sentences all explain the post-creation suspension lifecycle rather than padding. It is long but every sentence supplies context an agent would otherwise have to guess.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For an 8-parameter creation tool with no annotations and no output schema, the description covers purpose and runtime effects but omits authentication requirements, the shape of the created resource, and how the hook is later identified or bound to instances. Since the input schema is fully documented, these omissions are tolerable, but the definition is not complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with enums and ranges (60–86400s timeout, hook type, default result) already documented, so the schema does the heavy lifting. The description adds only the aggregate 'max 5 hooks' constraint and no per-parameter semantics beyond what the schema states, which is the baseline 3 case.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb+resource (创建/生命周期挂钩) and adds the scope constraint of at most 5 hooks per scaling group. It does not name a sibling such as UpdateLifeCycleHook or ShowLifeCycleHook to disambiguate, but the create verb plus the resource is enough for an agent to distinguish this from read/update/delete siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is only implied by the create verb; there is no explicit 'use this when...' statement, no prerequisites such as required permissions or a pre-existing notification topic, and no exclusion telling the agent to use UpdateLifeCycleHook instead when a hook already exists. The quota note (max 5 per scaling group) is the only operational guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools