feat: Add comprehensive logs management tools #7
+642
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📋 Add Comprehensive Logs Management Tools
🎯 Overview
This PR adds a complete set of logs management tools to the Kestra MCP server, enabling users to easily access, search, and manage execution logs directly through the MCP interface.
✨ What's New
6 New Logs Tools Added:
get_execution_logs- Retrieve logs for a specific execution with filtering optionsdownload_execution_logs- Download logs as plain text for easy analysissearch_logs- Global log search across all executions with advanced filtersdelete_execution_logs- Delete logs for a specific execution (use with caution)delete_flow_logs- Delete logs for all executions of a specific flowfollow_execution_logs- Real-time log streaming for running executions🔍 Advanced Filtering Capabilities:
🚀 Key Benefits
📚 Documentation & Testing
docs/prompts/logs.md🔧 Technical Implementation
📊 Impact
This contribution significantly improves the developer experience by providing:
🧪 Testing
All tests pass successfully:
$ pytest tests/test_logs.py -v ======================== 6 passed in 21.68s =========================📝 Usage Examples
🔗 API Endpoints Used
GET /api/v1/{tenant}/logs/{executionId}- Get execution logsGET /api/v1/{tenant}/logs/{executionId}/download- Download logsGET /api/v1/{tenant}/logs/search- Search logs globallyDELETE /api/v1/{tenant}/logs/{executionId}- Delete execution logsDELETE /api/v1/{tenant}/logs/{namespace}/{flowId}- Delete flow logsGET /api/v1/{tenant}/logs/{executionId}/follow- Follow logs (SSE)📁 Files Changed
src/tools/logs.py- Main implementation (335 lines)docs/prompts/logs.md- Complete documentation (88 lines)tests/test_logs.py- Test suite (208 lines)src/server.py- Tool registration (3 lines)tests/test_mcp_server.py- Updated tool list (7 lines)README.md- Added logs to available tools (1 line)Total: 6 files changed, 642 insertions(+)
This PR makes log management much more accessible and powerful for Kestra users, providing a seamless experience for debugging and monitoring workflows through the MCP interface.