Skip to main content
Glama
sourcefuse

Robot Framework MCP Server

by sourcefuse

create_page_object_login

Generate Robot Framework page object model code for login page automation. Creates .robot file content with locators and methods for web testing.

Instructions

Generate Robot Framework page object model code for login page. Returns .robot file content as text - does not execute.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
template_typeNoappLocator

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The core handler function for the 'create_page_object_login' tool. It is registered via the @mcp.tool() decorator and generates Robot Framework page object model code for login functionality using configurable selector templates.
    @mcp.tool()
    def create_page_object_login(template_type: str = "appLocator") -> str:
        """Generate Robot Framework page object model code for login page. Returns .robot file content as text - does not execute."""
        try:
            # Get selector configuration
            selectors = SELECTOR_CONFIGS.get(template_type.lower(), SELECTOR_CONFIGS["generic"])
            
            # Use Template for safe variable substitution and correct Robot Framework syntax
            template = Template("""*** Settings ***
    Library    SeleniumLibrary
    
    *** Variables ***
    # $template_type Application Selectors
    $${LOGIN_USERNAME_FIELD}    $username_field
    $${LOGIN_PASSWORD_FIELD}    $password_field
    $${LOGIN_BUTTON}           $login_button
    $${LOGIN_ERROR_MESSAGE}    $error_message
    
    *** Keywords ***
    Input Username
        [Arguments]    $${username}
        [Documentation]    Enter username in the username field
        Wait Until Element Is Visible    $${LOGIN_USERNAME_FIELD}
        Clear Element Text    $${LOGIN_USERNAME_FIELD}
        Input Text    $${LOGIN_USERNAME_FIELD}    $${username}
    
    Input Password
        [Arguments]    $${password}
        [Documentation]    Enter password in the password field
        Wait Until Element Is Visible    $${LOGIN_PASSWORD_FIELD}
        Clear Element Text    $${LOGIN_PASSWORD_FIELD}
        Input Text    $${LOGIN_PASSWORD_FIELD}    $${password}
    
    Click Login Button
        [Documentation]    Click the login button
        Wait Until Element Is Enabled    $${LOGIN_BUTTON}
        Click Button    $${LOGIN_BUTTON}
    
    Login With Credentials
        [Arguments]    $${username}    $${password}
        [Documentation]    Complete login process with given credentials
        Input Username    $${username}
        Input Password    $${password}
        Click Login Button
    
    Verify Error Message
        [Arguments]    $${expected_message}
        [Documentation]    Verify error message is displayed
        Wait Until Element Is Visible    $${LOGIN_ERROR_MESSAGE}    10s
        Element Text Should Be    $${LOGIN_ERROR_MESSAGE}    $${expected_message}
    """)
            
            return template.substitute(
                template_type=template_type.upper(),
                username_field=selectors["username_field"],
                password_field=selectors["password_field"],
                login_button=selectors["login_button"],
                error_message=selectors["error_message"]
            )
            
        except Exception as e:
            return f"# ERROR: {str(e)}\n# Please contact support."
  • Predefined selector configurations for different application types (appLocator, generic, bootstrap), directly used by the create_page_object_login handler to populate the generated page object code.
    SELECTOR_CONFIGS = {
        "appLocator": {
            "username_field": "id=user-name",
            "password_field": "id=password",
            "login_button": "id=login-button",
            "success_indicator": "xpath=//span[@class='title']",
            "error_message": "xpath=//h3[@data-test='error']",
            "logout_button": "id=logout_sidebar_link"
        },
        "generic": {
            "username_field": "id=username",
            "password_field": "id=password",
            "login_button": "css=button[type='submit']",
            "success_indicator": "css=.dashboard",
            "error_message": "css=.error",
            "logout_button": "css=.logout"
        },
        "bootstrap": {
            "username_field": "css=input[name='username']",
            "password_field": "css=input[name='password']",
            "login_button": "css=.btn-primary",
            "success_indicator": "css=.navbar-brand",
            "error_message": "css=.alert-danger",
            "logout_button": "css=.btn-outline-secondary"
        }
    }
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool 'Returns .robot file content as text - does not execute,' which clarifies it's a read-only generation tool (no execution or side effects) and specifies the output format. However, it lacks details on permissions, rate limits, error handling, or what happens if inputs are invalid. For a tool with no annotations, this is a minimal but adequate disclosure.

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 well-structured in two sentences: the first states the purpose, and the second clarifies the output and non-execution behavior. Every sentence adds value without redundancy, making it front-loaded and efficient for quick understanding.

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

Completeness3/5

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

Given the tool has an output schema (which should document return values) and no annotations, the description is moderately complete. It covers the core purpose and output format but lacks parameter details and usage context. For a code generation tool with one parameter, this is adequate but leaves gaps in parameter understanding and sibling differentiation.

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

Parameters2/5

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

The input schema has 1 parameter with 0% description coverage, and the tool description provides no information about parameters. It doesn't mention 'template_type' or explain its purpose, values, or impact on the generated code. With low schema coverage, the description fails to compensate, leaving the parameter undocumented and its semantics unclear.

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 page object model code for login page.' It specifies the verb ('Generate'), resource ('page object model code'), and scope ('for login page'). However, it doesn't explicitly differentiate from sibling tools like 'create_login_test_case', which might also generate login-related code but for different purposes.

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 no guidance on when to use this tool versus alternatives. It mentions 'does not execute' to clarify it's a code generation tool, but offers no context on prerequisites, when to choose it over other code generation siblings (e.g., 'create_login_test_case'), or any exclusions. This leaves the agent without usage direction.

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