list-functions
Retrieve a concise list of function names and partial details from Alibaba Cloud Function Compute, filtered by region, prefix, tags, or runtime. Ideal for quick function overviews without full metadata.
Instructions
获取函数计算的函数列表,只返回函数名称与部分函数信息,不返回所有函数信息。如果需要获取所有函数信息,请使用get-function工具
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | 函数列表的返回数量上限,默认50,最大100 | |
| nextToken | No | 函数列表的下一页token,用于分页查询函数列表。第一页不需要提供 | |
| prefix | No | 函数名称前缀,用于过滤函数列表 | |
| region | No | 部署的区域,当前可选的区域是cn-hangzhou, cn-shanghai, cn-beijing, cn-shenzhen, cn-hongkong, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-5, ap-northeast-1, eu-central-1, eu-west-1, us-west-1, us-east-1, ap-south-1, me-east-1, cn-chengdu, cn-wulanchabu, cn-guangzhou,默认是cn-hangzhou | cn-hangzhou |
| runtime | No | 函数运行时,用于过滤函数列表,只返回指定运行时的函数 | |
| tags | No | 函数标签,用于过滤函数列表,只返回包含所有标签的函数 |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"limit": {
"default": 50,
"description": "函数列表的返回数量上限,默认50,最大100",
"maximum": 100,
"minimum": 1,
"type": "number"
},
"nextToken": {
"description": "函数列表的下一页token,用于分页查询函数列表。第一页不需要提供",
"type": "string"
},
"prefix": {
"description": "函数名称前缀,用于过滤函数列表",
"type": "string"
},
"region": {
"default": "cn-hangzhou",
"description": "部署的区域,当前可选的区域是cn-hangzhou, cn-shanghai, cn-beijing, cn-shenzhen, cn-hongkong, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-5, ap-northeast-1, eu-central-1, eu-west-1, us-west-1, us-east-1, ap-south-1, me-east-1, cn-chengdu, cn-wulanchabu, cn-guangzhou,默认是cn-hangzhou",
"enum": [
"cn-hangzhou",
"cn-shanghai",
"cn-beijing",
"cn-shenzhen",
"cn-hongkong",
"ap-southeast-1",
"ap-southeast-2",
"ap-southeast-3",
"ap-southeast-5",
"ap-northeast-1",
"eu-central-1",
"eu-west-1",
"us-west-1",
"us-east-1",
"ap-south-1",
"me-east-1",
"cn-chengdu",
"cn-wulanchabu",
"cn-guangzhou"
],
"type": "string"
},
"runtime": {
"description": "函数运行时,用于过滤函数列表,只返回指定运行时的函数",
"type": "string"
},
"tags": {
"description": "函数标签,用于过滤函数列表,只返回包含所有标签的函数",
"items": {
"additionalProperties": false,
"properties": {
"key": {
"description": "标签名称",
"type": "string"
},
"value": {
"description": "标签值",
"type": "string"
}
},
"required": [
"key",
"value"
],
"type": "object"
},
"type": "array"
}
},
"type": "object"
}
Implementation Reference
- src/index.ts:586-606 (registration)Registration of the 'list-functions' MCP tool using server.tool(). Includes tool name, description, input schema definition, and inline handler function.server.tool( "list-functions", "获取函数计算的函数列表,只返回函数名称与部分函数信息,不返回所有函数信息。如果需要获取所有函数信息,请使用get-function工具", { region: regionSchema, prefix: listFunctionsPrefixSchema.optional(), nextToken: listFunctionsNextTokenSchema.optional(), limit: z.number().describe("函数列表的返回数量上限,默认50,最大100").min(1).max(100).default(50), tags: functionTagSchema.describe("函数标签,用于过滤函数列表,只返回包含所有标签的函数").optional(), runtime: z.string().describe("函数运行时,用于过滤函数列表,只返回指定运行时的函数").optional(), }, async (args) => { const { region } = args; const fcClient = createFcClient(region); const listFunctionsRequest = new ListFunctionsRequest({ ...args }); const functions = await fcClient.listFunctions(listFunctionsRequest); return { content: [{ type: "text", text: `获取函数列表: ${JSON.stringify(functions)}` }] }; } )
- src/index.ts:597-605 (handler)The handler function that implements the core logic of the 'list-functions' tool. It creates an Alibaba Cloud FC client for the specified region, constructs a ListFunctionsRequest with the input arguments, calls the listFunctions API, and returns the result as a formatted text content.async (args) => { const { region } = args; const fcClient = createFcClient(region); const listFunctionsRequest = new ListFunctionsRequest({ ...args }); const functions = await fcClient.listFunctions(listFunctionsRequest); return { content: [{ type: "text", text: `获取函数列表: ${JSON.stringify(functions)}` }] }; }
- src/index.ts:589-596 (schema)Zod-based input schema for the 'list-functions' tool, defining parameters such as region (required), prefix, nextToken, limit (default 50), tags, and runtime (all optional). Relies on imported schema validators.{ region: regionSchema, prefix: listFunctionsPrefixSchema.optional(), nextToken: listFunctionsNextTokenSchema.optional(), limit: z.number().describe("函数列表的返回数量上限,默认50,最大100").min(1).max(100).default(50), tags: functionTagSchema.describe("函数标签,用于过滤函数列表,只返回包含所有标签的函数").optional(), runtime: z.string().describe("函数运行时,用于过滤函数列表,只返回指定运行时的函数").optional(), },
- src/schema.ts:172-175 (schema)Zod schema definitions for 'prefix' and 'nextToken' parameters used in the 'list-functions' tool input schema.export const listFunctionsPrefixSchema = z.string().describe("函数名称前缀,用于过滤函数列表"); export const listFunctionsNextTokenSchema = z.string().describe("函数列表的下一页token,用于分页查询函数列表。第一页不需要提供");
- src/utils/alibaba_cloud_sdk.ts:11-17 (helper)Helper function createFcClient used by the 'list-functions' handler to instantiate the Alibaba Cloud Function Compute client configured for the specified region.export function createFcClient(regionId: string) { const config = new $OpenApi.Config({ credential: getCredentialClient(), endpoint: `fcv3.${regionId}.aliyuncs.com`, }); return new FCClient(config); }