/**
* Execute Module - Action Execution Tools
*
* This module provides 9 MCP tools for triggering actions on Komodo resources:
* - Deploy operations
* - Build operations
* - Server lifecycle (start, stop, restart)
* - Procedure execution
* - Action triggering
* - Repository operations (pull, clone)
*
* All operations are POST requests with async execution handling.
*/
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
/**
* Tool: komodo_execute_Deploy
* Execute a deployment by ID
* POST /execute/deploy/{id}
*/
export const komodo_execute_Deploy: Tool = {
name: 'komodo_execute_Deploy',
description: 'Execute a deployment on Komodo. Triggers the deployment process for the specified deployment ID. Returns execution status and job information.',
inputSchema: {
type: 'object',
properties: {
id: {
type: 'string',
description: 'The unique identifier of the deployment to execute'
},
options: {
type: 'object',
description: 'Optional deployment execution parameters',
properties: {
force: {
type: 'boolean',
description: 'Force deployment even if no changes detected'
},
stopBeforeStart: {
type: 'boolean',
description: 'Stop the deployment before starting it'
},
skipPull: {
type: 'boolean',
description: 'Skip pulling the latest code from repository'
}
}
}
},
required: ['id']
}
};
/**
* Tool: komodo_execute_Build
* Trigger a build by ID
* POST /execute/build/{id}
*/
export const komodo_execute_Build: Tool = {
name: 'komodo_execute_Build',
description: 'Trigger a build process on Komodo. Starts the build for the specified build configuration. Returns build job status and output.',
inputSchema: {
type: 'object',
properties: {
id: {
type: 'string',
description: 'The unique identifier of the build configuration to execute'
},
options: {
type: 'object',
description: 'Optional build execution parameters',
properties: {
skipCache: {
type: 'boolean',
description: 'Skip using cached build layers'
},
skipPull: {
type: 'boolean',
description: 'Skip pulling latest code before building'
},
forceBuild: {
type: 'boolean',
description: 'Force rebuild even if no changes detected'
}
}
}
},
required: ['id']
}
};
/**
* Tool: komodo_execute_StartServer
* Start a server by ID
* POST /execute/server/{id}/start
*/
export const komodo_execute_StartServer: Tool = {
name: 'komodo_execute_StartServer',
description: 'Start a server on Komodo. Initiates the server startup process for the specified server ID. Returns server state and startup logs.',
inputSchema: {
type: 'object',
properties: {
id: {
type: 'string',
description: 'The unique identifier of the server to start'
},
options: {
type: 'object',
description: 'Optional server startup parameters',
properties: {
timeout: {
type: 'number',
description: 'Timeout in seconds for startup operation'
},
waitForHealthy: {
type: 'boolean',
description: 'Wait for server to report healthy status before returning'
}
}
}
},
required: ['id']
}
};
/**
* Tool: komodo_execute_StopServer
* Stop a server by ID
* POST /execute/server/{id}/stop
*/
export const komodo_execute_StopServer: Tool = {
name: 'komodo_execute_StopServer',
description: 'Stop a running server on Komodo. Gracefully shuts down the specified server. Returns server state and shutdown logs.',
inputSchema: {
type: 'object',
properties: {
id: {
type: 'string',
description: 'The unique identifier of the server to stop'
},
options: {
type: 'object',
description: 'Optional server shutdown parameters',
properties: {
timeout: {
type: 'number',
description: 'Timeout in seconds for shutdown operation'
},
force: {
type: 'boolean',
description: 'Force stop the server immediately (SIGKILL)'
},
removeContainer: {
type: 'boolean',
description: 'Remove the container after stopping'
}
}
}
},
required: ['id']
}
};
/**
* Tool: komodo_execute_RestartServer
* Restart a server by ID
* POST /execute/server/{id}/restart
*/
export const komodo_execute_RestartServer: Tool = {
name: 'komodo_execute_RestartServer',
description: 'Restart a server on Komodo. Performs a graceful stop followed by start for the specified server. Returns server state and restart logs.',
inputSchema: {
type: 'object',
properties: {
id: {
type: 'string',
description: 'The unique identifier of the server to restart'
},
options: {
type: 'object',
description: 'Optional server restart parameters',
properties: {
timeout: {
type: 'number',
description: 'Timeout in seconds for restart operation'
},
force: {
type: 'boolean',
description: 'Force restart even if server is not responding'
},
waitForHealthy: {
type: 'boolean',
description: 'Wait for server to report healthy status after restart'
}
}
}
},
required: ['id']
}
};
/**
* Tool: komodo_execute_RunProcedure
* Execute a procedure by ID
* POST /execute/procedure/{id}
*/
export const komodo_execute_RunProcedure: Tool = {
name: 'komodo_execute_RunProcedure',
description: 'Run a procedure on Komodo. Executes a predefined sequence of operations. Returns procedure execution status and results.',
inputSchema: {
type: 'object',
properties: {
id: {
type: 'string',
description: 'The unique identifier of the procedure to run'
},
variables: {
type: 'object',
description: 'Optional variables to pass to the procedure',
additionalProperties: {
type: 'string'
}
},
options: {
type: 'object',
description: 'Optional procedure execution parameters',
properties: {
async: {
type: 'boolean',
description: 'Run procedure asynchronously without waiting for completion'
},
timeout: {
type: 'number',
description: 'Timeout in seconds for procedure execution'
}
}
}
},
required: ['id']
}
};
/**
* Tool: komodo_execute_TriggerAction
* Trigger an action by ID
* POST /execute/action/{id}
*/
export const komodo_execute_TriggerAction: Tool = {
name: 'komodo_execute_TriggerAction',
description: 'Trigger an action on Komodo. Executes a configured action such as webhooks, scripts, or notifications. Returns action execution status.',
inputSchema: {
type: 'object',
properties: {
id: {
type: 'string',
description: 'The unique identifier of the action to trigger'
},
payload: {
type: 'object',
description: 'Optional payload data to pass to the action',
additionalProperties: true
},
options: {
type: 'object',
description: 'Optional action execution parameters',
properties: {
async: {
type: 'boolean',
description: 'Execute action asynchronously without waiting for completion'
},
retryOnFailure: {
type: 'boolean',
description: 'Retry the action if it fails'
}
}
}
},
required: ['id']
}
};
/**
* Tool: komodo_execute_PullRepo
* Pull latest changes from a repository
* POST /execute/repo/{id}/pull
*/
export const komodo_execute_PullRepo: Tool = {
name: 'komodo_execute_PullRepo',
description: 'Pull latest changes from a repository on Komodo. Updates the repository to the latest commit from the remote. Returns pull operation status and changes.',
inputSchema: {
type: 'object',
properties: {
id: {
type: 'string',
description: 'The unique identifier of the repository to pull'
},
options: {
type: 'object',
description: 'Optional pull operation parameters',
properties: {
branch: {
type: 'string',
description: 'Specific branch to pull (defaults to configured branch)'
},
force: {
type: 'boolean',
description: 'Force pull, discarding local changes'
},
submodules: {
type: 'boolean',
description: 'Update git submodules after pulling'
}
}
}
},
required: ['id']
}
};
/**
* Tool: komodo_execute_CloneRepo
* Clone a repository
* POST /execute/repo/{id}/clone
*/
export const komodo_execute_CloneRepo: Tool = {
name: 'komodo_execute_CloneRepo',
description: 'Clone a repository on Komodo. Performs initial clone of the repository to the server. Returns clone operation status and repository information.',
inputSchema: {
type: 'object',
properties: {
id: {
type: 'string',
description: 'The unique identifier of the repository configuration to clone'
},
options: {
type: 'object',
description: 'Optional clone operation parameters',
properties: {
branch: {
type: 'string',
description: 'Specific branch to clone (defaults to default branch)'
},
depth: {
type: 'number',
description: 'Create a shallow clone with specified commit depth'
},
submodules: {
type: 'boolean',
description: 'Clone git submodules'
},
overwrite: {
type: 'boolean',
description: 'Overwrite existing repository if it exists'
}
}
}
},
required: ['id']
}
};
/**
* Export all execute tools as an array for easy registration
*/
export const executeTools: Tool[] = [
komodo_execute_Deploy,
komodo_execute_Build,
komodo_execute_StartServer,
komodo_execute_StopServer,
komodo_execute_RestartServer,
komodo_execute_RunProcedure,
komodo_execute_TriggerAction,
komodo_execute_PullRepo,
komodo_execute_CloneRepo
];
/**
* Tool count for validation
*/
export const EXECUTE_TOOL_COUNT = 9;