Skip to main content
Glama

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
NameRequiredDescriptionDefault
queryNo
bodyYes

Implementation Reference

  • 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));
      };
    }
  • 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'),
    );
  • 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(),
    });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/samihalawa/mcp-server-koyeb'

If you have feedback or need assistance with the MCP directory API, please join our Discord server