Skip to main content
Glama
sourcefuse

Robot Framework MCP Server

by sourcefuse

validate_robot_framework_syntax

Check Robot Framework code for syntax errors and receive validation feedback without executing the test scripts.

Instructions

Validate Robot Framework syntax and provide suggestions. Returns validation report as text - does not execute code.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
robot_codeYes

Implementation Reference

  • The handler function for the 'validate_robot_framework_syntax' tool, decorated with @mcp.tool() for registration. It performs static syntax validation on Robot Framework code, checking for section headers, variable syntax, unclosed variables, and spacing issues, then returns a formatted validation report.
    @mcp.tool()
    def validate_robot_framework_syntax(robot_code: str) -> str:
        """Validate Robot Framework syntax and provide suggestions. Returns validation report as text - does not execute code."""
        try:
            lines = robot_code.split('\n')
            errors = []
            warnings = []
            
            # Check for basic syntax issues
            for i, line in enumerate(lines, 1):
                line_stripped = line.strip()
                if not line_stripped or line_stripped.startswith('#'):
                    continue
                    
                # Check for proper section headers
                if line_stripped.startswith('***') and not line_stripped.endswith('***'):
                    errors.append(f"Line {i}: Section header must end with '***'")
                
                # Check for proper variable syntax - should be ${variable} not ${{variable}}
                if '${{' in line and '}}' in line:
                    warnings.append(f"Line {i}: Use ${{variable}} syntax instead of ${{{{variable}}}}")
                
                # Check for unclosed variable syntax
                if '${' in line and '}' not in line:
                    errors.append(f"Line {i}: Unclosed variable syntax")
                
                # Check for proper spacing in variables section
                if line_stripped.startswith('${') and '    ' not in line:
                    warnings.append(f"Line {i}: Variables should use 4 spaces between name and value")
            
            result = "# ROBOT FRAMEWORK SYNTAX VALIDATION\n\n"
            
            if errors:
                result += "## ERRORS (Must Fix):\n"
                result += '\n'.join(f"- {error}" for error in errors) + "\n\n"
            
            if warnings:
                result += "## WARNINGS (Recommended Fixes):\n"
                result += '\n'.join(f"- {warning}" for warning in warnings) + "\n\n"
            
            if not errors and not warnings:
                result += "✅ VALIDATION PASSED: No syntax errors found\n"
            elif not errors:
                result += "⚠️  VALIDATION PASSED WITH WARNINGS: No critical errors, but consider fixing warnings\n"
            else:
                result += "❌ VALIDATION FAILED: Critical errors found that must be fixed\n"
            
            return result
                
        except Exception as e:
            return f"# VALIDATION ERROR: {str(e)}"
  • The @mcp.tool() decorator registers the validate_robot_framework_syntax function as an MCP tool.
    @mcp.tool()

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