@payware/mcp-server 1.3.2 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/.env.example +4 -0
  2. package/README.md +18 -0
  3. package/package.json +7 -9
  4. package/src/auth/rsa-keys.js +12 -6
  5. package/src/auth/sandbox-setup.js +2 -0
  6. package/src/config/toolsets.js +104 -0
  7. package/src/core/auth/jwt-factory.js +4 -1
  8. package/src/core/auth/jwt-token.js +4 -0
  9. package/src/index.js +10 -6
  10. package/src/isv/data/index.js +15 -14
  11. package/src/isv/deep-links/delete-product-link.js +3 -2
  12. package/src/isv/deep-links/delete-transaction-link.js +3 -2
  13. package/src/isv/deep-links/get-product-link.js +8 -6
  14. package/src/isv/deep-links/get-transaction-link.js +8 -6
  15. package/src/isv/index.js +6 -0
  16. package/src/isv/invitations/index.js +5 -0
  17. package/src/isv/oauth2/get-token-info.js +10 -5
  18. package/src/isv/oauth2/obtain-token.js +9 -4
  19. package/src/isv/oauth2/token-helper.js +28 -26
  20. package/src/isv/poi/cancel-price.js +9 -2
  21. package/src/isv/poi/get-poi.js +4 -3
  22. package/src/isv/poi/get-qrcode.js +40 -9
  23. package/src/isv/poi/get-status.js +196 -168
  24. package/src/isv/poi/list-pois.js +6 -6
  25. package/src/isv/poi/set-price.js +40 -53
  26. package/src/isv/products/audios.js +8 -2
  27. package/src/isv/products/create-product.js +2 -0
  28. package/src/isv/products/delete-product.js +2 -0
  29. package/src/isv/products/get-product-image.js +2 -0
  30. package/src/isv/products/get-product.js +2 -0
  31. package/src/isv/products/list-products.js +2 -0
  32. package/src/isv/products/schedules.js +6 -0
  33. package/src/isv/products/update-product.js +2 -0
  34. package/src/isv/reference/index.js +2 -0
  35. package/src/isv/transactions/cancel-transaction.js +2 -0
  36. package/src/isv/transactions/create-transaction.js +2 -0
  37. package/src/isv/transactions/get-status.js +3 -1
  38. package/src/isv/transactions/process-transaction.js +2 -0
  39. package/src/isv/transactions/simulate-callback.js +21 -10
  40. package/src/isv/transactions/transaction-history.js +2 -0
  41. package/src/merchant/data/export-report.js +2 -0
  42. package/src/merchant/data/generate-report.js +2 -0
  43. package/src/merchant/data/get-export-list.js +2 -0
  44. package/src/merchant/data/get-report-requests.js +2 -0
  45. package/src/merchant/data/get-report-status.js +2 -0
  46. package/src/merchant/data/index.js +15 -10
  47. package/src/merchant/data/list-reports.js +2 -0
  48. package/src/merchant/deep-links/delete-product-link.js +3 -2
  49. package/src/merchant/deep-links/delete-transaction-link.js +3 -2
  50. package/src/merchant/deep-links/get-product-link.js +8 -6
  51. package/src/merchant/deep-links/get-transaction-link.js +8 -6
  52. package/src/merchant/index.js +7 -1
  53. package/src/merchant/logs/index.js +4 -0
  54. package/src/merchant/products/audios.js +15 -14
  55. package/src/merchant/products/create-product.js +3 -2
  56. package/src/merchant/products/delete-product.js +3 -2
  57. package/src/merchant/products/get-product-image.js +3 -2
  58. package/src/merchant/products/get-product.js +3 -2
  59. package/src/merchant/products/list-products.js +3 -2
  60. package/src/merchant/products/schedules.js +11 -10
  61. package/src/merchant/products/update-product.js +3 -2
  62. package/src/merchant/transactions/cancel-transaction.js +3 -2
  63. package/src/merchant/transactions/create-transaction.js +3 -1
  64. package/src/merchant/transactions/get-status.js +4 -3
  65. package/src/merchant/transactions/process-transaction.js +5 -4
  66. package/src/merchant/transactions/simulate-callback.js +325 -313
  67. package/src/merchant/transactions/transaction-history.js +7 -6
  68. package/src/payment-institution/data/index.js +15 -14
  69. package/src/payment-institution/deep-links/delete-transaction-link.js +3 -2
  70. package/src/payment-institution/deep-links/get-transaction-link.js +8 -6
  71. package/src/payment-institution/transactions/create-pi-transaction.js +4 -3
  72. package/src/payment-institution/transactions/finalize-transaction.js +6 -3
  73. package/src/payment-institution/transactions/get-transaction-history.js +8 -5
  74. package/src/payment-institution/transactions/get-transaction-status.js +16 -13
  75. package/src/payment-institution/transactions/process-pi-transaction.js +7 -6
  76. package/src/payment-institution/transactions/simulate-pi-callback.js +388 -375
  77. package/src/payment-institution/transactions/soundbite-transaction.js +6 -5
  78. package/src/proxy-server.js +25 -0
  79. package/src/shared/placements/api.js +51 -0
  80. package/src/shared/placements/tools.js +519 -0
  81. package/src/shared/poi/poi-create-api.js +4 -1
  82. package/src/shared/products/products-api.js +36 -25
  83. package/src/shared/shops/shops-api.js +2 -0
  84. package/src/shared/tool-annotations.js +53 -0
  85. package/src/tools/advanced-code-generator.js +17 -265
  86. package/src/utils/code-examples/common/auth-examples.js +1 -1
  87. package/src/utils/code-examples/isv/products.js +1 -1
  88. package/src/utils/code-examples/isv/transactions.js +1 -1
  89. package/src/utils/code-examples/merchant/transactions.js +1 -1
  90. package/src/utils/format-request.js +2 -0
  91. package/src/utils/json-formatter.js +2 -0
  92. package/src/utils/server-info.js +2 -0
  93. package/src/utils/code-examples.js +0 -646
