Skip to content

Commit 8e257be

Browse files
pelleclaude
andcommitted
Remove Complete message type per updated TAIP specifications
- Remove Complete message implementation from tap-msg - Remove CompleteTool from tap-mcp tools - Update test files to remove Complete references - Update MCP integration test to expect 30 tools instead of 31 - Update README.md to list Cancel and Revert instead of Complete This aligns the codebase with the updated TAIP specifications where the Complete message has been removed in favor of using the standard TAIP-4 authorization flow (Payment -> Authorize -> Settle). 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 56c18de commit 8e257be

File tree

9 files changed

+5
-274
lines changed

9 files changed

+5
-274
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ See individual tool READMEs for detailed usage instructions.
116116

117117
## Key Features
118118

119-
- **Complete TAP Implementation**: Support for all TAP message types (Transfer, Authorize, Reject, Settle, Complete, etc.)
119+
- **Complete TAP Implementation**: Support for all TAP message types (Transfer, Authorize, Reject, Settle, Cancel, Revert, etc.)
120120
- **DIDComm v2 Integration**: Secure, encrypted messaging with authenticated signatures
121121
- **Chain Agnostic Identifiers**: Implementation of CAIP-2 (ChainID), CAIP-10 (AccountID), and CAIP-19 (AssetID)
122122
- **Multiple DID Methods**: Support for did:key, did:web, did:pkh, and more

tap-agent/tests/test_vectors_validation.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use std::fs;
3434
use std::path::Path;
3535
use tap_msg::didcomm::PlainMessage;
3636
use tap_msg::message::{
37-
AuthorizationRequired, Cancel, Complete, ConfirmRelationship, Connect, DIDCommPresentation,
37+
AuthorizationRequired, Cancel, ConfirmRelationship, Connect, DIDCommPresentation,
3838
Payment, RemoveAgent, ReplaceAgent, Revert, UpdateParty, UpdatePolicies,
3939
};
4040
use tap_msg::{
@@ -95,7 +95,6 @@ fn validate_tap_message(message: &PlainMessage) -> Result<(), String> {
9595
"https://tap.rsvp/schema/1.0#Authorize",
9696
"https://tap.rsvp/schema/1.0#Reject",
9797
"https://tap.rsvp/schema/1.0#Settle",
98-
"https://tap.rsvp/schema/1.0#Complete",
9998
"https://tap.rsvp/schema/1.0#Cancel",
10099
"https://tap.rsvp/schema/1.0#Revert",
101100
"https://tap.rsvp/schema/1.0#AddAgents",
@@ -241,11 +240,6 @@ fn validate_tap_message(message: &PlainMessage) -> Result<(), String> {
241240
.map_err(|e| format!("Failed to parse AuthorizationRequired: {}", e))?;
242241
auth_required.validate().map_err(|e| e.to_string())
243242
}
244-
"https://tap.rsvp/schema/1.0#Complete" => {
245-
let complete: Complete = serde_json::from_value(body_with_thread_id.clone())
246-
.map_err(|e| format!("Failed to parse Complete: {}", e))?;
247-
complete.validate().map_err(|e| e.to_string())
248-
}
249243
"https://didcomm.org/out-of-band/2.0/invitation" => {
250244
// Out-of-band messages must have a goal_code starting with "tap."
251245
if let Some(body_obj) = body_with_thread_id.as_object() {

tap-mcp/src/tools/mod.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,6 @@ impl ToolRegistry {
8484
"tap_settle".to_string(),
8585
Box::new(SettleTool::new(tap_integration.clone())),
8686
);
87-
tools.insert(
88-
"tap_complete".to_string(),
89-
Box::new(CompleteTool::new(tap_integration.clone())),
90-
);
9187

9288
// Transaction management tools
9389
tools.insert(

tap-mcp/src/tools/schema.rs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -227,32 +227,6 @@ pub fn settle_schema() -> Value {
227227
})
228228
}
229229

230-
/// Schema for complete tool
231-
pub fn complete_schema() -> Value {
232-
json!({
233-
"type": "object",
234-
"properties": {
235-
"agent_did": {
236-
"type": "string",
237-
"description": "The DID of the agent that will sign and send this message"
238-
},
239-
"transaction_id": {
240-
"type": "string",
241-
"description": "Transaction ID to complete"
242-
},
243-
"settlement_address": {
244-
"type": "string",
245-
"description": "CAIP-10 settlement address"
246-
},
247-
"amount": {
248-
"type": "string",
249-
"description": "Optional amount completed"
250-
}
251-
},
252-
"required": ["agent_did", "transaction_id", "settlement_address"],
253-
"additionalProperties": false
254-
})
255-
}
256230

257231
/// Schema for list_transactions tool
258232
pub fn list_transactions_schema() -> Value {

tap-mcp/src/tools/transaction_tools.rs

Lines changed: 1 addition & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use std::sync::Arc;
1212
use tap_caip::AssetId;
1313
use tap_msg::message::tap_message_trait::TapMessageBody;
1414
use tap_msg::message::{
15-
Agent, Authorize, Cancel, Complete, Party, Reject, Revert, Settle, Transfer,
15+
Agent, Authorize, Cancel, Party, Reject, Revert, Settle, Transfer,
1616
};
1717
use tap_node::storage::models::SchemaType;
1818
use tracing::{debug, error};
@@ -1250,145 +1250,3 @@ impl ToolHandler for ListTransactionsTool {
12501250
}
12511251
}
12521252

1253-
/// Tool for completing transactions
1254-
pub struct CompleteTool {
1255-
tap_integration: Arc<TapIntegration>,
1256-
}
1257-
1258-
/// Parameters for completing a transaction
1259-
#[derive(Debug, Deserialize)]
1260-
struct CompleteParams {
1261-
agent_did: String, // The DID of the agent that will sign and send this message
1262-
transaction_id: String,
1263-
settlement_address: String,
1264-
#[serde(default)]
1265-
amount: Option<String>,
1266-
}
1267-
1268-
/// Response for completing a transaction
1269-
#[derive(Debug, Serialize)]
1270-
struct CompleteResponse {
1271-
transaction_id: String,
1272-
message_id: String,
1273-
status: String,
1274-
settlement_address: String,
1275-
amount: Option<String>,
1276-
completed_at: String,
1277-
}
1278-
1279-
impl CompleteTool {
1280-
pub fn new(tap_integration: Arc<TapIntegration>) -> Self {
1281-
Self { tap_integration }
1282-
}
1283-
1284-
fn tap_integration(&self) -> &TapIntegration {
1285-
&self.tap_integration
1286-
}
1287-
}
1288-
1289-
#[async_trait::async_trait]
1290-
impl ToolHandler for CompleteTool {
1291-
async fn handle(&self, arguments: Option<Value>) -> Result<CallToolResult> {
1292-
let params: CompleteParams = match arguments {
1293-
Some(args) => serde_json::from_value(args)
1294-
.map_err(|e| Error::invalid_parameter(format!("Invalid parameters: {}", e)))?,
1295-
None => {
1296-
return Ok(error_text_response(
1297-
"Missing required parameters".to_string(),
1298-
))
1299-
}
1300-
};
1301-
1302-
debug!(
1303-
"Completing transaction: {} with settlement_address: {}",
1304-
params.transaction_id, params.settlement_address
1305-
);
1306-
1307-
// Create complete message
1308-
let complete = Complete {
1309-
transaction_id: params.transaction_id.clone(),
1310-
settlement_address: params.settlement_address.clone(),
1311-
amount: params.amount.clone(),
1312-
};
1313-
1314-
// Validate the complete message
1315-
if let Err(e) = complete.validate() {
1316-
return Ok(error_text_response(format!(
1317-
"Complete validation failed: {}",
1318-
e
1319-
)));
1320-
}
1321-
1322-
// Create DIDComm message using the specified agent DID
1323-
let didcomm_message = match complete.to_didcomm(&params.agent_did) {
1324-
Ok(msg) => msg,
1325-
Err(e) => {
1326-
return Ok(error_text_response(format!(
1327-
"Failed to create DIDComm message: {}",
1328-
e
1329-
)));
1330-
}
1331-
};
1332-
1333-
// Determine recipient from the message
1334-
let recipient_did = if !didcomm_message.to.is_empty() {
1335-
didcomm_message.to[0].clone()
1336-
} else {
1337-
return Ok(error_text_response(
1338-
"No recipient found for complete message".to_string(),
1339-
));
1340-
};
1341-
1342-
debug!(
1343-
"Sending complete from {} to {} for transaction: {}",
1344-
params.agent_did, recipient_did, params.transaction_id
1345-
);
1346-
1347-
// Send the message through the TAP node (this will handle storage, logging, and delivery tracking)
1348-
match self
1349-
.tap_integration()
1350-
.node()
1351-
.send_message(params.agent_did.clone(), didcomm_message.clone())
1352-
.await
1353-
{
1354-
Ok(packed_message) => {
1355-
debug!(
1356-
"Complete message sent successfully to {}, packed message length: {}",
1357-
recipient_did,
1358-
packed_message.len()
1359-
);
1360-
1361-
let response = CompleteResponse {
1362-
transaction_id: params.transaction_id,
1363-
message_id: didcomm_message.id,
1364-
status: "sent".to_string(),
1365-
settlement_address: params.settlement_address,
1366-
amount: params.amount,
1367-
completed_at: chrono::Utc::now().to_rfc3339(),
1368-
};
1369-
1370-
let response_json = serde_json::to_string_pretty(&response).map_err(|e| {
1371-
Error::tool_execution(format!("Failed to serialize response: {}", e))
1372-
})?;
1373-
1374-
Ok(success_text_response(response_json))
1375-
}
1376-
Err(e) => {
1377-
error!("Failed to send complete message: {}", e);
1378-
Ok(error_text_response(format!(
1379-
"Failed to send complete message: {}",
1380-
e
1381-
)))
1382-
}
1383-
}
1384-
}
1385-
1386-
fn get_definition(&self) -> Tool {
1387-
Tool {
1388-
name: "tap_complete".to_string(),
1389-
description: "Request from merchant to complete a TAP payment (TAIP-14) transaction using the Complete message so funds are settled and the transaction is finalized."
1390-
.to_string(),
1391-
input_schema: schema::complete_schema(),
1392-
}
1393-
}
1394-
}

tap-mcp/tests/integration_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ async fn test_list_tools() -> Result<()> {
174174

175175
if let Some(result) = response.result {
176176
let tools = result["tools"].as_array().unwrap();
177-
assert_eq!(tools.len(), 31); // All 31 tools should be available (including complete, revert, communication, delivery, customer, received message tools, database tools, agent management tools, and policy tools)
177+
assert_eq!(tools.len(), 30); // All 30 tools should be available (including revert, communication, delivery, customer, received message tools, database tools, agent management tools, and policy tools)
178178

179179
let tool_names: Vec<&str> = tools.iter().map(|t| t["name"].as_str().unwrap()).collect();
180180

tap-msg/src/message/complete.rs

Lines changed: 0 additions & 87 deletions
This file was deleted.

tap-msg/src/message/mod.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ pub mod agent_management;
99
pub mod authorize;
1010
pub mod basic_message;
1111
pub mod cancel;
12-
pub mod complete;
1312
pub mod connection;
1413
pub mod context;
1514
pub mod did_presentation;
@@ -46,9 +45,6 @@ pub use basic_message::BasicMessage;
4645
// Re-export cancel type
4746
pub use cancel::Cancel;
4847

49-
// Re-export complete type
50-
pub use complete::Complete;
51-
5248
// Re-export connection types
5349
pub use connection::{
5450
AuthorizationRequired, Connect, ConnectionConstraints, OutOfBand, TransactionLimits,

0 commit comments

Comments
 (0)