Skip to main content
Glama
sourcefuse

Robot Framework MCP Server

by sourcefuse

create_advanced_selenium_keywords

Generate Robot Framework keywords for advanced Selenium web testing operations. Creates .robot file content with SeleniumLibrary capabilities for test automation.

Instructions

Generate Robot Framework keywords for advanced Selenium operations. Returns .robot file content as text - does not execute.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The core handler function for the 'create_advanced_selenium_keywords' tool. Decorated with @mcp.tool(), it returns a multi-line template string containing advanced Robot Framework SeleniumLibrary keywords for operations like dropdowns, checkboxes, file uploads, alerts, mouse actions, scrolling, window management, JavaScript execution, waits, tables, and form validation.
    def create_advanced_selenium_keywords() -> str:
        """Generate Robot Framework keywords for advanced Selenium operations. Returns .robot file content as text - does not execute."""
        template = """*** Settings ***
    Library    SeleniumLibrary
    
    *** Keywords ***
    # Dropdown/Select Operations
    Select Dropdown Option By Label
        [Arguments]    ${locator}    ${label}
        [Documentation]    Select option from dropdown by visible text
        Wait Until Element Is Visible    ${locator}    10s
        Select From List By Label    ${locator}    ${label}
    
    Select Dropdown Option By Value
        [Arguments]    ${locator}    ${value}
        [Documentation]    Select option from dropdown by value
        Wait Until Element Is Visible    ${locator}    10s
        Select From List By Value    ${locator}    ${value}
    
    # Checkbox Operations
    Select Checkbox If Not Selected
        [Arguments]    ${locator}
        [Documentation]    Select checkbox only if it's not already selected
        Wait Until Element Is Visible    ${locator}    10s
        ${is_selected}=    Run Keyword And Return Status    Checkbox Should Be Selected    ${locator}
        Run Keyword If    not ${is_selected}    Select Checkbox    ${locator}
    
    Unselect Checkbox If Selected
        [Arguments]    ${locator}
        [Documentation]    Unselect checkbox only if it's currently selected
        Wait Until Element Is Visible    ${locator}    10s
        ${is_selected}=    Run Keyword And Return Status    Checkbox Should Be Selected    ${locator}
        Run Keyword If    ${is_selected}    Unselect Checkbox    ${locator}
    
    # File Upload Operations
    Upload File To Element
        [Arguments]    ${locator}    ${file_path}
        [Documentation]    Upload file using file input element
        Wait Until Element Is Visible    ${locator}    10s
        Choose File    ${locator}    ${file_path}
    
    # Alert/Pop-up Operations
    Handle Alert And Accept
        [Documentation]    Handle JavaScript alert and accept it
        Alert Should Be Present
        Accept Alert
    
    Handle Alert And Dismiss
        [Documentation]    Handle JavaScript alert and dismiss it
        Alert Should Be Present
        Dismiss Alert
    
    Get Alert Text And Accept
        [Documentation]    Get alert text and accept the alert
        Alert Should Be Present
        ${alert_text}=    Get Alert Message
        Accept Alert
        RETURN    ${alert_text}
    
    # Mouse Operations
    Hover Over Element
        [Arguments]    ${locator}
        [Documentation]    Hover mouse over an element
        Wait Until Element Is Visible    ${locator}    10s
        Mouse Over    ${locator}
    
    Double Click On Element
        [Arguments]    ${locator}
        [Documentation]    Double click on an element
        Wait Until Element Is Visible    ${locator}    10s
        Double Click Element    ${locator}
    
    Right Click On Element
        [Arguments]    ${locator}
        [Documentation]    Right click on an element
        Wait Until Element Is Visible    ${locator}    10s
        Open Context Menu    ${locator}
    
    # Scroll Operations
    Scroll To Element
        [Arguments]    ${locator}
        [Documentation]    Scroll element into view
        Wait Until Element Is Visible    ${locator}    10s
        Scroll Element Into View    ${locator}
    
    Scroll To Bottom Of Page
        [Documentation]    Scroll to the bottom of the page
        Execute JavaScript    window.scrollTo(0, document.body.scrollHeight)
    
    Scroll To Top Of Page
        [Documentation]    Scroll to the top of the page
        Execute JavaScript    window.scrollTo(0, 0)
    
    # Window/Tab Operations
    Switch To New Window
        [Documentation]    Switch to the newly opened window/tab
        ${current_windows}=    Get Window Handles
        ${window_count}=    Get Length    ${current_windows}
        Should Be True    ${window_count} > 1    New window should be opened
        Switch Window    ${current_windows}[-1]
    
    Close Current Window And Switch Back
        [Documentation]    Close current window and switch to previous one
        Close Window
        Switch Window    MAIN
    
    # JavaScript Operations
    Execute Custom JavaScript
        [Arguments]    ${javascript_code}
        [Documentation]    Execute custom JavaScript code
        ${result}=    Execute JavaScript    ${javascript_code}
        RETURN    ${result}
    
    Set Element Attribute
        [Arguments]    ${locator}    ${attribute}    ${value}
        [Documentation]    Set attribute value of an element using JavaScript
        Wait Until Element Is Visible    ${locator}    10s
        Execute JavaScript    arguments[0].setAttribute('${attribute}', '${value}');    ARGUMENTS    ${locator}
    
    Get Element Attribute Value
        [Arguments]    ${locator}    ${attribute}
        [Documentation]    Get attribute value of an element
        Wait Until Element Is Visible    ${locator}    10s
        ${value}=    Get Element Attribute    ${locator}    ${attribute}
        RETURN    ${value}
    
    # Advanced Wait Operations
    Wait Until Element Contains Text
        [Arguments]    ${locator}    ${expected_text}    ${timeout}=10s
        [Documentation]    Wait until element contains specific text
        Wait Until Element Is Visible    ${locator}    ${timeout}
        Wait Until Element Contains    ${locator}    ${expected_text}    ${timeout}
    
    Wait Until Page Title Contains
        [Arguments]    ${expected_title}    ${timeout}=10s
        [Documentation]    Wait until page title contains expected text
        Wait Until Title Contains    ${expected_title}    ${timeout}
    
    Wait For Element To Disappear
        [Arguments]    ${locator}    ${timeout}=10s
        [Documentation]    Wait for element to disappear from page
        Wait Until Element Is Not Visible    ${locator}    ${timeout}
    
    # Table Operations
    Get Table Cell Text
        [Arguments]    ${table_locator}    ${row}    ${column}
        [Documentation]    Get text from specific table cell
        ${cell_text}=    Get Table Cell    ${table_locator}    ${row}    ${column}
        RETURN    ${cell_text}
    
    Get Table Row Count
        [Arguments]    ${table_locator}
        [Documentation]    Get number of rows in table
        ${row_count}=    Get Element Count    ${table_locator}//tr
        RETURN    ${row_count}
    
    # Form Validation
    Verify Field Is Required
        [Arguments]    ${locator}
        [Documentation]    Verify field has required attribute
        ${is_required}=    Get Element Attribute    ${locator}    required
        Should Not Be Empty    ${is_required}    Field should be required
    
    Verify Field Is Disabled
        [Arguments]    ${locator}
        [Documentation]    Verify field is disabled
        Element Should Be Disabled    ${locator}
    
    Verify Field Is Enabled
        [Arguments]    ${locator}
        [Documentation]    Verify field is enabled
        Element Should Be Enabled    ${locator}
    """
        return template
  • mcp_server.py:233-233 (registration)
    The @mcp.tool() decorator registers this function as an MCP tool named 'create_advanced_selenium_keywords'.
    @mcp.tool()
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool generates keywords and returns .robot file content as text without execution, which clarifies it's a read-only generation tool. However, it lacks details on potential constraints (e.g., rate limits, input validation), error handling, or what constitutes 'advanced' operations, leaving gaps in behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is highly concise and front-loaded, consisting of two clear sentences: one stating the purpose and another clarifying the output and non-execution behavior. Every sentence adds value without redundancy, making it efficient and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 0 parameters, 100% schema coverage, and an output schema exists (so return values are documented elsewhere), the description is reasonably complete. It covers the core purpose and output format. However, it could be more complete by defining 'advanced' operations or differentiating from siblings, but for a parameterless tool with good schema support, this is adequate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters, and schema description coverage is 100%, so there are no parameters to document. The description doesn't need to compensate for any parameter gaps. A baseline of 4 is appropriate since no parameter information is required, and the description doesn't mislead about inputs.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Generate Robot Framework keywords for advanced Selenium operations.' It specifies both the verb ('Generate') and resource ('Robot Framework keywords'), and indicates the domain ('advanced Selenium operations'). However, it doesn't explicitly differentiate from sibling tools like 'create_extended_selenium_keywords' or 'create_login_test_case', which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides minimal usage guidance. It mentions that the tool 'Returns .robot file content as text - does not execute,' which implies it's for code generation rather than execution, but doesn't specify when to use this tool versus alternatives like 'create_extended_selenium_keywords' or 'create_api_integration_test'. No explicit when/when-not instructions or prerequisites are provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/sourcefuse/robotframework-mcp'

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