Skip to content
This repository was archived by the owner on Sep 4, 2025. It is now read-only.

Conversation

alzimmermsft
Copy link
Member

@alzimmermsft alzimmermsft commented Jul 31, 2025

What does this PR do?

The QueueMessageSend branch adds support for sending messages to Azure Storage queues through the Azure MCP (Model Context Protocol) toolset. The changes span across 2 commits and include the following major additions:

✨ New Features Added

1. Queue Message Send Command

  • Added a new MCP tool azmcp_storage_queue_message_send that allows sending messages to Azure Storage queues
  • Supports configurable time-to-live (TTL) and visibility timeout settings
  • Command name: azmcp storage queue message send

2. Core Implementation

  • New Service Method: Added SendQueueMessage method to IStorageService and StorageService
  • Queue Client Support: Added Azure Storage Queues dependency (Azure.Storage.Queues v12.22.0)
  • Queue Service Client: Implemented CreateQueueServiceClient method for queue operations

🏗️ Architecture & Structure

1. Command Structure

  • BaseQueueCommand<T> - Base class for queue-related commands
  • QueueMessageSendCommand - Specific implementation for sending messages
  • QueueMessageSendOptions - Options class for command parameters

2. Models & Results

  • QueueMessageSendResult - Response model containing:
    • Message ID
    • Insertion time
    • Expiration time
    • Pop receipt
    • Next visible time
    • Message content

3. Option Definitions

  • Added queue-specific options: queue-name, message-content, time-to-live-in-seconds, visibility-timeout-in-seconds

🧪 Testing & Quality

1. Unit Tests

  • Comprehensive unit tests in QueueMessageSendCommandTests.cs
  • Tests for input validation, error handling, and success scenarios
  • Mock-based testing using NSubstitute

2. Integration Tests

  • Live tests added to StorageCommandTests.cs
  • Tests both basic message sending and advanced scenarios with optional parameters

3. Test Infrastructure

  • Updated Bicep test resources to include a test queue (testqueue)

📚 Documentation & Configuration

1. Documentation Updates

  • Updated CHANGELOG.md with new feature description
  • Added command examples to azmcp-commands.md
  • Updated README.md with queue messaging capabilities
  • Added E2E test prompts for the new functionality

2. JSON Serialization

  • Updated StorageJsonContext to include new result types for AOT compatibility

🔧 Command Usage

# Basic usage
azmcp storage queue message send --subscription <sub> \
                                 --account <account> \
                                 --queue <queue> \
                                 --message "Hello World"

# With optional parameters
azmcp storage queue message send --subscription <sub> \
                                 --account <account> \
                                 --queue <queue> \
                                 --message "Hello World" \
                                 --time-to-live-in-seconds 3600 \
                                 --visibility-timeout-in-seconds 30

🚀 Technical Implementation Details

  • Error Handling: Proper exception handling with specific error messages for 404 (queue not found) and 403 (authorization failed) scenarios
  • Retry Policy Support: Integrated with the existing retry policy framework
  • Tenant Support: Multi-tenant authentication support
  • AOT Compatibility: All generated code follows AOT-safe patterns as per coding guidelines

This implementation enables asynchronous messaging capabilities within the Azure MCP toolset, allowing users to send messages to Azure Storage queues with configurable delivery and visibility settings.

Pre-merge Checklist

  • Required for All PRs
    • Read contribution guidelines
    • PR title clearly describes the change
    • Commit history is clean with descriptive messages (cleanup guide)
    • Added comprehensive tests for new/modified functionality
    • Updated CHANGELOG.md for product changes (features, bug fixes, UI/UX, updated dependencies)
    • Spelling check passes: .\eng\common\spelling\Invoke-Cspell.ps1
  • For MCP tool changes, updated:
    • Updated README.md documentation
    • Updated command list in /docs/azmcp-commands.md
    • Updated test prompts in /e2eTests/e2eTestPrompts.md

@alzimmermsft alzimmermsft self-assigned this Jul 31, 2025
@Copilot Copilot AI review requested due to automatic review settings July 31, 2025 20:58
@alzimmermsft alzimmermsft requested a review from a team as a code owner July 31, 2025 20:58
@alzimmermsft alzimmermsft requested a review from hallipr July 31, 2025 20:58
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for sending messages to Azure Storage queues through the Azure MCP toolset. The implementation introduces a new MCP tool azmcp_storage_queue_message_send that allows sending messages with configurable time-to-live (TTL) and visibility timeout settings.

  • Adds queue message sending functionality with the azmcp storage queue message send command
  • Implements proper error handling for queue-specific scenarios (404 for queue not found, 403 for authorization failures)
  • Includes comprehensive unit and integration tests to validate the new functionality

Reviewed Changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
areas/storage/src/AzureMcp.Storage/AzureMcp.Storage.csproj Adds Azure.Storage.Queues package dependency
areas/storage/src/AzureMcp.Storage/Services/IStorageService.cs Adds SendQueueMessage method signature to the service interface
areas/storage/src/AzureMcp.Storage/Services/StorageService.cs Implements queue message sending functionality and queue service client creation
areas/storage/src/AzureMcp.Storage/Commands/Queue/BaseQueueCommand.cs Base class for queue-related commands with common queue options
areas/storage/src/AzureMcp.Storage/Commands/Queue/Message/QueueMessageSendCommand.cs Main command implementation for sending queue messages
areas/storage/src/AzureMcp.Storage/Models/QueueMessageSendResult.cs Result model containing message metadata
areas/storage/src/AzureMcp.Storage/Options/Queue/BaseQueueOptions.cs Base options class for queue commands
areas/storage/src/AzureMcp.Storage/Options/Queue/Message/QueueMessageSendOptions.cs Specific options for queue message send command
areas/storage/src/AzureMcp.Storage/StorageSetup.cs Registers the new queue command in the command hierarchy
areas/storage/tests/AzureMcp.Storage.UnitTests/Queue/Message/QueueMessageSendCommandTests.cs Comprehensive unit tests for the command
areas/storage/tests/AzureMcp.Storage.LiveTests/StorageCommandTests.cs Integration tests for queue message functionality

@alzimmermsft alzimmermsft requested a review from jongio August 6, 2025 16:07
@alzimmermsft alzimmermsft merged commit 7233577 into Azure:main Aug 11, 2025
26 checks passed
@github-project-automation github-project-automation bot moved this from Untriaged to Done in Azure MCP Server (OLD) Aug 11, 2025
@alzimmermsft alzimmermsft deleted the QueueMessageSend branch August 11, 2025 15:17
chidozieononiwu pushed a commit to chidozieononiwu/azure-mcp that referenced this pull request Aug 18, 2025
* Add command

* Add tests and documentation

* Use correct base command

* Fix linting

* Fix linting again

* CSpell testfilesystem

* PR feedback

* Minor cleanup

* Fix linting

* Fix linting

* subscriptionId -> subscription
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants