Skip to content

FEAT: Add support with web search and email capabilities - #56

Merged
NP-compete merged 18 commits into
redhat-data-and-ai:deep-agentfrom
tuhinsharma121:deep-agent
Apr 21, 2026
Merged

FEAT: Add support with web search and email capabilities #56
NP-compete merged 18 commits into
redhat-data-and-ai:deep-agentfrom
tuhinsharma121:deep-agent

Conversation

@tuhinsharma121

Copy link
Copy Markdown
Contributor

Summary

This PR introduces Deep Agent capabilities to the MCP server with integrated web search and email functionality, while modernizing the toolset and improving infrastructure.

New Features

  • Deep Agent Support: Core architecture for Deep Agent proof of concept
  • Web Search Tool: Tavily API integration with parallel query execution, automatic deduplication, and retry logic with exponential backoff
  • Email Tool: Resend API integration for sending emails with HTML content
  • BMI Calculator: Example health calculation tool

Infrastructure Improvements

  • Enhanced Configuration: Comprehensive settings for web search (timeout, snippet length) and email services
  • Improved Logging: Fixed structlog integration with passthrough formatter for better log handling
  • OAuth Cleanup: Removed unused models and streamlined service code
  • Code Organization: Refactored API with PUBLIC_PATHS constant and cleaner middleware

Breaking Changes

  • Removed legacy example tools: multiply_numbers, generate_code_review_prompt, get_redhat_logo
  • Replaced with practical tools: calculate_bmi, search_web, send_email

Testing

  • Added comprehensive test suite for web_search_tool (100% coverage)
  • Simplified overall test structure

Documentation

  • Updated README with new tools and configuration variables
  • Improved table formatting and organization
  • Added detailed configuration sections for web search, email, CORS, and database

rajulg78 and others added 10 commits March 19, 2026 18:59
- Tavily-powered web_search tool with multi-query, deduplication
- knowledge_search tool for document retrieval
- Registered both tools in MCP server
…ariables

- Fix WEB_SEARCH_TIMEOUT default (30 → 15) and WEB_SEARCH_MAX_SNIPPET_LENGTH
  default (500 → 4000) to match actual code
- Add missing env vars: MCP_HOST_ENDPOINT, ENVIRONMENT, COMPATIBLE_WITH_CURSOR,
  SESSION_SECRET, CORS_*, POSTGRES_POOL_SIZE, POSTGRES_MAX_CONNECTIONS
- Organize configuration into categorized sections (Server, Auth, Web Search,
  CORS, Database)
- Simplify OAuth models and API setup code
- Add 20 tests covering _search_with_retry, _truncate_snippet, and web_search
- Cover TimeoutError retry path, exception retries, result deduplication
- Cover env var overrides for timeout and snippet length
- Achieve 100% code coverage for web_search_tool.py
…currency, and error handling

- Move TAVILY_API_KEY, WEB_SEARCH_TIMEOUT, WEB_SEARCH_MAX_SNIPPET_LENGTH to Settings class
- Add asyncio.Semaphore(5) to cap concurrent search requests
- Use logger.exception() instead of logger.error() for full stack traces
- Move tavily import to top-level with try/except ImportError guard
- Update tests to mock settings instead of os.environ

Made-with: Cursor
- Remove whimsify_number tool (unused demonstration tool)
- Simplify web_search_tool tests by removing redundant test cases
- Reduce test file from 308 to 138 lines while maintaining coverage

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@codecov-commenter

codecov-commenter commented Apr 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 54.40415% with 88 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
template_mcp_server/src/tools/bmi_tool.py 10.00% 36 Missing ⚠️
template_mcp_server/src/tools/email_tool.py 23.07% 30 Missing ⚠️
template_mcp_server/src/tools/web_search_tool.py 77.89% 21 Missing ⚠️
template_mcp_server/src/api.py 75.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@tuhinsharma121
tuhinsharma121 marked this pull request as ready for review April 6, 2026 19:28
@tuhinsharma121

Copy link
Copy Markdown
Contributor Author

I wonder if we should make the tool calls as mock tool calls with static data.

Comment thread template_mcp_server/src/tools/email_tool.py Outdated
Comment thread template_mcp_server/src/tools/email_tool.py Outdated
Co-authored-by: NP-compete <NP-compete@users.noreply.github.com>

@mimran-khan mimran-khan left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tuhinsharma121
tuhinsharma121 changed the base branch from main to deep-agent April 19, 2026 16:09
@tuhinsharma121
tuhinsharma121 marked this pull request as draft April 19, 2026 16:09
tuhinsharma121 and others added 3 commits April 19, 2026 22:01
Add threading lock to ensure thread-safe API key setting when sending emails with resend package, preventing conflicts in concurrent multi-tenant scenarios.

Co-Authored-By: mimran-khan <mimran-khan@users.noreply.github.com>
Replace deprecated asyncio.get_event_loop() with asyncio.get_running_loop() for Python 3.12+ compatibility.

Co-Authored-By: mimran-khan <mimran-khan@users.noreply.github.com>
Adds email format validation tool that checks email structure, length constraints,
and format compliance. Includes 24 comprehensive test cases covering valid formats,
invalid patterns, and edge cases.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@tuhinsharma121
tuhinsharma121 marked this pull request as ready for review April 20, 2026 13:54
@NP-compete
NP-compete merged commit f79dbda into redhat-data-and-ai:deep-agent Apr 21, 2026
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.

5 participants