Skip to content

LCORE-1173: named type for MCP headers complicated structure#1143

Merged
tisnik merged 1 commit into
lightspeed-core:mainfrom
tisnik:lcore-1173
Feb 12, 2026
Merged

LCORE-1173: named type for MCP headers complicated structure#1143
tisnik merged 1 commit into
lightspeed-core:mainfrom
tisnik:lcore-1173

Conversation

@tisnik
Copy link
Copy Markdown
Contributor

@tisnik tisnik commented Feb 12, 2026

Description

LCORE-1173: named type for MCP headers complicated structure

Type of change

  • Refactor
  • New feature
  • Bug fix
  • CVE fix
  • Optimization
  • Documentation Update
  • Configuration Update
  • Bump-up service version
  • Bump-up dependent library
  • Bump-up library or tool used for development (does not change the final image)
  • CI configuration change
  • Konflux configuration change
  • Unit tests improvement
  • Integration tests improvement
  • End to end tests improvement
  • Benchmarks improvement

Tools used to create PR

  • Assisted-by: N/A
  • Generated by: N/A

Related Tickets & Documents

  • Related Issue #LCORE-1173

Summary by CodeRabbit

  • Refactor
    • Improved internal type definitions for better code consistency and type safety across the application. These changes enhance maintainability without affecting end-user functionality.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 12, 2026

Walkthrough

This PR introduces a McpHeaders type alias for dict[str, dict[str, str]] and refactors multiple endpoint and utility function signatures to use this dedicated type instead of raw dictionary annotations, improving type clarity across the MCP headers handling layer.

Changes

Cohort / File(s) Summary
Type Definition
src/utils/mcp_headers.py
Introduces McpHeaders type alias and updates function signatures (mcp_headers_dependency, extract_mcp_headers, handle_mcp_headers_with_toolgroups) to use McpHeaders instead of dict[str, dict[str, str]].
Endpoint Updates
src/app/endpoints/a2a.py, src/app/endpoints/query.py, src/app/endpoints/streaming_query.py
Updates endpoint handler signatures and constructors to accept mcp_headers parameter with McpHeaders type and imports the new type alias.
Response Utilities
src/utils/responses.py
Updates prepare_tools, prepare_responses_params, and get_mcp_tools function signatures to use McpHeaders type for mcp_headers parameters.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • umago
  • manstis
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: introducing a named type (McpHeaders) for MCP headers' complicated structure (dict[str, dict[str, str]]) across multiple files.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@tisnik tisnik merged commit c13c8c4 into lightspeed-core:main Feb 12, 2026
22 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.

1 participant