Skip to content

Commit 6a4a27e

Browse files
committed
Make it clearer when many entities are affected
1 parent 10bcd7b commit 6a4a27e

2 files changed

Lines changed: 28 additions & 1 deletion

File tree

src/ServiceControl.UnitTests/Mcp/McpMetadataDescriptionsTests.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,32 @@ public void Retry_all_failed_messages_warns_that_it_affects_all_unresolved_faile
3939
Assert.That(description, Does.Contain("all unresolved failed messages across the instance"));
4040
}
4141

42+
[TestCase(typeof(RetryTools), nameof(RetryTools.RetryFailedMessages))]
43+
[TestCase(typeof(RetryTools), nameof(RetryTools.RetryFailedMessagesByQueue))]
44+
[TestCase(typeof(RetryTools), nameof(RetryTools.RetryAllFailedMessages))]
45+
[TestCase(typeof(RetryTools), nameof(RetryTools.RetryAllFailedMessagesByEndpoint))]
46+
[TestCase(typeof(RetryTools), nameof(RetryTools.RetryFailureGroup))]
47+
[TestCase(typeof(ArchiveTools), nameof(ArchiveTools.ArchiveFailedMessages))]
48+
[TestCase(typeof(ArchiveTools), nameof(ArchiveTools.ArchiveFailureGroup))]
49+
[TestCase(typeof(ArchiveTools), nameof(ArchiveTools.UnarchiveFailedMessages))]
50+
[TestCase(typeof(ArchiveTools), nameof(ArchiveTools.UnarchiveFailureGroup))]
51+
public void Bulk_mutating_tools_warn_that_they_may_affect_many_messages(Type toolType, string methodName)
52+
{
53+
var description = GetMethodDescription(toolType, methodName);
54+
55+
Assert.That(description, Does.Contain("may affect many messages"));
56+
}
57+
4258
[TestCase(typeof(FailedMessageTools), nameof(FailedMessageTools.GetFailedMessageById), "failedMessageId", "failed message ID")]
4359
[TestCase(typeof(FailedMessageTools), nameof(FailedMessageTools.GetFailedMessageLastAttempt), "failedMessageId", "failed message ID")]
60+
[TestCase(typeof(RetryTools), nameof(RetryTools.RetryFailedMessage), "failedMessageId", "failed message ID")]
61+
[TestCase(typeof(RetryTools), nameof(RetryTools.RetryFailedMessages), "messageIds", "failed message IDs")]
4462
[TestCase(typeof(ArchiveTools), nameof(ArchiveTools.ArchiveFailureGroup), "groupId", "failure group ID")]
4563
[TestCase(typeof(ArchiveTools), nameof(ArchiveTools.UnarchiveFailureGroup), "groupId", "failure group ID")]
64+
[TestCase(typeof(ArchiveTools), nameof(ArchiveTools.ArchiveFailedMessage), "failedMessageId", "failed message ID")]
65+
[TestCase(typeof(ArchiveTools), nameof(ArchiveTools.ArchiveFailedMessages), "messageIds", "failed message IDs")]
66+
[TestCase(typeof(ArchiveTools), nameof(ArchiveTools.UnarchiveFailedMessage), "failedMessageId", "failed message ID")]
67+
[TestCase(typeof(ArchiveTools), nameof(ArchiveTools.UnarchiveFailedMessages), "messageIds", "failed message IDs")]
4668
public void Key_error_tool_parameters_identify_the_entity_type(Type toolType, string methodName, string parameterName, string expectedPhrase)
4769
{
4870
var description = GetParameterDescription(toolType, methodName, parameterName);

src/ServiceControl/Mcp/RetryTools.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public async Task<string> RetryFailedMessage(
4343
[McpServerTool(ReadOnly = false, Idempotent = false, Destructive = true, OpenWorld = false), Description(
4444
"Use this tool to reprocess multiple specific failed messages at once. " +
4545
"This operation changes system state. " +
46+
"It may affect many messages. " +
4647
"Good for questions like: 'retry these messages', 'reprocess messages msg-1, msg-2, msg-3', or 'retry this batch'. " +
4748
"Prefer RetryFailureGroup when all messages share the same failure cause — use this tool when you have a specific set of message IDs to retry."
4849
)]
@@ -64,6 +65,7 @@ public async Task<string> RetryFailedMessages(
6465
[McpServerTool(ReadOnly = false, Idempotent = false, Destructive = true, OpenWorld = false), Description(
6566
"Use this tool to retry all unresolved failed messages from a specific queue. " +
6667
"This operation changes system state. " +
68+
"It may affect many messages. " +
6769
"Good for questions like: 'retry all failures in the Sales queue', 'reprocess everything from this queue', or 'the queue consumer is back, retry its failures'. " +
6870
"Useful when a queue's consumer was down or misconfigured and is now fixed. Only retries messages with unresolved status."
6971
)]
@@ -83,6 +85,7 @@ await messageSession.SendLocal<RetryMessagesByQueueAddress>(m =>
8385
[McpServerTool(ReadOnly = false, Idempotent = false, Destructive = true, OpenWorld = false), Description(
8486
"Use this tool to retry every unresolved failed message across all queues and endpoints. " +
8587
"This operation changes system state. " +
88+
"It may affect many messages. " +
8689
"Good for questions like: 'retry everything', 'reprocess all failures', or 'retry all failed messages'. " +
8790
"It affects all unresolved failed messages across the instance. " +
8891
"This is a broad operation — prefer RetryFailedMessagesByQueue, RetryAllFailedMessagesByEndpoint, or RetryFailureGroup when you can scope the retry more narrowly."
@@ -98,6 +101,7 @@ public async Task<string> RetryAllFailedMessages()
98101
[McpServerTool(ReadOnly = false, Idempotent = false, Destructive = true, OpenWorld = false), Description(
99102
"Use this tool to retry all failed messages for a specific NServiceBus endpoint. " +
100103
"This operation changes system state. " +
104+
"It may affect many messages. " +
101105
"Good for questions like: 'retry all failures in the Sales endpoint', 'the bug in Shipping is fixed, retry its failures', or 'reprocess all errors for this endpoint'. " +
102106
"Useful when a bug in one endpoint has been fixed and all its failures should be reprocessed."
103107
)]
@@ -113,9 +117,10 @@ public async Task<string> RetryAllFailedMessagesByEndpoint(
113117
[McpServerTool(ReadOnly = false, Idempotent = false, Destructive = true, OpenWorld = false), Description(
114118
"Use this tool to retry all failed messages that share the same exception type and stack trace. " +
115119
"This operation changes system state. " +
120+
"It may affect many messages. " +
116121
"Good for questions like: 'retry this failure group', 'the bug causing these NullReferenceExceptions is fixed, retry them', or 'retry all messages in this group'. " +
117122
"This is the most targeted way to retry related failures after fixing a specific bug. " +
118-
"You need a group ID, which you can get from GetFailureGroups. " +
123+
"You need a failure group ID, which you can get from GetFailureGroups. " +
119124
"Returns InProgress if a retry is already running for this group."
120125
)]
121126
public async Task<string> RetryFailureGroup(

0 commit comments

Comments
 (0)