Skip to content

♻️ Deduplicate log primitives and MCP tool result boilerplate#76

Merged
renardeinside merged 2 commits intomainfrom
fix/mcp-logs
Feb 16, 2026
Merged

♻️ Deduplicate log primitives and MCP tool result boilerplate#76
renardeinside merged 2 commits intomainfrom
fix/mcp-logs

Conversation

@renardeinside
Copy link
Copy Markdown
Collaborator

Summary

  • Move shared log primitives (LogAggregator, AggregatedRecord, should_skip_log, get_aggregation_key, source_label) to apx-common so both CLI and MCP use the same code
  • Add effective_timestamp_ms() and source_label() methods on LogRecord, replacing 6 inline timestamp fallback calculations and 3 duplicated service-name mappings
  • Change LogAggregator to return structured AggregatedRecord instead of pre-formatted strings, eliminating parse_formatted_log_line() round-trip
  • Extract query_filtered_logs() helper to deduplicate setup between fetch_logs and fetch_logs_structured
  • Add ToolResult::from_serializable() and structured_error(), replacing 6 identical serialize-or-error patterns in MCP server
  • Remove duplicate RefreshOpenapiArgs (identical to EmptyArgs)

Test plan

  • cargo test --workspace — all 151 tests pass
  • just fmt — no formatting issues
  • just check — cargo check, clippy, ruff, prettier all pass

🤖 Generated with Claude Code

@renardeinside renardeinside merged commit db5ca68 into main Feb 16, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 [BUG] the mcp tool returns logs as a single long string without splitting them into lines

1 participant