@felipechavaa/pulse-mcp-server 1.0.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.
- package/README.md +201 -0
- package/dist/index.js +75 -0
- package/dist/tools/pulse-api/hospitality/cancel-transaction-hospitality.js +54 -0
- package/dist/tools/pulse-api/hospitality/cancel-transaction-item-hospitality.js +50 -0
- package/dist/tools/pulse-api/hospitality/hold-transaction-hospitality.js +51 -0
- package/dist/tools/pulse-api/hospitality/lookup-quote-hospitality.js +55 -0
- package/dist/tools/pulse-api/hospitality/lookup-sale-hospitality.js +56 -0
- package/dist/tools/pulse-api/hospitality/new-payment-hospitality.js +57 -0
- package/dist/tools/pulse-api/hospitality/new-quote-hospitality.js +79 -0
- package/dist/tools/pulse-api/hospitality/new-sale-hospitality.js +83 -0
- package/dist/tools/pulse-api/hospitality/update-customer-details-hospitality.js +58 -0
- package/dist/tools/pulse-api/hospitality/update-customers-hospitality.js +71 -0
- package/dist/tools/pulse-api/hospitality/update-event-date-hospitality.js +62 -0
- package/dist/tools/pulse-api/hospitality/update-quote-hospitality.js +88 -0
- package/dist/tools/pulse-api/hospitality/update-sale-hospitality.js +82 -0
- package/dist/tools/pulse-api/hospitality/update-sale-items-hospitality.js +63 -0
- package/dist/tools/pulse-api/hospitality/update-sale-status-hospitality.js +58 -0
- package/dist/tools/pulse-api/hospitality/update-transaction-item-status-hospitality.js +56 -0
- package/dist/tools/pulse-api/hospitality/update-transaction-items-hospitality.js +56 -0
- package/dist/tools/pulse-api/hospitality/update-transaction-status-hospitality.js +55 -0
- package/dist/tools/pulse-react/pulse-react.content.js +48 -0
- package/dist/tools/pulse-react/pulse-react.install.js +56 -0
- package/dist/tools/pulse-react/pulse-react.quote.js +46 -0
- package/dist/tools/pulse-react/pulse-react.sale.js +73 -0
- package/dist/tools/pulse-widget/pulse-widget-installation.js +40 -0
- package/dist/tools/pulse-widget/pulse-widget-render.js +36 -0
- package/dist/types/toolResponse.js +1 -0
- package/package.json +39 -0
package/README.md
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
# Pulse MCP Server
|
|
2
|
+
|
|
3
|
+
A Model Context Protocol (MCP) server that provides comprehensive tools for integrating Refund Protect's Pulse platform across different implementation approaches - React components, JavaScript widgets, and direct API integration.
|
|
4
|
+
|
|
5
|
+
**Created and maintained by the Protect Group Tech Team.**
|
|
6
|
+
|
|
7
|
+
## What is Model Context Protocol (MCP)
|
|
8
|
+
|
|
9
|
+
Model Context Protocol (MCP) is an open standard that enables AI assistants to securely connect to external data sources and tools. It provides a standardized way for AI models to access and interact with various systems.
|
|
10
|
+
|
|
11
|
+
MCP servers act as intermediaries that expose specific functionalities to AI assistants through a well-defined protocol, allowing for seamless integration of external tools and data sources into AI workflows.
|
|
12
|
+
|
|
13
|
+
## Important Notice
|
|
14
|
+
|
|
15
|
+
**This MCP server generates code for guidance and understanding purposes only. The generated code is NOT production-ready and should not be used directly in production environments.**
|
|
16
|
+
|
|
17
|
+
All partners and developers must:
|
|
18
|
+
|
|
19
|
+
- Follow the official Pulse integration documentation for production implementations
|
|
20
|
+
- Work with the Protect Group partnership team for proper integration support
|
|
21
|
+
- Validate all generated code against official documentation before implementation
|
|
22
|
+
|
|
23
|
+
**Official Documentation:**
|
|
24
|
+
- [Pulse Widget Integration Guide](https://integration.protectgroup.com/guide/public/pulse-widget)
|
|
25
|
+
- [Pulse React Integration Guide](https://integration.protectgroup.com/guide/public/pulse-react)
|
|
26
|
+
- [Pulse API Documentation](https://integration.protectgroup.com/guide/api/dp)
|
|
27
|
+
|
|
28
|
+
For partnership support and production guidance, contact the Protect Group partnership team.
|
|
29
|
+
|
|
30
|
+
## Configure Pulse MCP in your AI client
|
|
31
|
+
|
|
32
|
+
Pulse MCP server is compatible with various AI development environments. Each platform provides unique benefits for Pulse platform integration.
|
|
33
|
+
|
|
34
|
+
### VS Code
|
|
35
|
+
|
|
36
|
+
VS Code integration works through compatible extensions and MCP-enabled AI tools.
|
|
37
|
+
|
|
38
|
+
**Configuration:**
|
|
39
|
+
|
|
40
|
+
1. Install VS Code and relevant AI extensions (GitHub Copilot, etc.)
|
|
41
|
+
2. Add Pulse MCP server to your workspace (.vscode/mcp.json)
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"servers": {
|
|
45
|
+
"pulse-mcp-server": {
|
|
46
|
+
"command": "npx",
|
|
47
|
+
"args": [
|
|
48
|
+
"-y",
|
|
49
|
+
"@abelpenton_dev/pulse-mcp-server"
|
|
50
|
+
],
|
|
51
|
+
"type": "stdio"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
### Claude Desktop
|
|
59
|
+
|
|
60
|
+
Claude Desktop provides conversational AI assistance with full MCP integration.
|
|
61
|
+
|
|
62
|
+
**Configuration:**
|
|
63
|
+
|
|
64
|
+
1. Download and install Claude Desktop
|
|
65
|
+
2. Open Claude Desktop and go to Settings
|
|
66
|
+
3. Navigate to the Developer section
|
|
67
|
+
4. Click "Edit Config" to open `claude_desktop_config.json`
|
|
68
|
+
5. Add the Pulse MCP server configuration:
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"mcpServers": {
|
|
73
|
+
"pulse-mcp-server": {
|
|
74
|
+
"command": "npx",
|
|
75
|
+
"args": [
|
|
76
|
+
"-y",
|
|
77
|
+
"@abelpenton_dev/pulse-mcp-server"
|
|
78
|
+
],
|
|
79
|
+
"type": "stdio"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
6. Restart Claude Desktop
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
### Cursor
|
|
89
|
+
|
|
90
|
+
Cursor IDE integrates MCP servers directly into your development workflow for contextual code assistance.
|
|
91
|
+
|
|
92
|
+
**Configuration:**
|
|
93
|
+
|
|
94
|
+
1. Download and install Cursor IDE
|
|
95
|
+
2. Open Cursor and navigate to MCP Settings
|
|
96
|
+
3. Click "Add new global MCP Server"
|
|
97
|
+
4. Add the configuration to your `mcp.json` file:
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"mcpServers": {
|
|
102
|
+
"pulse-mcp-server": {
|
|
103
|
+
"command": "npx",
|
|
104
|
+
"args": ["-y", "@abelpenton_dev/pulse-mcp-server"]
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
5. Open the chat interface with `Ctrl + I` (or `Cmd + I` on Mac)
|
|
111
|
+
|
|
112
|
+
### Other MCP-compatible Clients
|
|
113
|
+
|
|
114
|
+
Any application supporting the Model Context Protocol can utilize this server:
|
|
115
|
+
|
|
116
|
+
- **Windsurf by Codeium**: Similar setup to Cursor with MCP configuration
|
|
117
|
+
|
|
118
|
+
## Local Development
|
|
119
|
+
|
|
120
|
+
### Running with Inspector
|
|
121
|
+
|
|
122
|
+
For local development and testing, you can run the MCP server with the official inspector:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# Run with inspector for testing and debugging
|
|
126
|
+
npx @modelcontextprotocol/inspector @abelpenton_dev/pulse-mcp-server
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
The inspector provides a web interface for testing MCP server functionality and exploring available tools.
|
|
130
|
+
|
|
131
|
+
## Available Tools
|
|
132
|
+
|
|
133
|
+
### Pulse React
|
|
134
|
+
|
|
135
|
+
Modern React component integration for seamless checkout experiences.
|
|
136
|
+
|
|
137
|
+
**Prompts Examples:**
|
|
138
|
+
|
|
139
|
+
- **Install and implement pulse react component in my checkout page**
|
|
140
|
+
- Generates complete installation instructions and React component setup
|
|
141
|
+
- Includes RefundableProvider configuration and context setup
|
|
142
|
+
- Provides TypeScript-ready implementation examples
|
|
143
|
+
|
|
144
|
+
- **Generate code for Quote call in pulse react**
|
|
145
|
+
- Creates code for updating quote data when internal application state changes
|
|
146
|
+
- Handles quote synchronization with Pulse platform
|
|
147
|
+
- Includes proper error handling and state management
|
|
148
|
+
|
|
149
|
+
- **Write sale using pulse react component**
|
|
150
|
+
- Implements sale functionality using the useRefundableActions hook
|
|
151
|
+
- Provides complete transaction handling code
|
|
152
|
+
- Includes best practices for error handling and user feedback
|
|
153
|
+
|
|
154
|
+
### Pulse Widget
|
|
155
|
+
|
|
156
|
+
JavaScript widget integration for universal compatibility across platforms.
|
|
157
|
+
|
|
158
|
+
**Prompts Examples:**
|
|
159
|
+
|
|
160
|
+
- **Install and configure pulse widget in my checkout page**
|
|
161
|
+
- Generates JavaScript integration code for any web platform
|
|
162
|
+
- Includes CDN links and initialization scripts
|
|
163
|
+
- Provides configuration options and customization examples
|
|
164
|
+
|
|
165
|
+
- **Render content for pulse widget**
|
|
166
|
+
- Creates code for dynamic widget rendering
|
|
167
|
+
- Handles various display configurations and styling options
|
|
168
|
+
- Includes responsive design considerations
|
|
169
|
+
|
|
170
|
+
### Pulse API
|
|
171
|
+
|
|
172
|
+
Direct API integration tools supporting multiple programming languages and frameworks.
|
|
173
|
+
|
|
174
|
+
**Prompts Examples:**
|
|
175
|
+
|
|
176
|
+
- **Implement a service in C# to support Protect Pulse API**
|
|
177
|
+
- Generate Services and basic models for Quote and Sale operations
|
|
178
|
+
|
|
179
|
+
- **Implement a service in JS for pulse API hospitality**
|
|
180
|
+
- Creates Node.js service implementations for Protect Group Pulse API integration
|
|
181
|
+
|
|
182
|
+
- **Implement a service in Go for pulse API hospitality**
|
|
183
|
+
- Generates Go service structs and methods for Protect Group Pulse API integration
|
|
184
|
+
- Includes proper error handling and JSON marshaling
|
|
185
|
+
- Provides HTTP client setup and request/response handling
|
|
186
|
+
|
|
187
|
+
- **Implement a service in Python for pulse API hospitality**
|
|
188
|
+
- Creates Python service classes for Protect Group Pulse API integration
|
|
189
|
+
- Provides both asynchronous implementations
|
|
190
|
+
|
|
191
|
+
## Code examples generated with the MCP
|
|
192
|
+
|
|
193
|
+
For comprehensive examples and sample implementations generated using this MCP server, visit:
|
|
194
|
+
|
|
195
|
+
[Pulse Implementation Examples](https://github.com/abelpenton/pg-pulse-examples)
|
|
196
|
+
|
|
197
|
+
This repository contains practical examples showcasing different integration approaches and implementation patterns for the Pulse platform.
|
|
198
|
+
|
|
199
|
+
## Support
|
|
200
|
+
|
|
201
|
+
This MCP server is designed to streamline Pulse platform integration across different technology stacks and implementation approaches.
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { pulseWidgetInstallation } from "./tools/pulse-widget/pulse-widget-installation.js";
|
|
5
|
+
import { pulseWidgetRender } from "./tools/pulse-widget/pulse-widget-render.js";
|
|
6
|
+
import { pulseReactInstallationTool } from "./tools/pulse-react/pulse-react.install.js";
|
|
7
|
+
import { pulseReactContentTool } from "./tools/pulse-react/pulse-react.content.js";
|
|
8
|
+
import { pulseReactSaleTool } from "./tools/pulse-react/pulse-react.sale.js";
|
|
9
|
+
import { pulseReactUpdateQuoteTool } from "./tools/pulse-react/pulse-react.quote.js";
|
|
10
|
+
import { newQuoteHospitalityTool } from "./tools/pulse-api/hospitality/new-quote-hospitality.js";
|
|
11
|
+
import { lookupQuoteHospitalityTool } from "./tools/pulse-api/hospitality/lookup-quote-hospitality.js";
|
|
12
|
+
import { newSaleHospitalityTool } from "./tools/pulse-api/hospitality/new-sale-hospitality.js";
|
|
13
|
+
import { lookupSaleHospitalityTool } from "./tools/pulse-api/hospitality/lookup-sale-hospitality.js";
|
|
14
|
+
import { updateSaleHospitalityTool } from "./tools/pulse-api/hospitality/update-sale-hospitality.js";
|
|
15
|
+
import { cancelSaleHospitalityTool } from "./tools/pulse-api/hospitality/cancel-transaction-hospitality.js";
|
|
16
|
+
import { cancelSaleItemHospitalityTool } from "./tools/pulse-api/hospitality/cancel-transaction-item-hospitality.js";
|
|
17
|
+
import { updateEventDateHospitalityTool } from "./tools/pulse-api/hospitality/update-event-date-hospitality.js";
|
|
18
|
+
import { newPaymentHospitalityTool } from "./tools/pulse-api/hospitality/new-payment-hospitality.js";
|
|
19
|
+
import { updateCustomerDetailsHospitalityTool } from "./tools/pulse-api/hospitality/update-customer-details-hospitality.js";
|
|
20
|
+
import { updateTransactionStatusHospitalityTool } from "./tools/pulse-api/hospitality/update-transaction-status-hospitality.js";
|
|
21
|
+
import { updateTransactionItemStatusHospitalityTool } from "./tools/pulse-api/hospitality/update-transaction-item-status-hospitality.js";
|
|
22
|
+
import { holdTransactionHospitalityTool } from "./tools/pulse-api/hospitality/hold-transaction-hospitality.js";
|
|
23
|
+
import { updateTransactionItemsHospitalityTool } from "./tools/pulse-api/hospitality/update-transaction-items-hospitality.js";
|
|
24
|
+
const server = new McpServer({
|
|
25
|
+
name: "Pulse MCP Server",
|
|
26
|
+
version: "1.0.6"
|
|
27
|
+
});
|
|
28
|
+
//------ Pulse Widget Tools ------//
|
|
29
|
+
// Generate the code to install Pulse javascript widget
|
|
30
|
+
server.tool(pulseWidgetInstallation[0], pulseWidgetInstallation[1], pulseWidgetInstallation[2], pulseWidgetInstallation[3]);
|
|
31
|
+
// Generate the code to render Pulse javascript widget
|
|
32
|
+
server.tool(pulseWidgetRender[0], pulseWidgetRender[1], pulseWidgetRender[2], pulseWidgetRender[3]);
|
|
33
|
+
//------ End Pulse Widget Tools ------//
|
|
34
|
+
//------ Pulse React Tools ------//
|
|
35
|
+
// Generate the code to install Pulse React NPM package and configure RefundableProvider
|
|
36
|
+
server.tool(pulseReactInstallationTool[0], pulseReactInstallationTool[1], pulseReactInstallationTool[2], pulseReactInstallationTool[3]);
|
|
37
|
+
// Generate the code to render RefundableContent component
|
|
38
|
+
server.tool(pulseReactContentTool[0], pulseReactContentTool[1], pulseReactContentTool[2]);
|
|
39
|
+
// Generate the code to update quote data when internal state changes in your application
|
|
40
|
+
server.tool(pulseReactUpdateQuoteTool[0], pulseReactUpdateQuoteTool[1], pulseReactUpdateQuoteTool[2]);
|
|
41
|
+
// Generate the code to write sale using writeSale from useRefundableActions hook
|
|
42
|
+
server.tool(pulseReactSaleTool[0], pulseReactSaleTool[1], pulseReactSaleTool[2], pulseReactSaleTool[3]);
|
|
43
|
+
//------ End Pulse React Tools ------//
|
|
44
|
+
//------ Pulse API Tools ------//
|
|
45
|
+
// Create a new quote for hospitality using the Protect Group API
|
|
46
|
+
server.tool(newQuoteHospitalityTool[0], newQuoteHospitalityTool[1], newQuoteHospitalityTool[2], newQuoteHospitalityTool[3]);
|
|
47
|
+
// Lookup a quote in the Protect Group API
|
|
48
|
+
server.tool(lookupQuoteHospitalityTool[0], lookupQuoteHospitalityTool[1], lookupQuoteHospitalityTool[2], lookupQuoteHospitalityTool[3]);
|
|
49
|
+
// Create a new sale for hospitality using the Protect Group API
|
|
50
|
+
server.tool(newSaleHospitalityTool[0], newSaleHospitalityTool[1], newSaleHospitalityTool[2], newSaleHospitalityTool[3]);
|
|
51
|
+
// Lookup a sale in the Protect Group API
|
|
52
|
+
server.tool(lookupSaleHospitalityTool[0], lookupSaleHospitalityTool[1], lookupSaleHospitalityTool[2], lookupSaleHospitalityTool[3]);
|
|
53
|
+
// Update a sale in the Protect Group API
|
|
54
|
+
server.tool(updateSaleHospitalityTool[0], updateSaleHospitalityTool[1], updateSaleHospitalityTool[2], updateSaleHospitalityTool[3]);
|
|
55
|
+
// Cancel a sale with Protect Group
|
|
56
|
+
server.tool(cancelSaleHospitalityTool[0], cancelSaleHospitalityTool[1], cancelSaleHospitalityTool[2], cancelSaleHospitalityTool[3]);
|
|
57
|
+
// Cancel a specific item within a sale
|
|
58
|
+
server.tool(cancelSaleItemHospitalityTool[0], cancelSaleItemHospitalityTool[1], cancelSaleItemHospitalityTool[2], cancelSaleItemHospitalityTool[3]);
|
|
59
|
+
// Update the event date on a sale request
|
|
60
|
+
server.tool(updateEventDateHospitalityTool[0], updateEventDateHospitalityTool[1], updateEventDateHospitalityTool[2], updateEventDateHospitalityTool[3]);
|
|
61
|
+
// Create a new payment for a sale
|
|
62
|
+
server.tool(newPaymentHospitalityTool[0], newPaymentHospitalityTool[1], newPaymentHospitalityTool[2], newPaymentHospitalityTool[3]);
|
|
63
|
+
// Update customer details on a sale
|
|
64
|
+
server.tool(updateCustomerDetailsHospitalityTool[0], updateCustomerDetailsHospitalityTool[1], updateCustomerDetailsHospitalityTool[2], updateCustomerDetailsHospitalityTool[3]);
|
|
65
|
+
// Update the status of a transaction
|
|
66
|
+
server.tool(updateTransactionStatusHospitalityTool[0], updateTransactionStatusHospitalityTool[1], updateTransactionStatusHospitalityTool[2], updateTransactionStatusHospitalityTool[3]);
|
|
67
|
+
// Update the status of a specific item within a transaction
|
|
68
|
+
server.tool(updateTransactionItemStatusHospitalityTool[0], updateTransactionItemStatusHospitalityTool[1], updateTransactionItemStatusHospitalityTool[2], updateTransactionItemStatusHospitalityTool[3]);
|
|
69
|
+
// Put a transaction on hold
|
|
70
|
+
server.tool(holdTransactionHospitalityTool[0], holdTransactionHospitalityTool[1], holdTransactionHospitalityTool[2], holdTransactionHospitalityTool[3]);
|
|
71
|
+
// Update items within a transaction
|
|
72
|
+
server.tool(updateTransactionItemsHospitalityTool[0], updateTransactionItemsHospitalityTool[1], updateTransactionItemsHospitalityTool[2], updateTransactionItemsHospitalityTool[3]);
|
|
73
|
+
//------ End Pulse API Tools ------//
|
|
74
|
+
const transport = new StdioServerTransport();
|
|
75
|
+
await server.connect(transport);
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const cancelSaleHospitalityTool = [
|
|
3
|
+
"pulse-api-cancel-sale-hospitality",
|
|
4
|
+
"This is the cancel sale API contract Protect Group Pulse API in hospitality vertical." +
|
|
5
|
+
"Use the tool to implements services in any programming language that can make HTTP requests." +
|
|
6
|
+
"Follow this API contract to create the services.",
|
|
7
|
+
{
|
|
8
|
+
saleId: z.string().describe("The ID of the sale to be canceled")
|
|
9
|
+
},
|
|
10
|
+
async ({ saleId }) => {
|
|
11
|
+
const baseUrl = 'https://api.protectgroup.com/test/dynamic/sale';
|
|
12
|
+
const clientId = ''; // will be provided by the user
|
|
13
|
+
const clientSecret = ''; // will be provided by the user
|
|
14
|
+
try {
|
|
15
|
+
// Construct the URL for the request
|
|
16
|
+
const url = `${baseUrl}/${saleId}`;
|
|
17
|
+
// Set up headers for the request
|
|
18
|
+
const headers = {
|
|
19
|
+
'x-pg-client-id': clientId,
|
|
20
|
+
'x-pg-client-secret': clientSecret,
|
|
21
|
+
'X-RefundProtect-VendorId': clientId
|
|
22
|
+
};
|
|
23
|
+
// Perform the fetch request
|
|
24
|
+
const response = await fetch(url, {
|
|
25
|
+
method: 'DELETE',
|
|
26
|
+
headers
|
|
27
|
+
});
|
|
28
|
+
// Check if the response was successful
|
|
29
|
+
if (!response.ok) {
|
|
30
|
+
const errorData = await response.json();
|
|
31
|
+
throw new Error(JSON.stringify(errorData));
|
|
32
|
+
}
|
|
33
|
+
// Return the response data
|
|
34
|
+
const data = await response.json();
|
|
35
|
+
const toolResponse = {
|
|
36
|
+
content: [{
|
|
37
|
+
type: "text",
|
|
38
|
+
text: JSON.stringify(data, null, 2)
|
|
39
|
+
}]
|
|
40
|
+
};
|
|
41
|
+
return toolResponse;
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
console.error('Error canceling transaction:', error);
|
|
45
|
+
const toolResponse = {
|
|
46
|
+
content: [{
|
|
47
|
+
type: "text",
|
|
48
|
+
text: `Error canceling transaction: ${error instanceof Error ? error.message : JSON.stringify(error)}`
|
|
49
|
+
}]
|
|
50
|
+
};
|
|
51
|
+
return toolResponse;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
];
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const cancelSaleItemHospitalityTool = [
|
|
3
|
+
"pulse-api-cancel-sale-item-hospitality",
|
|
4
|
+
"This is the cancel sale item API contract Protect Group Pulse API in hospitality vertical." +
|
|
5
|
+
"Use the tool to implements services in any programming language that can make HTTP requests." +
|
|
6
|
+
"Follow this API contract to create the services.",
|
|
7
|
+
{
|
|
8
|
+
saleId: z.string().describe("The ID of the sale"),
|
|
9
|
+
reference: z.string().describe("The reference of the item to be canceled")
|
|
10
|
+
},
|
|
11
|
+
async ({ saleId, reference }) => {
|
|
12
|
+
const baseUrl = 'https://api.protectgroup.com/test/dynamic/sale';
|
|
13
|
+
const clientId = ''; // will be provided by the user
|
|
14
|
+
const clientSecret = ''; // will be provided by the user
|
|
15
|
+
try {
|
|
16
|
+
const url = `${baseUrl}/${saleId}/item/${reference}`;
|
|
17
|
+
const headers = {
|
|
18
|
+
'x-pg-client-id': clientId,
|
|
19
|
+
'x-pg-client-secret': clientSecret,
|
|
20
|
+
'X-RefundProtect-VendorId': clientId
|
|
21
|
+
};
|
|
22
|
+
const response = await fetch(url, {
|
|
23
|
+
method: 'DELETE',
|
|
24
|
+
headers
|
|
25
|
+
});
|
|
26
|
+
if (!response.ok) {
|
|
27
|
+
const errorData = await response.json();
|
|
28
|
+
throw new Error(JSON.stringify(errorData));
|
|
29
|
+
}
|
|
30
|
+
const data = await response.json();
|
|
31
|
+
const toolResponse = {
|
|
32
|
+
content: [{
|
|
33
|
+
type: "text",
|
|
34
|
+
text: JSON.stringify(data, null, 2)
|
|
35
|
+
}]
|
|
36
|
+
};
|
|
37
|
+
return toolResponse;
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
console.error('Error canceling transaction item:', error);
|
|
41
|
+
const toolResponse = {
|
|
42
|
+
content: [{
|
|
43
|
+
type: "text",
|
|
44
|
+
text: `Error canceling transaction item: ${error instanceof Error ? error.message : JSON.stringify(error)}`
|
|
45
|
+
}]
|
|
46
|
+
};
|
|
47
|
+
return toolResponse;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
];
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const holdTransactionHospitalityTool = [
|
|
3
|
+
"pulse-api-hold-transaction-hospitality",
|
|
4
|
+
"This is the hold transaction API contract Protect Group Pulse API in hospitality vertical." +
|
|
5
|
+
"Use the tool to implements services in any programming language that can make HTTP requests." +
|
|
6
|
+
"Follow this API contract to create the services.",
|
|
7
|
+
{
|
|
8
|
+
saleId: z.string().describe("The ID of the sale to put on hold"),
|
|
9
|
+
member: z.string().describe("Your client ID or the client ID of the client being represented")
|
|
10
|
+
},
|
|
11
|
+
async ({ saleId, member }) => {
|
|
12
|
+
const baseUrl = 'https://api.protectgroup.com/test/dynamic/sale';
|
|
13
|
+
const clientId = ''; // will be provided by the user
|
|
14
|
+
const clientSecret = ''; // will be provided by the user
|
|
15
|
+
const body = { member };
|
|
16
|
+
try {
|
|
17
|
+
const url = `${baseUrl}/${saleId}/hold`;
|
|
18
|
+
const response = await fetch(url, {
|
|
19
|
+
method: 'PUT',
|
|
20
|
+
headers: {
|
|
21
|
+
'x-pg-client-id': clientId,
|
|
22
|
+
'x-pg-client-secret': clientSecret,
|
|
23
|
+
'Content-Type': 'application/json'
|
|
24
|
+
},
|
|
25
|
+
body: JSON.stringify(body)
|
|
26
|
+
});
|
|
27
|
+
if (!response.ok) {
|
|
28
|
+
const errorData = await response.json();
|
|
29
|
+
throw new Error(JSON.stringify(errorData));
|
|
30
|
+
}
|
|
31
|
+
const data = await response.json();
|
|
32
|
+
const toolResponse = {
|
|
33
|
+
content: [{
|
|
34
|
+
type: "text",
|
|
35
|
+
text: JSON.stringify(data, null, 2)
|
|
36
|
+
}]
|
|
37
|
+
};
|
|
38
|
+
return toolResponse;
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
console.error('Error holding transaction:', error);
|
|
42
|
+
const toolResponse = {
|
|
43
|
+
content: [{
|
|
44
|
+
type: "text",
|
|
45
|
+
text: `Error holding transaction: ${error instanceof Error ? error.message : JSON.stringify(error)}`
|
|
46
|
+
}]
|
|
47
|
+
};
|
|
48
|
+
return toolResponse;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
];
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const lookupQuoteHospitalityTool = [
|
|
3
|
+
"pulse-api-lookup-quote-hospitality",
|
|
4
|
+
"This is the lookup quote API contract Protect Group Pulse API in hospitality vertical." +
|
|
5
|
+
"Use the tool to implements services in any programming language that can make HTTP requests." +
|
|
6
|
+
"Follow this API contract to create the services.",
|
|
7
|
+
{
|
|
8
|
+
quoteId: z.string().describe("The ID of the quote to lookup"),
|
|
9
|
+
member: z.string().describe("Your client ID or the client ID of the client being represented")
|
|
10
|
+
},
|
|
11
|
+
async ({ quoteId, member }) => {
|
|
12
|
+
const baseUrl = 'https://api.protectgroup.com/test/dynamic/quote';
|
|
13
|
+
const clientId = ''; // will be provided by the user
|
|
14
|
+
const clientSecret = ''; // will be provided by the user
|
|
15
|
+
try {
|
|
16
|
+
// Construct the URL for the request
|
|
17
|
+
const url = new URL(`${baseUrl}/${quoteId}`);
|
|
18
|
+
url.searchParams.append('member', member);
|
|
19
|
+
// Set up headers for the request
|
|
20
|
+
const headers = {
|
|
21
|
+
'x-pg-client-id': clientId,
|
|
22
|
+
'x-pg-client-secret': clientSecret
|
|
23
|
+
};
|
|
24
|
+
// Perform the fetch request
|
|
25
|
+
const response = await fetch(url.toString(), {
|
|
26
|
+
method: 'GET',
|
|
27
|
+
headers
|
|
28
|
+
});
|
|
29
|
+
// Check if the response was successful
|
|
30
|
+
if (!response.ok) {
|
|
31
|
+
const errorData = await response.json();
|
|
32
|
+
throw new Error(JSON.stringify(errorData));
|
|
33
|
+
}
|
|
34
|
+
// Parse and return the response data
|
|
35
|
+
const data = await response.json();
|
|
36
|
+
const toolResponse = {
|
|
37
|
+
content: [{
|
|
38
|
+
type: "text",
|
|
39
|
+
text: JSON.stringify(data, null, 2)
|
|
40
|
+
}]
|
|
41
|
+
};
|
|
42
|
+
return toolResponse;
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
console.error('Error looking up quote:', error);
|
|
46
|
+
const toolResponse = {
|
|
47
|
+
content: [{
|
|
48
|
+
type: "text",
|
|
49
|
+
text: `Error looking up quote: ${error instanceof Error ? error.message : JSON.stringify(error)}`
|
|
50
|
+
}]
|
|
51
|
+
};
|
|
52
|
+
return toolResponse;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
];
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const lookupSaleHospitalityTool = [
|
|
3
|
+
"pulse-api-lookup-sale-hospitality",
|
|
4
|
+
"This is the lookup sale API contract Protect Group Pulse API in hospitality vertical." +
|
|
5
|
+
"Use the tool to implements services in any programming language that can make HTTP requests." +
|
|
6
|
+
"Follow this API contract to create the services.",
|
|
7
|
+
{
|
|
8
|
+
saleId: z.string().describe("The ID of the sale to lookup"),
|
|
9
|
+
member: z.string().describe("Your client ID or the client ID of the client being represented")
|
|
10
|
+
},
|
|
11
|
+
async ({ saleId, member }) => {
|
|
12
|
+
const baseUrl = 'https://api.protectgroup.com/test/dynamic/sale';
|
|
13
|
+
const clientId = ''; // will be provided by the user
|
|
14
|
+
const clientSecret = ''; // will be provided by the user
|
|
15
|
+
try {
|
|
16
|
+
// Construct the URL with the saleId and query parameters
|
|
17
|
+
const url = new URL(`${baseUrl}/${saleId}`);
|
|
18
|
+
url.searchParams.append('member', member);
|
|
19
|
+
// Set up headers for the request
|
|
20
|
+
const headers = {
|
|
21
|
+
'x-pg-client-id': clientId,
|
|
22
|
+
'x-pg-client-secret': clientSecret,
|
|
23
|
+
'Content-Type': 'application/json'
|
|
24
|
+
};
|
|
25
|
+
// Perform the fetch request
|
|
26
|
+
const response = await fetch(url.toString(), {
|
|
27
|
+
method: 'GET',
|
|
28
|
+
headers
|
|
29
|
+
});
|
|
30
|
+
// Check if the response was successful
|
|
31
|
+
if (!response.ok) {
|
|
32
|
+
const errorData = await response.json();
|
|
33
|
+
throw new Error(JSON.stringify(errorData));
|
|
34
|
+
}
|
|
35
|
+
// Parse and return the response data
|
|
36
|
+
const data = await response.json();
|
|
37
|
+
const toolResponse = {
|
|
38
|
+
content: [{
|
|
39
|
+
type: "text",
|
|
40
|
+
text: JSON.stringify(data, null, 2)
|
|
41
|
+
}]
|
|
42
|
+
};
|
|
43
|
+
return toolResponse;
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
console.error('Error looking up transaction:', error);
|
|
47
|
+
const toolResponse = {
|
|
48
|
+
content: [{
|
|
49
|
+
type: "text",
|
|
50
|
+
text: `Error looking up transaction: ${error instanceof Error ? error.message : JSON.stringify(error)}`
|
|
51
|
+
}]
|
|
52
|
+
};
|
|
53
|
+
return toolResponse;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
];
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const newPaymentHospitalityTool = [
|
|
3
|
+
"pulse-api-create-new-payment-hospitality",
|
|
4
|
+
"This is the new payment API contract Protect Group Pulse API in hospitality vertical." +
|
|
5
|
+
"Use the tool to implements services in any programming language that can make HTTP requests." +
|
|
6
|
+
"Follow this API contract to create the services.",
|
|
7
|
+
{
|
|
8
|
+
member: z.string().describe("Your client ID or the client ID of the client being represented"),
|
|
9
|
+
saleId: z.string().describe("The ID of the sale to apply the payment to"),
|
|
10
|
+
paymentDate: z.string().describe("The date of the payment in ISO 8601 format"),
|
|
11
|
+
value: z.number().describe("The payment amount")
|
|
12
|
+
},
|
|
13
|
+
async ({ member, saleId, paymentDate, value }) => {
|
|
14
|
+
const url = 'https://api.protectgroup.com/test/dynamic/payment';
|
|
15
|
+
const clientId = ''; // will be provided by the user
|
|
16
|
+
const clientSecret = ''; // will be provided by the user
|
|
17
|
+
const body = {
|
|
18
|
+
member,
|
|
19
|
+
saleId,
|
|
20
|
+
paymentDate,
|
|
21
|
+
value
|
|
22
|
+
};
|
|
23
|
+
try {
|
|
24
|
+
const response = await fetch(url, {
|
|
25
|
+
method: 'POST',
|
|
26
|
+
headers: {
|
|
27
|
+
'x-pg-client-id': clientId,
|
|
28
|
+
'x-pg-client-secret': clientSecret,
|
|
29
|
+
'Content-Type': 'application/json'
|
|
30
|
+
},
|
|
31
|
+
body: JSON.stringify(body)
|
|
32
|
+
});
|
|
33
|
+
if (!response.ok) {
|
|
34
|
+
const errorData = await response.json();
|
|
35
|
+
throw new Error(JSON.stringify(errorData));
|
|
36
|
+
}
|
|
37
|
+
const data = await response.json();
|
|
38
|
+
const toolResponse = {
|
|
39
|
+
content: [{
|
|
40
|
+
type: "text",
|
|
41
|
+
text: JSON.stringify(data, null, 2)
|
|
42
|
+
}]
|
|
43
|
+
};
|
|
44
|
+
return toolResponse;
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
console.error('Error creating payment:', error);
|
|
48
|
+
const toolResponse = {
|
|
49
|
+
content: [{
|
|
50
|
+
type: "text",
|
|
51
|
+
text: `Error creating payment: ${error instanceof Error ? error.message : JSON.stringify(error)}`
|
|
52
|
+
}]
|
|
53
|
+
};
|
|
54
|
+
return toolResponse;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
];
|