validate_robot_framework_syntax
Check and validate Robot Framework syntax without executing code. Provides a detailed validation report to identify and correct errors in test scripts.
Instructions
Validate Robot Framework syntax and provide suggestions. Returns validation report as text - does not execute code.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| robot_code | Yes |
Implementation Reference
- mcp_server.py:1050-1102 (handler)The @mcp.tool()-decorated handler function that implements the 'validate_robot_framework_syntax' tool. It checks Robot Framework code for syntax errors and warnings, such as section headers, variable syntax, and spacing, and 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)}"
- mcp_server.py:1050-1050 (registration)The @mcp.tool() decorator registers the function as an MCP tool.@mcp.tool()
- mcp_server.py:1051-1052 (schema)Type annotations (robot_code: str -> str) and docstring define the input schema and description for the 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."""