createValue
Generate and define new values within the Whistle MCP Server to streamline proxy management, enabling efficient rule and group configuration.
Instructions
创建新的值
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | 值名称 |
Implementation Reference
- src/index.ts:209-219 (registration)Registration of the MCP tool 'createValue' using server.addTool.server.addTool({ name: "createValue", description: "创建新的值", parameters: z.object({ name: z.string().describe("值名称"), }), execute: async (args) => { const result = await whistleClient.createValue(args.name); return formatResponse(result); }, });
- src/index.ts:212-214 (schema)Input schema for 'createValue' tool: requires a 'name' string parameter.parameters: z.object({ name: z.string().describe("值名称"), }),
- src/index.ts:215-218 (handler)Handler function for 'createValue' tool that delegates to WhistleClient.createValue and formats the response.execute: async (args) => { const result = await whistleClient.createValue(args.name); return formatResponse(result); },
- src/WhistleClient.ts:356-371 (helper)Core implementation of createValue in WhistleClient: sends POST request to Whistle's /cgi-bin/values/add endpoint to create a new value.async createValue(name: string): Promise<any> { const formData = new URLSearchParams(); formData.append("clientId", `${Date.now()}-1`); formData.append("name", name); const response = await axios.post( `${this.baseUrl}/cgi-bin/values/add`, formData, { headers: { "Content-Type": "application/x-www-form-urlencoded", }, } ); return response.data; }