create-group
Automates browser group creation by defining a group name and optional remark, facilitating organized profile management within AdsPower LocalAPI MCP Server.
Instructions
Create a browser group
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| groupName | Yes | The name of the group to create | |
| remark | No | The remark of the group |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"groupName": {
"description": "The name of the group to create",
"type": "string"
},
"remark": {
"description": "The remark of the group",
"type": "string"
}
},
"required": [
"groupName"
],
"type": "object"
}
Implementation Reference
- src/handlers/group.ts:10-25 (handler)The core handler function that implements the create-group tool by making an API POST request to create a new browser group.async createGroup({ groupName, remark }: CreateGroupParams) { const requestBody: Record<string, string> = { group_name: groupName }; if (remark !== undefined) { requestBody.remark = remark; } const response = await axios.post(`${LOCAL_API_BASE}${API_ENDPOINTS.CREATE_GROUP}`, requestBody); if (response.data.code === 0) { return `Group created successfully with name: ${groupName}${remark ? `, remark: ${remark}` : ''}`; } throw new Error(`Failed to create group: ${response.data.msg}`); },
- src/types/schemas.ts:139-142 (schema)Zod schema defining the input parameters for the create-group tool (groupName required, remark optional).createGroupSchema: z.object({ groupName: z.string().describe('The name of the group to create'), remark: z.string().optional().describe('The remark of the group') }).strict(),
- src/types/group.ts:1-3 (schema)TypeScript interface matching the input schema for type safety in the handler.export interface CreateGroupParams { groupName: string; remark?: string;
- src/utils/toolRegister.ts:36-37 (registration)Registers the create-group tool with the MCP server, linking schema and handler.server.tool('create-group', 'Create a browser group', schemas.createGroupSchema.shape, wrapHandler(groupHandlers.createGroup));
- src/constants/api.ts:13-13 (helper)API endpoint constant used by the handler for the create group request.CREATE_GROUP: '/api/v1/group/create',