Skip to main content
Glama
xhuaustc

Jenkins MCP Tool

get_scenario_list

Retrieve pre-configured Jenkins deployment scenarios to ensure correct server and job configurations before executing deployment tasks.

Instructions

Get all available application scenarios - the preferred entry point for deployment tasks.

Important: For any deployment-related task, this function should be called first instead of directly using search_jobs.
This function returns a pre-configured scenario list, each containing the correct server and job path configuration.

Returns:
    List of scenarios, each containing:
        - index: Scenario index (string)
        - name: Scenario name
        - description: Scenario description
        - server: Jenkins server name
        - job_path: Job path

Workflow:
1. Call this function to get the scenario list
2. Let the user select a scenario
3. Use search_jobs_by_scenario(scenario) to get the specific job
4. Use trigger_build() to execute deployment

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function decorated with @mcp.tool(), which registers and executes the get_scenario_list tool by delegating to ScenarioManager.
    @mcp.tool()
    def get_scenario_list() -> List[ScenarioInfo]:
        """Get all available application scenarios - the preferred entry point for deployment tasks.
    
        Important: For any deployment-related task, this function should be called first instead of directly using search_jobs.
        This function returns a pre-configured scenario list, each containing the correct server and job path configuration.
    
        Returns:
            List of scenarios, each containing:
                - index: Scenario index (string)
                - name: Scenario name
                - description: Scenario description
                - server: Jenkins server name
                - job_path: Job path
    
        Workflow:
        1. Call this function to get the scenario list
        2. Let the user select a scenario
        3. Use search_jobs_by_scenario(scenario) to get the specific job
        4. Use trigger_build() to execute deployment
        """
        return ScenarioManager.get_scenario_list()
  • Core implementation logic in ScenarioManager.get_scenario_list(), loads scenario mapping from config and formats into ScenarioInfo list.
    @staticmethod
    def get_scenario_list() -> List[ScenarioInfo]:
        """Get all available application scenarios.
    
        Important: For any deployment-related task, this function should be called first instead of directly using search_jobs.
        This function returns a pre-configured scenario list, each containing the correct server and job path configuration.
    
        Returns:
            List of scenarios, each containing:
                - index: Scenario index (string)
                - name: Scenario name
                - description: Scenario description
                - server: Jenkins server name
                - job_path: Job path
    
        Workflow:
        1. Call this function to get the scenario list
        2. Let the user select a scenario
        3. Use search_jobs_by_scenario(scenario) to get the specific job
        4. Use trigger_build() to execute deployment
    
        Raises:
            JenkinsConfigurationError: Configuration error
        """
        try:
            scenario_mapping = get_scenario_mapping()
            scenarios = []
    
            for i, (name, config) in enumerate(scenario_mapping.items()):
                scenarios.append(
                    {
                        "index": str(i + 1),
                        "name": name,
                        "description": config["description"],
                        "server": config["server"],
                        "job_path": config["job_path"],
                    }
                )
    
            logger.info(f"Found {len(scenarios)} deployment scenarios")
            return scenarios
    
        except Exception as e:
            logger.error(f"Failed to get scenario list: {e}")
            raise JenkinsConfigurationError(f"Failed to get scenario list: {e}") from e
  • TypedDict schema defining the structure of each scenario returned by get_scenario_list.
    class ScenarioInfo(TypedDict):
        """Scenario info."""
    
        index: str
        name: str
        description: str
        server: str
        job_path: str
  • @mcp.tool() decorator registers the get_scenario_list function as an MCP tool.
    @mcp.tool()
    def get_scenario_list() -> List[ScenarioInfo]:
        """Get all available application scenarios - the preferred entry point for deployment tasks.
    
        Important: For any deployment-related task, this function should be called first instead of directly using search_jobs.
        This function returns a pre-configured scenario list, each containing the correct server and job path configuration.
    
        Returns:
            List of scenarios, each containing:
                - index: Scenario index (string)
                - name: Scenario name
                - description: Scenario description
                - server: Jenkins server name
                - job_path: Job path
    
        Workflow:
        1. Call this function to get the scenario list
        2. Let the user select a scenario
        3. Use search_jobs_by_scenario(scenario) to get the specific job
        4. Use trigger_build() to execute deployment
        """
        return ScenarioManager.get_scenario_list()

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/xhuaustc/jenkins-mcp'

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