Skip to main content
Glama

functiongraph__CreateFunction

Creates a Huawei Cloud serverless function with specified runtime, handler, memory, timeout, package, and project so you can deploy code with required execution settings.

Instructions

[FUNCTIONGRAPH] 创建指定的函数。

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": {
      "func_name": "<func_name>",
      "handler": "<handler>",
      "memory_size": "<memory_size>",
      "package": "<package>",
      "project_id": "<project_id>",
      "runtime": "<runtime>",
      "timeout": "<timeout>"
    },
    "name": "functiongraph__CreateFunction"
  }
}

Input Schema

NameRequiredDescriptionDefault
typeNo函数版本;部分局点只支持v1函数,缺省值则为v1v2
xroleNo函数配置委托。需要IAM支持,并在IAM界面创建委托,当函数需要访问其他服务时,必须提供该字段。配置后用户可以通过函数执行入口方法中的context参数获取具有委托中权限的token、ak、sk,用于访问其他云服务。如果用户函数不访问任何云服务,则不用提供委托名称。
handlerYes函数执行入口
packageYes函数所属的分组Package,用于用户针对函数的自定义分组。
runtimeYesFunctionGraph函数的执行环境
timeoutYes函数执行超时时间,超时函数将被强行停止,范围3~259200秒。
code_urlNo当CodeType为obs时,该值为函数代码包在OBS上的地址,CodeType为其他值时,该字段为空。
func_vpcNo函数vpc配置。需同时为函数配置具有vpc权限的委托。
gpu_typeNo显卡类型。
app_xroleNo函数执行委托。可为函数执行单独配置执行委托,这将减小不必要的性能损耗;不单独配置执行委托时,函数执行和函数配置将使用同一委托。
code_typeNo函数代码类型,取值有5种。
func_codeNoFuncCode结构返回体。
func_nameYes函数名称。
user_dataNo用户自定义的name/value信息。 在函数中使用的参数。 举例:如函数要访问某个主机,可以设置自定义参数:Host={host_ip},最多定义20个,总长度不超过4KB。
gpu_memoryNo函数消耗的显存,只支持自定义运行时与自定义镜像函数配置GPU。
log_configNo函数绑定日志配置。
project_idYes租户项目 ID,获取方式请参见[获取项目ID](functiongraph_06_0260.xml)。
descriptionNo函数描述。
memory_sizeYes函数消耗的内存。
custom_imageNo用户容器镜像。
mount_configNo函数挂载配置。
code_filenameNo函数的文件名,当CodeType为jar/zip时必须提供该字段,CodeType为其他值时不需要提供。
enable_lts_logNo是否开启日志,缺省值为false。创建函数时,若此开关为true,且未传入log_config,则由FunctionGraph自动创建日志组日志流。
lts_custom_tagNo自定义日志标签。函数执行时,可以按照自定义标签配置上报标签到云日志服务(LTS),用户可以通过标签对日志进行过滤筛选。
pre_stop_handlerNo函数预停止函数的入口,规则:xx.xx,必须包含“. ”。
pre_stop_timeoutNo初始化超时时间,超时函数将被强行停止,范围1~90秒。
network_controllerNo函数网络配置。
depend_version_listNo依赖版本id列表
encrypted_user_dataNo用户自定义的name/value信息,用于需要加密的配置。举例:如配置加密密码,可以设置自定义参数:password={1234},最多定义20个,总长度不超过4KB。
initializer_handlerNo函数初始化入口,规则:xx.xx,必须包含“. ”。当配置初始化函数时,此参数必填。
initializer_timeoutNo初始化超时时间,超时函数将被强行停止,范围1~300秒。当配置初始化函数时,此参数必填。
is_stateful_functionNo是否支持有状态,如果需要支持,需要固定传参为true,v2版本支持
enable_dynamic_memoryNo是否启动动态内存配置
enterprise_project_idNo企业项目ID,在企业用户创建函数时必填。
code_encrypt_kms_key_idNo用于用户代码加密的kms主秘钥ID。
user_data_encrypt_kms_key_idNo用于环境变量加密的kms主秘钥ID。

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.4.0

TDQS

C2.1/5.0
Behavior1/5

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

No annotations are supplied, so the description carries the full burden of behavioral disclosure, yet it says nothing about permissions required, what happens on name conflicts, whether the function is immediately invokable, or what the response contains. For a 36-parameter mutating tool, this is a complete absence of behavioral context.

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

Conciseness2/5

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

The single sentence is free of padding, but its brevity is under-specification rather than conciseness. A create operation with 7 required parameters and deep nested objects needs more than seven words to be usable.

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

Completeness1/5

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

Given 36 parameters, 7 required fields, nested objects, no annotations, and no output schema, the description is far too thin. An agent gets no indication of which optional fields matter, what authorization is needed, or what a successful creation returns.

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%, so the input schema already documents all 36 parameters, including nested VPC, mount, and log configurations. The description adds no meaning beyond the schema, so the baseline of 3 applies.

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

Purpose3/5

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

The description states a verb and resource ("创建...函数" / create function), but the qualifier "指定的" (specified) adds nothing and the text gives no scope detail. It does not distinguish this tool from siblings such as CreateFunctionApp, CreateFunctionVersion, or CreateFunctionTrigger, so an agent must open the schema to know what kind of function resource is being created.

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

Usage Guidelines2/5

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

There is no when-to-use guidance, no mention of prerequisites such as IAM delegation or VPC permissions, and no reference to alternative creation tools. The description provides only the bare action, leaving the agent to infer everything about context.

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