Skip to main content
Glama
sourcefuse

Robot Framework MCP Server

by sourcefuse

create_api_integration_test

Generate Robot Framework API integration test code for specified endpoints and methods, producing .robot file content without execution.

Instructions

Generate Robot Framework API integration test code. Returns .robot file content as text - does not execute.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
base_urlYes
endpointYes
methodNoGET

Implementation Reference

  • The core handler function decorated with @mcp.tool(), implementing the tool logic to generate Robot Framework API integration test code using a template, with input validation.
    @mcp.tool()
    def create_api_integration_test(base_url: str, endpoint: str, method: str = "GET") -> str:
        """Generate Robot Framework API integration test code. Returns .robot file content as text - does not execute."""
        try:
            validated_url = InputValidator.validate_url(base_url)
            
            template = Template("""*** Settings ***
    Library    SeleniumLibrary
    Library    RequestsLibrary
    Library    Collections
    
    *** Variables ***
    $${BASE_URL}         $base_url
    $${API_ENDPOINT}     $endpoint
    $${BROWSER}          Chrome
    
    *** Test Cases ***
    API UI Integration Test
        [Documentation]    Test API and UI integration
        [Tags]    integration    api    ui
        
        # API Setup and Validation
        Create Session    api_session    $${BASE_URL}
        $${api_response}=    GET On Session    api_session    $${API_ENDPOINT}
        Status Should Be    200    $${api_response}
        $${response_data}=    Set Variable    $${api_response.json()}
        
        # UI Validation based on API data
        Open Browser    $${BASE_URL}    $${BROWSER}
        Maximize Browser Window
        
        # Validate UI reflects API data
        Wait Until Page Contains    $${response_data['title']}    10s
        Page Should Contain    $${response_data['description']}
        
        [Teardown]    Run Keywords
        ...    Close Browser    AND
        ...    Delete All Sessions
    
    *** Keywords ***
    Validate API Response Structure
        [Arguments]    $${response}
        [Documentation]    Validate API response has required fields
        Dictionary Should Contain Key    $${response}    id
        Dictionary Should Contain Key    $${response}    title
        Dictionary Should Contain Key    $${response}    description
    """)
            
            return template.substitute(
                base_url=validated_url,
                endpoint=endpoint,
                method=method.upper()
            )
            
        except ValidationError as e:
            return f"# VALIDATION ERROR: {str(e)}\n# Please correct the input and try again."
        except Exception as e:
            return f"# UNEXPECTED ERROR: {str(e)}\n# Please contact support."

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