@@ -1,16 +1,18 @@
1
1
  import { getProductDeepLink } from '../../shared/deep-links/api.js';
2
2
  import { getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
3
+ import { ADDS } from '../../shared/tool-annotations.js';
3
4
 
4
5
  /**
5
6
  * Get deep link for a merchant product
6
7
  */
7
8
  export const getProductLinkTool = {
8
9
  name: "payware_deep_links_get_product_link",
9
- description: `Get an active deep link for a product. Returns a clickable URL that redirects to the payware mobile app.
10
+ annotations: ADDS,
11
+ description: `Get an active deep link for a product. Returns a clickable URL that redirects to the payware mobile app. For a link whose payments are attributed to one placement of the product (a poster, an ad, a mailing), use payware_products_get_placement_link instead.
10
12
 
11
13
  **Deep Link Format:**
12
14
  - Web URL: https://go.payware.eu/{productId}
13
- - Mobile Redirect: payware://{productId}
15
+ - Mobile Redirect: payware:/{productId} (one slash: the identifier is case-sensitive, so it must not sit in the URI host, which redirect services lowercase)
14
16
 
15
17
  **Use Cases:**
16
18
  - Mobile-only e-commerce product references
@@ -19,6 +21,7 @@ export const getProductLinkTool = {
19
21
 
20
22
  **Important Notes:**
21
23
  - Deep links are only supported in production environment
24
+ - Apps that open payware links must accept \`payware:\` followed by one, two or three slashes (QR codes and NFC tags carry \`payware://{id}\`): read the identifier after the scheme and any slashes, up to \`/\`, \`?\` or \`#\`, and keep its case
22
25
  - Link expiration is synchronized with the referenced product
23
26
  - Traditional deep links that route to app content when app is installed`,
24
27
 
@@ -37,8 +40,7 @@ export const getProductLinkTool = {
37
40
  },
38
41
  privateKey: {
39
42
  type: "string",
40
- description: "RSA private key for JWT token creation. Uses environment-specific private key as default.",
41
- default: getPrivateKeySafe()
43
+ description: "RSA private key for JWT token creation. Uses environment-specific private key as default."
42
44
  }
43
45
  },
44
46
  required: ["productId"]
@@ -82,7 +84,7 @@ export const getProductLinkTool = {
82
84
  **Deep Link Details:**
83
85
  - Product ID: ${productId}
84
86
  - Web URL: ${linkUrl}
85
- - Mobile Redirect: payware://${productId}
87
+ - Mobile Redirect: payware:/${productId}
86
88
 
87
89
  **Link Information:**
88
90
  - Status: Active
@@ -101,7 +103,7 @@ ${JSON.stringify(result.data, null, 2)}
101
103
 
102
104
  **Usage:**
103
105
  1. Share the web URL: \`${linkUrl}\`
104
- 2. On mobile devices, it will redirect to: \`payware://${productId}\`
106
+ 2. On mobile devices, it will redirect to: \`payware:/${productId}\`
105
107
  3. Link expires when the product expires
106
108
  4. Recreate if product is updated`
107
109
  }]
@@ -1,16 +1,18 @@
1
1
  import { getTransactionDeepLink } from '../../shared/deep-links/api.js';
2
2
  import { getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
3
+ import { ADDS } from '../../shared/tool-annotations.js';
3
4
 
4
5
  /**
5
6
  * Get deep link for a merchant transaction
6
7
  */
7
8
  export const getTransactionLinkTool = {
8
9
  name: "payware_deep_links_get_transaction_link",
10
+ annotations: ADDS,
9
11
  description: `Get an active deep link for a transaction. Returns a clickable URL that redirects to the payware mobile app.
10
12
 
11
13
  **Deep Link Format:**
12
14
  - Web URL: https://go.payware.eu/{transactionId}
13
- - Mobile Redirect: payware://{transactionId}
15
+ - Mobile Redirect: payware:/{transactionId} (one slash: the identifier is case-sensitive, so it must not sit in the URI host, which redirect services lowercase)
14
16
 
15
17
  **Use Cases:**
16
18
  - P2P payments via messaging services
@@ -19,6 +21,7 @@ export const getTransactionLinkTool = {
19
21
 
20
22
  **Important Notes:**
21
23
  - Deep links are only supported in production environment
24
+ - Apps that open payware links must accept \`payware:\` followed by one, two or three slashes (QR codes and NFC tags carry \`payware://{id}\`): read the identifier after the scheme and any slashes, up to \`/\`, \`?\` or \`#\`, and keep its case
22
25
  - Link expiration is synchronized with the referenced transaction
23
26
  - Traditional deep links that route to app content when app is installed`,
24
27
 
@@ -37,8 +40,7 @@ export const getTransactionLinkTool = {
37
40
  },
38
41
  privateKey: {
39
42
  type: "string",
40
- description: "RSA private key for JWT token creation. Uses environment-specific private key as default.",
41
- default: getPrivateKeySafe()
43
+ description: "RSA private key for JWT token creation. Uses environment-specific private key as default."
42
44
  }
43
45
  },
44
46
  required: ["transactionId"]
@@ -82,7 +84,7 @@ export const getTransactionLinkTool = {
82
84
  **Deep Link Details:**
83
85
  - Transaction ID: ${transactionId}
84
86
  - Web URL: ${linkUrl}
85
- - Mobile Redirect: payware://${transactionId}
87
+ - Mobile Redirect: payware:/${transactionId}
86
88
 
87
89
  **Link Information:**
88
90
  - Status: Active
@@ -101,7 +103,7 @@ ${JSON.stringify(result.data, null, 2)}
101
103
 
102
104
  **Usage:**
103
105
  1. Share the web URL: \`${linkUrl}\`
104
- 2. On mobile devices, it will redirect to: \`payware://${transactionId}\`
106
+ 2. On mobile devices, it will redirect to: \`payware:/${transactionId}\`
105
107
  3. Link expires when the transaction expires
106
108
  4. Recreate if transaction is extended`
107
109
  }]
@@ -123,7 +125,7 @@ ${JSON.stringify(result.data, null, 2)}
123
125
  4. **Invalid transaction ID**: Ensure transaction ID format is correct
124
126
 
125
127
  **Troubleshooting:**
126
- 1. Verify transaction exists using \`payware_transactions_get_transaction_status\`
128
+ 1. Verify transaction exists using \`payware_operations_get_transaction_status\`
127
129
  2. Check if running in production environment
128
130
  3. Ensure JWT authentication is working
129
131
  4. Confirm transaction is not expired`
@@ -26,6 +26,9 @@ import { merchantLogsTools } from './logs/index.js';
26
26
  // Shop tools - needed before any call that takes a shop / shopCode
27
27
  import { merchantShopTools } from './shops/index.js';
28
28
 
29
+ // Campaigns, placements and airings - one definition shared by merchants and ISVs
30
+ import { placementTools } from '../shared/placements/tools.js';
31
+
29
32
  // Shared utility tools
30
33
  import { getServerInfoTool } from '../utils/server-info.js';
31
34
 
@@ -60,7 +63,10 @@ export const merchantTools = [
60
63
  ...merchantLogsTools,
61
64
 
62
65
  // Shop lookup
63
- ...merchantShopTools
66
+ ...merchantShopTools,
67
+
68
+ // Campaigns, placements and airings
69
+ ...placementTools('merchant')
64
70
  ];
65
71
 
66
72
  /**
@@ -12,12 +12,14 @@ import {
12
12
  LOG_LEVELS
13
13
  } from '../../shared/logs/logs-api.js';
14
14
  import { getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
15
+ import { LOCAL, READS } from '../../shared/tool-annotations.js';
15
16
 
16
17
  /**
17
18
  * Query logs tool for merchants
18
19
  */
19
20
  export const queryLogsTool = {
20
21
  name: "payware_logs_query",
22
+ annotations: READS,
21
23
  description: "Query application logs with filters. Premium plan required. Returns paginated JSON log entries for debugging and monitoring your integration.",
22
24
  inputSchema: {
23
25
  type: "object",
@@ -174,6 +176,7 @@ Use cursor \`${nextCursor}\` to fetch the next page of results.` : ''}
174
176
  */
175
177
  export const getLogStatusTool = {
176
178
  name: "payware_logs_status",
179
+ annotations: READS,
177
180
  description: "Get log availability and storage information. Premium plan required. Shows if logs are available, total size, and file count.",
178
181
  inputSchema: {
179
182
  type: "object",
@@ -262,6 +265,7 @@ ${data.logsAvailable ? `
262
265
  */
263
266
  export const getLogDownloadUrlTool = {
264
267
  name: "payware_logs_download_url",
268
+ annotations: LOCAL,
265
269
  description: "Get download URL for logs archive. Premium plan required. Returns URL for downloading logs as gzipped JSON file.",
266
270
  inputSchema: {
267
271
  type: "object",
@@ -6,15 +6,17 @@ import {
6
6
  deleteAudio
7
7
  } from '../../shared/products/products-api.js';
8
8
  import { getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
9
+ import { CHANGES, CREATES, READS } from '../../shared/tool-annotations.js';
9
10
 
10
11
  /**
11
12
  * Register audio tool implementation for merchants
12
13
  */
13
14
  export const registerAudioTool = {
14
15
  name: "payware_products_register_audio",
16
+ annotations: CREATES,
15
17
  description: `Register an audio file (soundbite) for a product to enable audio-based payment initiation.
16
18
 
17
- **Supported formats:** Most audio/video formats (up to 200MB)
19
+ **Supported formats:** MP3, WAV, OGG, M4A, FLAC, AAC, WMA, MP4, MOV, up to 100 MB, holding 2 to 120 seconds of audio
18
20
  **Note:** For video files, only the audio channel is registered`,
19
21
 
20
22
  inputSchema: {
@@ -36,8 +38,7 @@ export const registerAudioTool = {
36
38
  },
37
39
  privateKey: {
38
40
  type: "string",
39
- description: "RSA private key for authentication (uses environment-specific private key as default)",
40
- default: getPrivateKeySafe()
41
+ description: "RSA private key for authentication (uses environment-specific private key as default)"
41
42
  },
42
43
  useSandbox: {
43
44
  type: "boolean",
@@ -126,8 +127,8 @@ ${audio.status === '1' ? '✅ Audio is ready for use in soundbite transactions'
126
127
 
127
128
  **Troubleshooting:**
128
129
  1. Verify the audio file path exists and is accessible
129
- 2. Check file size (max 200MB)
130
- 3. Ensure supported audio/video format
130
+ 2. Check file size (max 100 MB) and length (2 to 120 seconds of audio)
131
+ 3. Ensure the format is MP3, WAV, OGG, M4A, FLAC, AAC, WMA, MP4 or MOV
131
132
  4. Verify the product ID exists and belongs to your account
132
133
  5. Check available storage space`
133
134
  }]
@@ -141,6 +142,7 @@ ${audio.status === '1' ? '✅ Audio is ready for use in soundbite transactions'
141
142
  */
142
143
  export const getAudiosTool = {
143
144
  name: "payware_products_get_audios",
145
+ annotations: READS,
144
146
  description: "Get all registered audio files for a product",
145
147
 
146
148
  inputSchema: {
@@ -158,8 +160,7 @@ export const getAudiosTool = {
158
160
  },
159
161
  privateKey: {
160
162
  type: "string",
161
- description: "RSA private key for authentication (uses environment-specific private key as default)",
162
- default: getPrivateKeySafe()
163
+ description: "RSA private key for authentication (uses environment-specific private key as default)"
163
164
  },
164
165
  useSandbox: {
165
166
  type: "boolean",
@@ -253,6 +254,7 @@ ${audiosList}
253
254
  */
254
255
  export const getAudioTool = {
255
256
  name: "payware_products_get_audio",
257
+ annotations: READS,
256
258
  description: "Get detailed information about a specific audio file",
257
259
 
258
260
  inputSchema: {
@@ -274,8 +276,7 @@ export const getAudioTool = {
274
276
  },
275
277
  privateKey: {
276
278
  type: "string",
277
- description: "RSA private key for authentication (uses environment-specific private key as default)",
278
- default: getPrivateKeySafe()
279
+ description: "RSA private key for authentication (uses environment-specific private key as default)"
279
280
  },
280
281
  useSandbox: {
281
282
  type: "boolean",
@@ -367,6 +368,7 @@ ${audio.status === '1' ? '✅ **Ready:** Audio is processed and ready for soundb
367
368
  */
368
369
  export const updateAudioTool = {
369
370
  name: "payware_products_update_audio",
371
+ annotations: CHANGES,
370
372
  description: "Update audio information (title) or reassign audio to another product",
371
373
 
372
374
  inputSchema: {
@@ -388,7 +390,7 @@ export const updateAudioTool = {
388
390
  },
389
391
  newProductId: {
390
392
  type: "string",
391
- description: "New product ID to reassign audio to (starts with 'pr')",
393
+ description: "Product to move the audio to (starts with 'pr'). Sent as a transfer, which keeps the fingerprint; the target must be in the same shop",
392
394
  pattern: "^pr[a-zA-Z0-9]+$"
393
395
  },
394
396
  partnerId: {
@@ -398,8 +400,7 @@ export const updateAudioTool = {
398
400
  },
399
401
  privateKey: {
400
402
  type: "string",
401
- description: "RSA private key for authentication (uses environment-specific private key as default)",
402
- default: getPrivateKeySafe()
403
+ description: "RSA private key for authentication (uses environment-specific private key as default)"
403
404
  },
404
405
  useSandbox: {
405
406
  type: "boolean",
@@ -501,6 +502,7 @@ ${JSON.stringify(audio, null, 2)}
501
502
  */
502
503
  export const deleteAudioTool = {
503
504
  name: "payware_products_delete_audio",
505
+ annotations: CHANGES,
504
506
  description: "Delete an audio file from a product. This action cannot be undone.",
505
507
 
506
508
  inputSchema: {
@@ -522,8 +524,7 @@ export const deleteAudioTool = {
522
524
  },
523
525
  privateKey: {
524
526
  type: "string",
525
- description: "RSA private key for authentication (uses environment-specific private key as default)",
526
- default: getPrivateKeySafe()
527
+ description: "RSA private key for authentication (uses environment-specific private key as default)"
527
528
  },
528
529
  useSandbox: {
529
530
  type: "boolean",
@@ -1,12 +1,14 @@
1
1
  import { createProduct } from '../../shared/products/products-api.js';
2
2
  import { getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
3
3
  import { PRODUCT_TYPES, OVERLAP_PRIORITY } from '../../shared/products/products-api.js';
4
+ import { CREATES } from '../../shared/tool-annotations.js';
4
5
 
5
6
  /**
6
7
  * Create product tool implementation for merchants
7
8
  */
8
9
  export const createProductTool = {
9
10
  name: "payware_products_create_product",
11
+ annotations: CREATES,
10
12
  description: `Create a new product for inventory management and payment processing.
11
13
 
12
14
  **Product Structure:**
@@ -134,8 +136,7 @@ export const createProductTool = {
134
136
  },
135
137
  privateKey: {
136
138
  type: "string",
137
- description: "RSA private key for authentication (uses environment-specific private key as default)",
138
- default: getPrivateKeySafe(true)
139
+ description: "RSA private key for authentication (uses environment-specific private key as default)"
139
140
  },
140
141
  useSandbox: {
141
142
  type: "boolean",
@@ -1,11 +1,13 @@
1
1
  import { deleteProduct } from '../../shared/products/products-api.js';
2
2
  import { getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
3
+ import { CHANGES } from '../../shared/tool-annotations.js';
3
4
 
4
5
  /**
5
6
  * Delete product tool implementation for merchants
6
7
  */
7
8
  export const deleteProductTool = {
8
9
  name: "payware_products_delete_product",
10
+ annotations: CHANGES,
9
11
  description: "Delete a product from the merchant account. This action cannot be undone.",
10
12
 
11
13
  inputSchema: {
@@ -23,8 +25,7 @@ export const deleteProductTool = {
23
25
  },
24
26
  privateKey: {
25
27
  type: "string",
26
- description: "RSA private key for authentication (uses environment-specific private key as default)",
27
- default: getPrivateKeySafe()
28
+ description: "RSA private key for authentication (uses environment-specific private key as default)"
28
29
  },
29
30
  useSandbox: {
30
31
  type: "boolean",
@@ -1,12 +1,14 @@
1
1
  import { getProductImage } from '../../shared/products/products-api.js';
2
2
  import { getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
3
3
  import { IMAGE_TYPES, IMAGE_FORMATS, QR_ERROR_CORRECTION, BARCODE_LOCATIONS } from '../../shared/products/products-api.js';
4
+ import { READS } from '../../shared/tool-annotations.js';
4
5
 
5
6
  /**
6
7
  * Get product image tool implementation for merchants
7
8
  */
8
9
  export const getProductImageTool = {
9
10
  name: "payware_products_get_product_image",
11
+ annotations: READS,
10
12
  description: `Generate a QR code or barcode image for a product.
11
13
 
12
14
  **QR Code Options:** Format, border, error correction, scale, version
@@ -102,8 +104,7 @@ export const getProductImageTool = {
102
104
  },
103
105
  privateKey: {
104
106
  type: "string",
105
- description: "RSA private key for authentication (uses environment-specific private key as default)",
106
- default: getPrivateKeySafe()
107
+ description: "RSA private key for authentication (uses environment-specific private key as default)"
107
108
  },
108
109
  useSandbox: {
109
110
  type: "boolean",
@@ -1,11 +1,13 @@
1
1
  import { getProduct } from '../../shared/products/products-api.js';
2
2
  import { getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
3
+ import { READS } from '../../shared/tool-annotations.js';
3
4
 
4
5
  /**
5
6
  * Get product tool implementation for merchants
6
7
  */
7
8
  export const getProductTool = {
8
9
  name: "payware_products_get_product",
10
+ annotations: READS,
9
11
  description: "Get detailed information about a specific product by ID",
10
12
 
11
13
  inputSchema: {
@@ -23,8 +25,7 @@ export const getProductTool = {
23
25
  },
24
26
  privateKey: {
25
27
  type: "string",
26
- description: "RSA private key for authentication (uses environment-specific private key as default)",
27
- default: getPrivateKeySafe()
28
+ description: "RSA private key for authentication (uses environment-specific private key as default)"
28
29
  },
29
30
  useSandbox: {
30
31
  type: "boolean",
@@ -1,11 +1,13 @@
1
1
  import { getProducts } from '../../shared/products/products-api.js';
2
2
  import { getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
3
+ import { READS } from '../../shared/tool-annotations.js';
3
4
 
4
5
  /**
5
6
  * List products tool implementation for merchants
6
7
  */
7
8
  export const listProductsTool = {
8
9
  name: "payware_products_list_products",
10
+ annotations: READS,
9
11
  description: "Get a list of all products for the merchant account",
10
12
 
11
13
  inputSchema: {
@@ -18,8 +20,7 @@ export const listProductsTool = {
18
20
  },
19
21
  privateKey: {
20
22
  type: "string",
21
- description: "RSA private key for authentication (uses environment-specific private key as default)",
22
- default: getPrivateKeySafe()
23
+ description: "RSA private key for authentication (uses environment-specific private key as default)"
23
24
  },
24
25
  useSandbox: {
25
26
  type: "boolean",
@@ -7,12 +7,14 @@ import {
7
7
  } from '../../shared/products/products-api.js';
8
8
  import { getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
9
9
  import { PRICE_CORRECTION_TYPES, CORRECTION_TYPES } from '../../shared/products/products-api.js';
10
+ import { CHANGES, CREATES, READS } from '../../shared/tool-annotations.js';
10
11
 
11
12
  /**
12
13
  * Create price schedule tool implementation for merchants
13
14
  */
14
15
  export const createScheduleTool = {
15
16
  name: "payware_products_create_schedule",
17
+ annotations: CREATES,
16
18
  description: "Create a price schedule for a product to manage time-based pricing",
17
19
 
18
20
  inputSchema: {
@@ -62,8 +64,7 @@ export const createScheduleTool = {
62
64
  },
63
65
  privateKey: {
64
66
  type: "string",
65
- description: "RSA private key for authentication (uses environment-specific private key as default)",
66
- default: getPrivateKeySafe()
67
+ description: "RSA private key for authentication (uses environment-specific private key as default)"
67
68
  },
68
69
  useSandbox: {
69
70
  type: "boolean",
@@ -174,6 +175,7 @@ ${JSON.stringify(schedule, null, 2)}
174
175
  */
175
176
  export const getSchedulesTool = {
176
177
  name: "payware_products_get_schedules",
178
+ annotations: READS,
177
179
  description: "Get all price schedules for a product",
178
180
 
179
181
  inputSchema: {
@@ -191,8 +193,7 @@ export const getSchedulesTool = {
191
193
  },
192
194
  privateKey: {
193
195
  type: "string",
194
- description: "RSA private key for authentication (uses environment-specific private key as default)",
195
- default: getPrivateKeySafe()
196
+ description: "RSA private key for authentication (uses environment-specific private key as default)"
196
197
  },
197
198
  useSandbox: {
198
199
  type: "boolean",
@@ -286,6 +287,7 @@ ${schedulesList}
286
287
  */
287
288
  export const getScheduleTool = {
288
289
  name: "payware_products_get_schedule",
290
+ annotations: READS,
289
291
  description: "Get detailed information about a specific price schedule",
290
292
 
291
293
  inputSchema: {
@@ -307,8 +309,7 @@ export const getScheduleTool = {
307
309
  },
308
310
  privateKey: {
309
311
  type: "string",
310
- description: "RSA private key for authentication (uses environment-specific private key as default)",
311
- default: getPrivateKeySafe()
312
+ description: "RSA private key for authentication (uses environment-specific private key as default)"
312
313
  },
313
314
  useSandbox: {
314
315
  type: "boolean",
@@ -399,6 +400,7 @@ ${JSON.stringify(schedule, null, 2)}
399
400
  */
400
401
  export const updateScheduleTool = {
401
402
  name: "payware_products_update_schedule",
403
+ annotations: CHANGES,
402
404
  description: "Update an existing price schedule. Only provide fields you want to change.",
403
405
 
404
406
  inputSchema: {
@@ -449,8 +451,7 @@ export const updateScheduleTool = {
449
451
  },
450
452
  privateKey: {
451
453
  type: "string",
452
- description: "RSA private key for authentication (uses environment-specific private key as default)",
453
- default: getPrivateKeySafe()
454
+ description: "RSA private key for authentication (uses environment-specific private key as default)"
454
455
  },
455
456
  useSandbox: {
456
457
  type: "boolean",
@@ -547,6 +548,7 @@ ${JSON.stringify(schedule, null, 2)}
547
548
  */
548
549
  export const deleteScheduleTool = {
549
550
  name: "payware_products_delete_schedule",
551
+ annotations: CHANGES,
550
552
  description: "Delete a price schedule. This action cannot be undone.",
551
553
 
552
554
  inputSchema: {
@@ -568,8 +570,7 @@ export const deleteScheduleTool = {
568
570
  },
569
571
  privateKey: {
570
572
  type: "string",
571
- description: "RSA private key for authentication (uses environment-specific private key as default)",
572
- default: getPrivateKeySafe()
573
+ description: "RSA private key for authentication (uses environment-specific private key as default)"
573
574
  },
574
575
  useSandbox: {
575
576
  type: "boolean",
@@ -1,12 +1,14 @@
1
1
  import { updateProduct } from '../../shared/products/products-api.js';
2
2
  import { getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
3
3
  import { PRODUCT_TYPES, OVERLAP_PRIORITY } from '../../shared/products/products-api.js';
4
+ import { CHANGES } from '../../shared/tool-annotations.js';
4
5
 
5
6
  /**
6
7
  * Update product tool implementation for merchants
7
8
  */
8
9
  export const updateProductTool = {
9
10
  name: "payware_products_update_product",
11
+ annotations: CHANGES,
10
12
  description: `Update an existing product. Only provide the fields you want to change.
11
13
 
12
14
  **Product Structure:**
@@ -128,8 +130,7 @@ export const updateProductTool = {
128
130
  },
129
131
  privateKey: {
130
132
  type: "string",
131
- description: "RSA private key for authentication (uses environment-specific private key as default)",
132
- default: getPrivateKeySafe()
133
+ description: "RSA private key for authentication (uses environment-specific private key as default)"
133
134
  },
134
135
  useSandbox: {
135
136
  type: "boolean",
@@ -3,6 +3,7 @@ import { createJWTToken } from '../../core/auth/jwt-token.js';
3
3
  import { createMinimizedJSON } from '../../core/utils/json-serializer.js';
4
4
  import { getSandboxUrl, getProductionUrl, getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
5
5
  import { apiErrorResult } from '../../shared/api-errors.js';
6
+ import { CHANGES } from '../../shared/tool-annotations.js';
6
7
 
7
8
  /**
8
9
  * Cancel a transaction via payware API
@@ -76,6 +77,7 @@ export async function cancelTransaction({
76
77
  */
77
78
  export const cancelTransactionTool = {
78
79
  name: "payware_operations_cancel_transaction",
80
+ annotations: CHANGES,
79
81
  description: "Cancel an ACTIVE transaction created by this merchant. Only the merchant who created the transaction can cancel it, and only before it has been processed.",
80
82
  inputSchema: {
81
83
  type: "object",
@@ -104,8 +106,7 @@ export const cancelTransactionTool = {
104
106
  },
105
107
  privateKey: {
106
108
  type: "string",
107
- description: "RSA private key for JWT token creation. Can use PAYWARE_PRIVATE_KEY_PATH env var as default.",
108
- default: getPrivateKeySafe()
109
+ description: "RSA private key for JWT token creation. Can use PAYWARE_PRIVATE_KEY_PATH env var as default."
109
110
  },
110
111
  useSandbox: {
111
112
  type: "boolean",
@@ -2,6 +2,7 @@ import axios from 'axios';
2
2
  import { createJWTToken } from '../../core/auth/jwt-token.js';
3
3
  import { createMinimizedJSON } from '../../core/utils/json-serializer.js';
4
4
  import { getSandboxUrl, getProductionUrl, getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
5
+ import { CREATES } from '../../shared/tool-annotations.js';
5
6
 
6
7
  /**
7
8
  * Create a transaction via payware API
@@ -196,6 +197,7 @@ Original error: ${enhancedMessage}`;
196
197
  */
197
198
  export const createTransactionTool = {
198
199
  name: "payware_operations_create_transaction",
200
+ annotations: CREATES,
199
201
  description: `Create a new payware transaction. Parameters map to the following API structure:
200
202
 
201
203
  📋 **ROOT LEVEL** (Transaction metadata):
@@ -524,7 +526,7 @@ ${JSON.stringify(result.transaction, null, 2)}
524
526
 
525
527
  **Next Steps:**
526
528
  1. Save the transaction ID: \`${result.transaction.transactionId || 'N/A'}\`
527
- 2. Use \`payware_transactions_get_transaction_status\` to check status
529
+ 2. Use \`payware_operations_get_transaction_status\` to check status
528
530
  3. Wait for callback notification (if callback URL provided)
529
531
  4. Process payment through payware interface`
530
532
  }]
@@ -2,6 +2,7 @@ import axios from 'axios';
2
2
  import { createJWTToken } from '../../core/auth/jwt-token.js';
3
3
  import { getSandboxUrl, getProductionUrl, getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
4
4
  import { apiErrorResult } from '../../shared/api-errors.js';
5
+ import { READS } from '../../shared/tool-annotations.js';
5
6
 
6
7
  /**
7
8
  * Get transaction status from payware API
@@ -67,11 +68,12 @@ function formatTransactionStatus(transaction) {
67
68
  */
68
69
  export const getTransactionStatusTool = {
69
70
  name: "payware_operations_get_transaction_status",
71
+ annotations: READS,
70
72
  description: `Get status of an ACTIVE transaction by ID (for completed/expired transactions use transaction history tool).
71
73
 
72
74
  **Endpoint:** GET /transactions/{transactionId}
73
75
  **Use Case:** Check status of ACTIVE transactions only. This endpoint only returns transactions with ACTIVE status.
74
- **Note:** For transactions with final statuses (CONFIRMED, DECLINED, FAILED, EXPIRED, CANCELLED), use 'payware_transactions_get_history' instead.
76
+ **Note:** For transactions with final statuses (CONFIRMED, DECLINED, FAILED, EXPIRED, CANCELLED), use 'payware_operations_get_transaction_history' instead.
75
77
 
76
78
  🛍️ **Product-originated transactions carry a nested \`product\` object.** Since 2026-07-22 the
77
79
  presentation fields are grouped under \`product\` rather than sitting flat on the response - the old
@@ -123,8 +125,7 @@ with ERR_FEE_MISMATCH. Echo \`fee\` back unchanged instead.`,
123
125
  },
124
126
  privateKey: {
125
127
  type: "string",
126
- description: "RSA private key for JWT token creation. Can use PAYWARE_PRIVATE_KEY_PATH env var as default.",
127
- default: getPrivateKeySafe()
128
+ description: "RSA private key for JWT token creation. Can use PAYWARE_PRIVATE_KEY_PATH env var as default."
128
129
  },
129
130
  useSandbox: {
130
131
  type: "boolean",
@@ -3,6 +3,7 @@ import { createJWTToken } from '../../core/auth/jwt-token.js';
3
3
  import { createMinimizedJSON } from '../../core/utils/json-serializer.js';
4
4
  import { getSandboxUrl, getProductionUrl, getPartnerIdSafe, getPrivateKeySafe } from '../../config/env.js';
5
5
  import { apiErrorResult } from '../../shared/api-errors.js';
6
+ import { COMMITS } from '../../shared/tool-annotations.js';
6
7
 
7
8
  /**
8
9
  * Process a transaction via payware API (for merchants accepting payments)
@@ -107,6 +108,7 @@ export async function processTransaction({
107
108
  */
108
109
  export const processTransactionTool = {
109
110
  name: "payware_operations_process_transaction",
111
+ annotations: COMMITS,
110
112
  description: `Process a PEER transaction (for merchants accepting payments by scanning customer QR/barcode).
111
113
 
112
114
  **Use Case:** Merchant scans customer's payware QR code or barcode to accept payment.
@@ -138,8 +140,8 @@ export const processTransactionTool = {
138
140
  properties: {
139
141
  transactionId: {
140
142
  type: "string",
141
- description: "Transaction ID to process. Format: 2-char prefix + 8-char ID. Supports: 'pw' (standard), 'pr' (product), 'ps' (soundbite)",
142
- pattern: "^(pw|pr|ps)[0-9A-Za-z]{8}$"
143
+ description: "Transaction ID to process. Format: 2-char prefix + 8-char ID. Supports: 'pw' (standard), 'pr' (product), 'pl' (placement: pays as its product, and the payment is attributed to the placement), 'ps' (soundbite)",
144
+ pattern: "^(pw|pr|pl|ps)[0-9A-Za-z]{8}$"
143
145
  },
144
146
  amount: {
145
147
  type: ["number", "string"],
@@ -207,8 +209,7 @@ export const processTransactionTool = {
207
209
  },
208
210
  privateKey: {
209
211
  type: "string",
210
- description: "RSA private key for JWT token creation. Can use PAYWARE_PRIVATE_KEY_PATH env var as default.",
211
- default: getPrivateKeySafe()
212
+ description: "RSA private key for JWT token creation. Can use PAYWARE_PRIVATE_KEY_PATH env var as default."
212
213
  },
213
214
  useSandbox: {
214
215
  type: "boolean",