renameValue
Change the name of a value in Whistle MCP Server by specifying the existing name and the new name, enabling efficient updates to configurations and data.
Instructions
重命名值
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | 值现有名称 | |
| newName | Yes | 值的新名称 |
Implementation Reference
- src/index.ts:234-245 (registration)Registration of the MCP tool 'renameValue', including name, description, input schema via Zod, and handler that delegates to WhistleClient.renameValueserver.addTool({ name: "renameValue", description: "重命名值", parameters: z.object({ name: z.string().describe("值现有名称"), newName: z.string().describe("值的新名称"), }), execute: async (args) => { const result = await whistleClient.renameValue(args.name, args.newName); return formatResponse(result); }, });
- src/index.ts:241-244 (handler)The execute handler function for the 'renameValue' tool, which calls the WhistleClient method and formats the responseexecute: async (args) => { const result = await whistleClient.renameValue(args.name, args.newName); return formatResponse(result); },
- src/index.ts:237-240 (schema)Zod input schema for 'renameValue' tool parameters: existing name and new nameparameters: z.object({ name: z.string().describe("值现有名称"), newName: z.string().describe("值的新名称"), }),
- src/WhistleClient.ts:425-442 (helper)WhistleClient helper method that performs the actual HTTP POST to Whistle API endpoint /cgi-bin/values/rename to rename a valueasync renameValue(name: string, newName: string): Promise<any> { const formData = new URLSearchParams(); formData.append("clientId", `${Date.now()}-0`); formData.append("name", name); formData.append("newName", newName); const response = await axios.post( `${this.baseUrl}/cgi-bin/values/rename`, formData, { headers: { "Content-Type": "application/x-www-form-urlencoded", }, } ); return response.data; }