create-api-group
Create and configure a new API group in a Xano workspace, including enabling Swagger documentation, adding tags, and specifying a branch for organization.
Instructions
Create a new API group in the Xano workspace
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| branch | No | Branch name for the API group | |
| description | Yes | Description of the API group | |
| docs | No | Documentation for the API group | |
| name | Yes | Name of the API group | |
| swagger | Yes | Whether to enable Swagger documentation | |
| tag | No | Tags to associate with the API group |
Implementation Reference
- src/index.ts:729-782 (handler)The handler function that implements the create-api-group tool logic. It constructs a request body from the input parameters and makes a POST request to the Xano API endpoint `/workspace/{XANO_WORKSPACE}/apigroup` to create the API group, then formats a success response.async ({ name, description, swagger, docs, tag, branch }) => { console.error(`[Tool] Executing create-api-group for name: ${name}`); try { const requestBody = { name, description, swagger, ...(docs !== undefined && { docs }), ...(tag !== undefined && { tag }), ...(branch !== undefined && { branch }) }; const response = await makeXanoRequest<XanoApiGroup>( `/workspace/${XANO_WORKSPACE}/apigroup`, 'POST', requestBody ); console.error(`[Tool] Successfully created API group "${name}" with ID: ${response.id}`); const formattedContent = `# API Group Created\n\n` + `**Name**: ${response.name}\n` + `**ID**: ${response.id}\n` + `**Description**: ${response.description || 'No description'}\n` + `${response.docs ? `**Documentation**: ${response.docs}\n` : ''}` + `**Swagger Documentation**: ${response.swagger ? 'Enabled' : 'Disabled'}\n` + `**Created**: ${new Date(response.created_at).toLocaleString()}\n` + `**Updated**: ${new Date(response.updated_at).toLocaleString()}\n` + `${response.guid ? `**GUID**: ${response.guid}\n` : ''}` + `${response.canonical ? `**Canonical**: ${response.canonical}\n` : ''}` + `${response.branch ? `**Branch**: ${response.branch}\n` : ''}` + `${response.tag && response.tag.length > 0 ? `**Tags**: ${response.tag.join(', ')}\n` : ''}`; return { content: [ { type: "text", text: formattedContent } ] }; } catch (error) { console.error(`[Error] Failed to create API group: ${error instanceof Error ? error.message : String(error)}`); return { content: [ { type: "text", text: `Error creating API group: ${error instanceof Error ? error.message : String(error)}` } ], isError: true }; } }
- src/index.ts:721-728 (schema)Zod schema defining the input parameters for the create-api-group tool, including name, description, swagger flag, optional docs, tags, and branch.{ name: z.string().describe("Name of the API group"), description: z.string().describe("Description of the API group"), swagger: z.boolean().describe("Whether to enable Swagger documentation"), docs: z.string().optional().describe("Documentation for the API group"), tag: z.array(z.string()).optional().nullable().describe("Tags to associate with the API group"), branch: z.string().optional().describe("Branch name for the API group") },
- src/index.ts:718-783 (registration)The server.tool registration call that registers the create-api-group tool with its name, description, input schema, and handler function.server.tool( "create-api-group", "Create a new API group in the Xano workspace", { name: z.string().describe("Name of the API group"), description: z.string().describe("Description of the API group"), swagger: z.boolean().describe("Whether to enable Swagger documentation"), docs: z.string().optional().describe("Documentation for the API group"), tag: z.array(z.string()).optional().nullable().describe("Tags to associate with the API group"), branch: z.string().optional().describe("Branch name for the API group") }, async ({ name, description, swagger, docs, tag, branch }) => { console.error(`[Tool] Executing create-api-group for name: ${name}`); try { const requestBody = { name, description, swagger, ...(docs !== undefined && { docs }), ...(tag !== undefined && { tag }), ...(branch !== undefined && { branch }) }; const response = await makeXanoRequest<XanoApiGroup>( `/workspace/${XANO_WORKSPACE}/apigroup`, 'POST', requestBody ); console.error(`[Tool] Successfully created API group "${name}" with ID: ${response.id}`); const formattedContent = `# API Group Created\n\n` + `**Name**: ${response.name}\n` + `**ID**: ${response.id}\n` + `**Description**: ${response.description || 'No description'}\n` + `${response.docs ? `**Documentation**: ${response.docs}\n` : ''}` + `**Swagger Documentation**: ${response.swagger ? 'Enabled' : 'Disabled'}\n` + `**Created**: ${new Date(response.created_at).toLocaleString()}\n` + `**Updated**: ${new Date(response.updated_at).toLocaleString()}\n` + `${response.guid ? `**GUID**: ${response.guid}\n` : ''}` + `${response.canonical ? `**Canonical**: ${response.canonical}\n` : ''}` + `${response.branch ? `**Branch**: ${response.branch}\n` : ''}` + `${response.tag && response.tag.length > 0 ? `**Tags**: ${response.tag.join(', ')}\n` : ''}`; return { content: [ { type: "text", text: formattedContent } ] }; } catch (error) { console.error(`[Error] Failed to create API group: ${error instanceof Error ? error.message : String(error)}`); return { content: [ { type: "text", text: `Error creating API group: ${error instanceof Error ? error.message : String(error)}` } ], isError: true }; } } );