create-service
Add a new service to an existing Koyeb app by configuring deployment settings, scaling, and resources.
Instructions
Create a new service inside an existing app
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | No | ||
| body | Yes |
Implementation Reference
- src/utils.ts:13-25 (handler)Handler factory function that creates the actual tool callback. For 'create-service', it calls koyeb.createService with auth and params, returning the API result as text content.
export function createApiTool(name: keyof Koyeb): ToolCallback<ZodRawShape> { const fn = koyeb[name] as Function; return async (params: object) => { const result = await fn({ auth, ...params }); if (result.error) { return createTextContent('Error: ' + result.error ? JSON.stringify(result.error) : 'unknown error'); } return createTextContent(JSON.stringify(result.data)); }; } - src/tools/service.ts:35-50 (registration)Registration of the 'create-service' tool with MCP server. Defines the tool name, description, input schema (query params and body with app_id and definition), and the handler.
server.tool( 'create-service', 'Create a new service inside an existing app', { query: z .object({ dry_run: z.string().optional().describe('If set only run validation'), }) .optional(), body: z.object({ app_id: z.string().describe('The id of the app'), definition: deploymentDefinitionSchema, }), }, createApiTool('createService'), ); - src/schemas.ts:205-222 (schema)Zod schema for the deployment definition used in the create-service request body. Validates archive, docker, git config, environment variables, health checks, instance types, ports, regions, scaling, volumes, etc.
export const deploymentDefinitionSchema = z.object({ archive: archive.optional(), config_files: configFile.array().optional(), docker: docker.optional(), env: env.array().optional(), git: git.optional(), health_checks: healthCheck.array().optional(), instance_types: instanceType.array(), name: z.string(), ports: port.array().optional(), regions: z.array(regions).min(1), routes: route.array().optional(), scalings: scaling.array(), skip_cache: z.boolean().optional(), strategy: strategy.optional(), type: z.union([z.literal("INVALID"), z.literal("WEB"), z.literal("WORKER"), z.literal("DATABASE")]), volumes: volume.array().optional(), });