@servicialo/mcp-server 0.1.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 +86 -0
- package/dist/client.d.ts +20 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +65 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +74 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/clients.d.ts +138 -0
- package/dist/tools/clients.d.ts.map +1 -0
- package/dist/tools/clients.js +58 -0
- package/dist/tools/clients.js.map +1 -0
- package/dist/tools/notifications.d.ts +34 -0
- package/dist/tools/notifications.d.ts.map +1 -0
- package/dist/tools/notifications.js +24 -0
- package/dist/tools/notifications.js.map +1 -0
- package/dist/tools/payments.d.ts +74 -0
- package/dist/tools/payments.d.ts.map +1 -0
- package/dist/tools/payments.js +59 -0
- package/dist/tools/payments.js.map +1 -0
- package/dist/tools/scheduling.d.ts +267 -0
- package/dist/tools/scheduling.d.ts.map +1 -0
- package/dist/tools/scheduling.js +81 -0
- package/dist/tools/scheduling.js.map +1 -0
- package/package.json +38 -0
package/README.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# @servicialo/mcp-server
|
|
2
|
+
|
|
3
|
+
MCP server for the [Servicialo](https://servicialo.com) protocol. Connects AI agents to professional services via the [Coordinalo](https://coordinalo.com) REST API.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx -y @servicialo/mcp-server
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### Claude Desktop Configuration
|
|
12
|
+
|
|
13
|
+
Add to your `claude_desktop_config.json`:
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{
|
|
17
|
+
"mcpServers": {
|
|
18
|
+
"servicialo": {
|
|
19
|
+
"command": "npx",
|
|
20
|
+
"args": ["-y", "@servicialo/mcp-server"],
|
|
21
|
+
"env": {
|
|
22
|
+
"SERVICIALO_API_KEY": "your_api_key",
|
|
23
|
+
"SERVICIALO_ORG_ID": "your_org_id"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Environment Variables
|
|
31
|
+
|
|
32
|
+
| Variable | Required | Description |
|
|
33
|
+
|---|---|---|
|
|
34
|
+
| `SERVICIALO_API_KEY` | Yes | Bearer token for the Coordinalo API |
|
|
35
|
+
| `SERVICIALO_ORG_ID` | Yes | Organization slug (e.g., `mamapro`) |
|
|
36
|
+
| `SERVICIALO_BASE_URL` | No | API base URL (default: `https://coordinalo.com`) |
|
|
37
|
+
|
|
38
|
+
## Available Tools (11)
|
|
39
|
+
|
|
40
|
+
### Scheduling (4)
|
|
41
|
+
|
|
42
|
+
| Tool | Description |
|
|
43
|
+
|---|---|
|
|
44
|
+
| `scheduling.check_availability` | Check available slots for a provider/service in a date range |
|
|
45
|
+
| `scheduling.book` | Book a new session |
|
|
46
|
+
| `scheduling.reschedule` | Reschedule an existing session |
|
|
47
|
+
| `scheduling.cancel` | Cancel a session |
|
|
48
|
+
|
|
49
|
+
### Clients (3)
|
|
50
|
+
|
|
51
|
+
| Tool | Description |
|
|
52
|
+
|---|---|
|
|
53
|
+
| `clients.list` | List clients with search and pagination |
|
|
54
|
+
| `clients.get` | Get client details with stats |
|
|
55
|
+
| `clients.create` | Create a new client |
|
|
56
|
+
|
|
57
|
+
### Payments (3)
|
|
58
|
+
|
|
59
|
+
| Tool | Description |
|
|
60
|
+
|---|---|
|
|
61
|
+
| `payments.get_balance` | Get client balance (available sessions, pending amount) |
|
|
62
|
+
| `payments.charge` | Create a sale/charge for a service |
|
|
63
|
+
| `payments.record` | Record a payment received against a sale |
|
|
64
|
+
|
|
65
|
+
### Notifications (1)
|
|
66
|
+
|
|
67
|
+
| Tool | Description |
|
|
68
|
+
|---|---|
|
|
69
|
+
| `notifications.send` | Send a notification to a client (reminder, confirmation, etc.) |
|
|
70
|
+
|
|
71
|
+
## Development
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# Install dependencies
|
|
75
|
+
npm install
|
|
76
|
+
|
|
77
|
+
# Build
|
|
78
|
+
npm run build
|
|
79
|
+
|
|
80
|
+
# Watch mode
|
|
81
|
+
npm run dev
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## License
|
|
85
|
+
|
|
86
|
+
MIT
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP client for Coordinalo REST API.
|
|
3
|
+
* Wraps native fetch with auth headers and base URL.
|
|
4
|
+
*/
|
|
5
|
+
export interface ClientConfig {
|
|
6
|
+
baseUrl: string;
|
|
7
|
+
apiKey: string;
|
|
8
|
+
orgId: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class CoordinaloClient {
|
|
11
|
+
private baseUrl;
|
|
12
|
+
private apiKey;
|
|
13
|
+
private orgId;
|
|
14
|
+
constructor(config: ClientConfig);
|
|
15
|
+
private headers;
|
|
16
|
+
get(path: string, params?: Record<string, string | number | undefined>): Promise<unknown>;
|
|
17
|
+
post(path: string, body?: unknown): Promise<unknown>;
|
|
18
|
+
put(path: string, body?: unknown): Promise<unknown>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,KAAK,CAAS;gBAEV,MAAM,EAAE,YAAY;IAMhC,OAAO,CAAC,OAAO;IAQT,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAuBzF,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAepD,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;CAc1D"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP client for Coordinalo REST API.
|
|
3
|
+
* Wraps native fetch with auth headers and base URL.
|
|
4
|
+
*/
|
|
5
|
+
export class CoordinaloClient {
|
|
6
|
+
baseUrl;
|
|
7
|
+
apiKey;
|
|
8
|
+
orgId;
|
|
9
|
+
constructor(config) {
|
|
10
|
+
this.baseUrl = config.baseUrl.replace(/\/+$/, '');
|
|
11
|
+
this.apiKey = config.apiKey;
|
|
12
|
+
this.orgId = config.orgId;
|
|
13
|
+
}
|
|
14
|
+
headers() {
|
|
15
|
+
return {
|
|
16
|
+
'Authorization': `Bearer ${this.apiKey}`,
|
|
17
|
+
'Content-Type': 'application/json',
|
|
18
|
+
'X-Org-Id': this.orgId,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
async get(path, params) {
|
|
22
|
+
const url = new URL(`${this.baseUrl}${path}`);
|
|
23
|
+
if (params) {
|
|
24
|
+
for (const [key, value] of Object.entries(params)) {
|
|
25
|
+
if (value !== undefined) {
|
|
26
|
+
url.searchParams.set(key, String(value));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const res = await fetch(url.toString(), {
|
|
31
|
+
method: 'GET',
|
|
32
|
+
headers: this.headers(),
|
|
33
|
+
});
|
|
34
|
+
if (!res.ok) {
|
|
35
|
+
const body = await res.text();
|
|
36
|
+
throw new Error(`GET ${path} failed (${res.status}): ${body}`);
|
|
37
|
+
}
|
|
38
|
+
return res.json();
|
|
39
|
+
}
|
|
40
|
+
async post(path, body) {
|
|
41
|
+
const res = await fetch(`${this.baseUrl}${path}`, {
|
|
42
|
+
method: 'POST',
|
|
43
|
+
headers: this.headers(),
|
|
44
|
+
body: body !== undefined ? JSON.stringify(body) : undefined,
|
|
45
|
+
});
|
|
46
|
+
if (!res.ok) {
|
|
47
|
+
const text = await res.text();
|
|
48
|
+
throw new Error(`POST ${path} failed (${res.status}): ${text}`);
|
|
49
|
+
}
|
|
50
|
+
return res.json();
|
|
51
|
+
}
|
|
52
|
+
async put(path, body) {
|
|
53
|
+
const res = await fetch(`${this.baseUrl}${path}`, {
|
|
54
|
+
method: 'PUT',
|
|
55
|
+
headers: this.headers(),
|
|
56
|
+
body: body !== undefined ? JSON.stringify(body) : undefined,
|
|
57
|
+
});
|
|
58
|
+
if (!res.ok) {
|
|
59
|
+
const text = await res.text();
|
|
60
|
+
throw new Error(`PUT ${path} failed (${res.status}): ${text}`);
|
|
61
|
+
}
|
|
62
|
+
return res.json();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,MAAM,OAAO,gBAAgB;IACnB,OAAO,CAAS;IAChB,MAAM,CAAS;IACf,KAAK,CAAS;IAEtB,YAAY,MAAoB;QAC9B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAClD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;IAC5B,CAA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AE;YACvB,IAAI,EAAE,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;SAC5D,CAAC,CAAC;QAEH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;YACZ,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,QAAQ,IAAI,YAAY,GAAG,CAAC,MAAM,MAAM,IAAI,EAAE,CAAC,CAAC;QAClE,CAAC;QAED,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;IACpB,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,IAAY,EAAE,IAAc;QACpC,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,OAAO,GAAG,IAAI,EAAE,EAAE;YAChD,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE;YACvB,IAAI,EAAE,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;SAC5D,CAAC,CAAC;QAEH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;YACZ,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,OAAO,IAAI,YAAY,GAAG,CAAC,MAAM,MAAM,IAAI,EAAE,CAAC,CAAC;QACjE,CAAC;QAED,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;IACpB,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
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 { CoordinaloClient } from './client.js';
|
|
5
|
+
import { schedulingTools } from './tools/scheduling.js';
|
|
6
|
+
import { clientsTools } from './tools/clients.js';
|
|
7
|
+
import { paymentsTools } from './tools/payments.js';
|
|
8
|
+
import { notificationsTools } from './tools/notifications.js';
|
|
9
|
+
// --- Validate env vars ---
|
|
10
|
+
const API_KEY = process.env.SERVICIALO_API_KEY;
|
|
11
|
+
const ORG_ID = process.env.SERVICIALO_ORG_ID;
|
|
12
|
+
const BASE_URL = process.env.SERVICIALO_BASE_URL || 'https://coordinalo.com';
|
|
13
|
+
if (!API_KEY) {
|
|
14
|
+
console.error('Error: SERVICIALO_API_KEY is required. Set it as an environment variable.');
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
if (!ORG_ID) {
|
|
18
|
+
console.error('Error: SERVICIALO_ORG_ID is required. Set it as an environment variable.');
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
// --- Init client ---
|
|
22
|
+
const apiClient = new CoordinaloClient({
|
|
23
|
+
baseUrl: BASE_URL,
|
|
24
|
+
apiKey: API_KEY,
|
|
25
|
+
orgId: ORG_ID,
|
|
26
|
+
});
|
|
27
|
+
// --- Init MCP server ---
|
|
28
|
+
const server = new McpServer({
|
|
29
|
+
name: 'servicialo',
|
|
30
|
+
version: '0.1.0',
|
|
31
|
+
});
|
|
32
|
+
const allTools = {
|
|
33
|
+
...schedulingTools,
|
|
34
|
+
...clientsTools,
|
|
35
|
+
...paymentsTools,
|
|
36
|
+
...notificationsTools,
|
|
37
|
+
};
|
|
38
|
+
for (const [name, tool] of Object.entries(allTools)) {
|
|
39
|
+
server.tool(name, tool.description, tool.schema.shape, async (args) => {
|
|
40
|
+
try {
|
|
41
|
+
const result = await tool.handler(apiClient, args);
|
|
42
|
+
return {
|
|
43
|
+
content: [
|
|
44
|
+
{
|
|
45
|
+
type: 'text',
|
|
46
|
+
text: JSON.stringify(result, null, 2),
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
53
|
+
return {
|
|
54
|
+
content: [
|
|
55
|
+
{
|
|
56
|
+
type: 'text',
|
|
57
|
+
text: `Error: ${message}`,
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
isError: true,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
// --- Connect via stdio ---
|
|
66
|
+
async function main() {
|
|
67
|
+
const transport = new StdioServerTransport();
|
|
68
|
+
await server.connect(transport);
|
|
69
|
+
}
|
|
70
|
+
main().catch((error) => {
|
|
71
|
+
console.error('Fatal error:', error);
|
|
72
|
+
process.exit(1);
|
|
73
|
+
});
|
|
74
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAG9D,4BAA4B;AAC5B,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;AAC/C,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;AAC7C,MAAM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tC;iBACF;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACvE,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,UAAU,OAAO,EAAE;qBAC1B;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC;AAED,4BAA4B;AAC5B,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { CoordinaloClient } from '../client.js';
|
|
3
|
+
declare const ActorSchema: z.ZodObject<{
|
|
4
|
+
type: z.ZodEnum<["client", "provider", "organization", "agent"]>;
|
|
5
|
+
id: z.ZodString;
|
|
6
|
+
on_behalf_of: z.ZodOptional<z.ZodObject<{
|
|
7
|
+
type: z.ZodString;
|
|
8
|
+
id: z.ZodString;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
type: string;
|
|
11
|
+
id: string;
|
|
12
|
+
}, {
|
|
13
|
+
type: string;
|
|
14
|
+
id: string;
|
|
15
|
+
}>>;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
type: "client" | "provider" | "organization" | "agent";
|
|
18
|
+
id: string;
|
|
19
|
+
on_behalf_of?: {
|
|
20
|
+
type: string;
|
|
21
|
+
id: string;
|
|
22
|
+
} | undefined;
|
|
23
|
+
}, {
|
|
24
|
+
type: "client" | "provider" | "organization" | "agent";
|
|
25
|
+
id: string;
|
|
26
|
+
on_behalf_of?: {
|
|
27
|
+
type: string;
|
|
28
|
+
id: string;
|
|
29
|
+
} | undefined;
|
|
30
|
+
}>;
|
|
31
|
+
export declare const clientsTools: {
|
|
32
|
+
'clients.list': {
|
|
33
|
+
description: string;
|
|
34
|
+
schema: z.ZodObject<{
|
|
35
|
+
search: z.ZodOptional<z.ZodString>;
|
|
36
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
37
|
+
page: z.ZodDefault<z.ZodNumber>;
|
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
|
39
|
+
limit: number;
|
|
40
|
+
page: number;
|
|
41
|
+
search?: string | undefined;
|
|
42
|
+
}, {
|
|
43
|
+
search?: string | undefined;
|
|
44
|
+
limit?: number | undefined;
|
|
45
|
+
page?: number | undefined;
|
|
46
|
+
}>;
|
|
47
|
+
handler: (client: CoordinaloClient, args: {
|
|
48
|
+
search?: string;
|
|
49
|
+
limit?: number;
|
|
50
|
+
page?: number;
|
|
51
|
+
}) => Promise<unknown>;
|
|
52
|
+
};
|
|
53
|
+
'clients.get': {
|
|
54
|
+
description: string;
|
|
55
|
+
schema: z.ZodObject<{
|
|
56
|
+
client_id: z.ZodString;
|
|
57
|
+
}, "strip", z.ZodTypeAny, {
|
|
58
|
+
client_id: string;
|
|
59
|
+
}, {
|
|
60
|
+
client_id: string;
|
|
61
|
+
}>;
|
|
62
|
+
handler: (client: CoordinaloClient, args: {
|
|
63
|
+
client_id: string;
|
|
64
|
+
}) => Promise<unknown>;
|
|
65
|
+
};
|
|
66
|
+
'clients.create': {
|
|
67
|
+
description: string;
|
|
68
|
+
schema: z.ZodObject<{
|
|
69
|
+
name: z.ZodString;
|
|
70
|
+
last_name: z.ZodString;
|
|
71
|
+
email: z.ZodOptional<z.ZodString>;
|
|
72
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
73
|
+
actor: z.ZodObject<{
|
|
74
|
+
type: z.ZodEnum<["client", "provider", "organization", "agent"]>;
|
|
75
|
+
id: z.ZodString;
|
|
76
|
+
on_behalf_of: z.ZodOptional<z.ZodObject<{
|
|
77
|
+
type: z.ZodString;
|
|
78
|
+
id: z.ZodString;
|
|
79
|
+
}, "strip", z.ZodTypeAny, {
|
|
80
|
+
type: string;
|
|
81
|
+
id: string;
|
|
82
|
+
}, {
|
|
83
|
+
type: string;
|
|
84
|
+
id: string;
|
|
85
|
+
}>>;
|
|
86
|
+
}, "strip", z.ZodTypeAny, {
|
|
87
|
+
type: "client" | "provider" | "organization" | "agent";
|
|
88
|
+
id: string;
|
|
89
|
+
on_behalf_of?: {
|
|
90
|
+
type: string;
|
|
91
|
+
id: string;
|
|
92
|
+
} | undefined;
|
|
93
|
+
}, {
|
|
94
|
+
type: "client" | "provider" | "organization" | "agent";
|
|
95
|
+
id: string;
|
|
96
|
+
on_behalf_of?: {
|
|
97
|
+
type: string;
|
|
98
|
+
id: string;
|
|
99
|
+
} | undefined;
|
|
100
|
+
}>;
|
|
101
|
+
}, "strip", z.ZodTypeAny, {
|
|
102
|
+
actor: {
|
|
103
|
+
type: "client" | "provider" | "organization" | "agent";
|
|
104
|
+
id: string;
|
|
105
|
+
on_behalf_of?: {
|
|
106
|
+
type: string;
|
|
107
|
+
id: string;
|
|
108
|
+
} | undefined;
|
|
109
|
+
};
|
|
110
|
+
name: string;
|
|
111
|
+
last_name: string;
|
|
112
|
+
email?: string | undefined;
|
|
113
|
+
phone?: string | undefined;
|
|
114
|
+
}, {
|
|
115
|
+
actor: {
|
|
116
|
+
type: "client" | "provider" | "organization" | "agent";
|
|
117
|
+
id: string;
|
|
118
|
+
on_behalf_of?: {
|
|
119
|
+
type: string;
|
|
120
|
+
id: string;
|
|
121
|
+
} | undefined;
|
|
122
|
+
};
|
|
123
|
+
name: string;
|
|
124
|
+
last_name: string;
|
|
125
|
+
email?: string | undefined;
|
|
126
|
+
phone?: string | undefined;
|
|
127
|
+
}>;
|
|
128
|
+
handler: (client: CoordinaloClient, args: {
|
|
129
|
+
name: string;
|
|
130
|
+
last_name: string;
|
|
131
|
+
email?: string;
|
|
132
|
+
phone?: string;
|
|
133
|
+
actor: z.infer<typeof ActorSchema>;
|
|
134
|
+
}) => Promise<unknown>;
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
export {};
|
|
138
|
+
//# sourceMappingURL=clients.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clients.d.ts","sourceRoot":"","sources":["../../src/tools/clients.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOf,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;0BAQG,gBAAgB,QAAQ;YAAE,MAAM,CAAC,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE;;;;;;;;;;;0BAe1E,gBAAgB,QAAQ;YAAE,SAAS,EAAE,MAAM,CAAA;SAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAe7C,gBAAgB,QAAQ;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,SAAS,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAA;SAAE;;CAW1J,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const ActorSchema = z.object({
|
|
3
|
+
type: z.enum(['client', 'provider', 'organization', 'agent']),
|
|
4
|
+
id: z.string(),
|
|
5
|
+
on_behalf_of: z.object({
|
|
6
|
+
type: z.string(),
|
|
7
|
+
id: z.string(),
|
|
8
|
+
}).optional(),
|
|
9
|
+
});
|
|
10
|
+
export const clientsTools = {
|
|
11
|
+
'clients.list': {
|
|
12
|
+
description: 'Lista los clientes de la organización con búsqueda y paginación',
|
|
13
|
+
schema: z.object({
|
|
14
|
+
search: z.string().optional().describe('Texto para buscar por nombre, email o teléfono'),
|
|
15
|
+
limit: z.number().default(20).describe('Cantidad de resultados por página'),
|
|
16
|
+
page: z.number().default(1).describe('Número de página'),
|
|
17
|
+
}),
|
|
18
|
+
handler: async (client, args) => {
|
|
19
|
+
const result = await client.get('/api/v1/clients', {
|
|
20
|
+
search: args.search,
|
|
21
|
+
limit: args.limit ?? 20,
|
|
22
|
+
page: args.page ?? 1,
|
|
23
|
+
});
|
|
24
|
+
return result;
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
'clients.get': {
|
|
28
|
+
description: 'Obtiene el detalle de un cliente incluyendo estadísticas (sesiones totales, monto gastado, última sesión)',
|
|
29
|
+
schema: z.object({
|
|
30
|
+
client_id: z.string().describe('ID del cliente'),
|
|
31
|
+
}),
|
|
32
|
+
handler: async (client, args) => {
|
|
33
|
+
const result = await client.get(`/api/v1/clients/${args.client_id}`);
|
|
34
|
+
return result;
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
'clients.create': {
|
|
38
|
+
description: 'Crea un nuevo cliente en la organización',
|
|
39
|
+
schema: z.object({
|
|
40
|
+
name: z.string().describe('Nombre del cliente'),
|
|
41
|
+
last_name: z.string().describe('Apellido del cliente'),
|
|
42
|
+
email: z.string().email().optional().describe('Email del cliente'),
|
|
43
|
+
phone: z.string().optional().describe('Teléfono del cliente'),
|
|
44
|
+
actor: ActorSchema.describe('Quién realiza la acción'),
|
|
45
|
+
}),
|
|
46
|
+
handler: async (client, args) => {
|
|
47
|
+
const result = await client.post('/api/v1/clients', {
|
|
48
|
+
name: args.name,
|
|
49
|
+
lastName: args.last_name,
|
|
50
|
+
email: args.email,
|
|
51
|
+
phone: args.phone,
|
|
52
|
+
actor: args.actor,
|
|
53
|
+
});
|
|
54
|
+
return result;
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=clients.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clients.js","sourceRoot":"","sources":["../../src/tools/clients.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,UAAU,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;IAC7D,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC;QACrB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;KACf,CAAC,CAAC,QAAQ,EAAE;CACd,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,cAAc,EAAE;QACd,WAAW,EAAE,iEAAiE;QAC9E,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;YACf,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,gDAAgD,CAAC;YACxF,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,mCAAmC,CAAC;YAC3E,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,C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CAAC,yBAAyB,CAAC;SACvD,CAAC;QACF,OAAO,EAAE,KAAK,EAAE,MAAwB,EAAE,IAA6G,EAAE,EAAE;YACzJ,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,iBAAiB,EAAE;gBAClD,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,QAAQ,EAAE,IAAI,CAAC,SAAS;gBACxB,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,KAAK,EAAE,IAAI,CAAC,KAAK;aAClB,CAAC,CAAC;YACH,OAAO,MAAM,CAAC;QAChB,CAAC;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { CoordinaloClient } from '../client.js';
|
|
3
|
+
export declare const notificationsTools: {
|
|
4
|
+
'notifications.send': {
|
|
5
|
+
description: string;
|
|
6
|
+
schema: z.ZodObject<{
|
|
7
|
+
client_id: z.ZodString;
|
|
8
|
+
type: z.ZodEnum<["reminder", "confirmation", "cancellation", "custom"]>;
|
|
9
|
+
session_id: z.ZodOptional<z.ZodString>;
|
|
10
|
+
message: z.ZodOptional<z.ZodString>;
|
|
11
|
+
channel: z.ZodOptional<z.ZodEnum<["whatsapp", "email", "sms"]>>;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
type: "custom" | "reminder" | "confirmation" | "cancellation";
|
|
14
|
+
client_id: string;
|
|
15
|
+
message?: string | undefined;
|
|
16
|
+
session_id?: string | undefined;
|
|
17
|
+
channel?: "email" | "whatsapp" | "sms" | undefined;
|
|
18
|
+
}, {
|
|
19
|
+
type: "custom" | "reminder" | "confirmation" | "cancellation";
|
|
20
|
+
client_id: string;
|
|
21
|
+
message?: string | undefined;
|
|
22
|
+
session_id?: string | undefined;
|
|
23
|
+
channel?: "email" | "whatsapp" | "sms" | undefined;
|
|
24
|
+
}>;
|
|
25
|
+
handler: (client: CoordinaloClient, args: {
|
|
26
|
+
client_id: string;
|
|
27
|
+
type: string;
|
|
28
|
+
session_id?: string;
|
|
29
|
+
message?: string;
|
|
30
|
+
channel?: string;
|
|
31
|
+
}) => Promise<unknown>;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=notifications.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../src/tools/notifications.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;0BAUH,gBAAgB,QAAQ;YAAE,SAAS,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,UAAU,CAAC,EAAE,MAAM,CAAC;YAAC,OAAO,CAAC,EAAE,MAAM,CAAC;YAAC,OAAO,CAAC,EAAE,MAAM,CAAA;SAAE;;CAW/I,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const notificationsTools = {
|
|
3
|
+
'notifications.send': {
|
|
4
|
+
description: 'Envía una notificación (recordatorio, confirmación, etc.) a un cliente por el canal configurado',
|
|
5
|
+
schema: z.object({
|
|
6
|
+
client_id: z.string().describe('ID del cliente destinatario'),
|
|
7
|
+
type: z.enum(['reminder', 'confirmation', 'cancellation', 'custom']).describe('Tipo de notificación'),
|
|
8
|
+
session_id: z.string().optional().describe('ID de la sesión relacionada (si aplica)'),
|
|
9
|
+
message: z.string().optional().describe('Mensaje personalizado (para type=custom)'),
|
|
10
|
+
channel: z.enum(['whatsapp', 'email', 'sms']).optional().describe('Canal de envío (default: el preferido del cliente)'),
|
|
11
|
+
}),
|
|
12
|
+
handler: async (client, args) => {
|
|
13
|
+
const result = await client.post('/api/v1/notifications', {
|
|
14
|
+
clientId: args.client_id,
|
|
15
|
+
type: args.type,
|
|
16
|
+
sessionId: args.session_id,
|
|
17
|
+
message: args.message,
|
|
18
|
+
channel: args.channel,
|
|
19
|
+
});
|
|
20
|
+
return result;
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=notifications.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifications.js","sourceRoot":"","sources":["../../src/tools/notifications.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,oBAAoB,EAAE;QACpB,WAAW,EAAE,iGAAiG;QAC9G,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;YACf,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;YAC7D,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,sBAAsB,CAAC;YACrG,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yCAAyC,CAAC;YACrF,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0CAA0C,CAAC;YACnF,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oDAAoD,CAAC;SACxH,CAAC;QACF,OAAO,EAAE,KAAK,EAAE,MAAwB,EAAE,IAAkG,EAAE,EAAE;YAC9I,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,uBAAuB,EAAE;gBACxD,QAAQ,EAAE,IAAI,CAAC,SAAS;gBACxB,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,SAAS,EAAE,IAAI,CAAC,UAAU;gBAC1B,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,OAAO,EAAE,IAAI,CAAC,OAAO;aACtB,CAAC,CAAC;YACH,OAAO,MAAM,CAAC;QAChB,CAAC;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { CoordinaloClient } from '../client.js';
|
|
3
|
+
export declare const paymentsTools: {
|
|
4
|
+
'payments.get_balance': {
|
|
5
|
+
description: string;
|
|
6
|
+
schema: z.ZodObject<{
|
|
7
|
+
client_id: z.ZodString;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
client_id: string;
|
|
10
|
+
}, {
|
|
11
|
+
client_id: string;
|
|
12
|
+
}>;
|
|
13
|
+
handler: (client: CoordinaloClient, args: {
|
|
14
|
+
client_id: string;
|
|
15
|
+
}) => Promise<{
|
|
16
|
+
client_id: string;
|
|
17
|
+
sessions_available: {} | null;
|
|
18
|
+
pending_amount: {} | null;
|
|
19
|
+
total_sessions: {} | null;
|
|
20
|
+
total_spent: {} | null;
|
|
21
|
+
}>;
|
|
22
|
+
};
|
|
23
|
+
'payments.charge': {
|
|
24
|
+
description: string;
|
|
25
|
+
schema: z.ZodObject<{
|
|
26
|
+
client_id: z.ZodString;
|
|
27
|
+
service_id: z.ZodString;
|
|
28
|
+
provider_id: z.ZodString;
|
|
29
|
+
amount: z.ZodNumber;
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
provider_id: string;
|
|
32
|
+
service_id: string;
|
|
33
|
+
client_id: string;
|
|
34
|
+
amount: number;
|
|
35
|
+
}, {
|
|
36
|
+
provider_id: string;
|
|
37
|
+
service_id: string;
|
|
38
|
+
client_id: string;
|
|
39
|
+
amount: number;
|
|
40
|
+
}>;
|
|
41
|
+
handler: (client: CoordinaloClient, args: {
|
|
42
|
+
client_id: string;
|
|
43
|
+
service_id: string;
|
|
44
|
+
provider_id: string;
|
|
45
|
+
amount: number;
|
|
46
|
+
}) => Promise<unknown>;
|
|
47
|
+
};
|
|
48
|
+
'payments.record': {
|
|
49
|
+
description: string;
|
|
50
|
+
schema: z.ZodObject<{
|
|
51
|
+
venta_id: z.ZodString;
|
|
52
|
+
amount: z.ZodNumber;
|
|
53
|
+
method: z.ZodEnum<["efectivo", "transferencia", "mercadopago", "tarjeta"]>;
|
|
54
|
+
reference: z.ZodOptional<z.ZodString>;
|
|
55
|
+
}, "strip", z.ZodTypeAny, {
|
|
56
|
+
method: "efectivo" | "transferencia" | "mercadopago" | "tarjeta";
|
|
57
|
+
amount: number;
|
|
58
|
+
venta_id: string;
|
|
59
|
+
reference?: string | undefined;
|
|
60
|
+
}, {
|
|
61
|
+
method: "efectivo" | "transferencia" | "mercadopago" | "tarjeta";
|
|
62
|
+
amount: number;
|
|
63
|
+
venta_id: string;
|
|
64
|
+
reference?: string | undefined;
|
|
65
|
+
}>;
|
|
66
|
+
handler: (client: CoordinaloClient, args: {
|
|
67
|
+
venta_id: string;
|
|
68
|
+
amount: number;
|
|
69
|
+
method: string;
|
|
70
|
+
reference?: string;
|
|
71
|
+
}) => Promise<unknown>;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=payments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payments.d.ts","sourceRoot":"","sources":["../../src/tools/payments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD,eAAO,MAAM,aAAa;;;;;;;;;;0BAME,gBAAgB,QAAQ;YAAE,SAAS,EAAE,MAAM,CAAA;SAAE;;;;;;;;;;;;;;;;;;;;;;;;;;0BAsB7C,gBAAgB,QAAQ;YAAE,SAAS,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,CAAC;YAAC,WAAW,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE;;;;;;;;;;;;;;;;;;;;0BAoBtG,gBAAgB,QAAQ;YAAE,QAAQ,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAC;YAAC,SAAS,CAAC,EAAE,MAAM,CAAA;SAAE;;CAU3H,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const paymentsTools = {
|
|
3
|
+
'payments.get_balance': {
|
|
4
|
+
description: 'Consulta el saldo de un cliente: sesiones disponibles y monto pendiente',
|
|
5
|
+
schema: z.object({
|
|
6
|
+
client_id: z.string().describe('ID del cliente'),
|
|
7
|
+
}),
|
|
8
|
+
handler: async (client, args) => {
|
|
9
|
+
const data = await client.get(`/api/v1/clients/${args.client_id}`);
|
|
10
|
+
const stats = data.stats;
|
|
11
|
+
const balance = data.balance;
|
|
12
|
+
return {
|
|
13
|
+
client_id: args.client_id,
|
|
14
|
+
sessions_available: balance?.available ?? null,
|
|
15
|
+
pending_amount: balance?.pending ?? null,
|
|
16
|
+
total_sessions: stats?.total_sessions ?? null,
|
|
17
|
+
total_spent: stats?.total_spent ?? null,
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
'payments.charge': {
|
|
22
|
+
description: 'Crea una venta (cargo) para un cliente por un servicio',
|
|
23
|
+
schema: z.object({
|
|
24
|
+
client_id: z.string().describe('ID del cliente'),
|
|
25
|
+
service_id: z.string().describe('ID del servicio'),
|
|
26
|
+
provider_id: z.string().describe('ID del proveedor'),
|
|
27
|
+
amount: z.number().describe('Monto unitario del cargo'),
|
|
28
|
+
}),
|
|
29
|
+
handler: async (client, args) => {
|
|
30
|
+
const result = await client.post('/api/v1/sales', {
|
|
31
|
+
clientId: args.client_id,
|
|
32
|
+
serviceId: args.service_id,
|
|
33
|
+
providerId: args.provider_id,
|
|
34
|
+
quantity: 1,
|
|
35
|
+
unitPrice: args.amount,
|
|
36
|
+
});
|
|
37
|
+
return result;
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
'payments.record': {
|
|
41
|
+
description: 'Registra un cobro (pago recibido) contra una venta existente',
|
|
42
|
+
schema: z.object({
|
|
43
|
+
venta_id: z.string().describe('ID de la venta a la que se aplica el cobro'),
|
|
44
|
+
amount: z.number().describe('Monto cobrado'),
|
|
45
|
+
method: z.enum(['efectivo', 'transferencia', 'mercadopago', 'tarjeta']).describe('Método de pago'),
|
|
46
|
+
reference: z.string().optional().describe('Referencia o número de transacción'),
|
|
47
|
+
}),
|
|
48
|
+
handler: async (client, args) => {
|
|
49
|
+
const result = await client.post('/api/v1/cobros', {
|
|
50
|
+
ventaId: args.venta_id,
|
|
51
|
+
amount: args.amount,
|
|
52
|
+
paymentMethod: args.method,
|
|
53
|
+
reference: args.reference,
|
|
54
|
+
});
|
|
55
|
+
return result;
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=payments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payments.js","sourceRoot":"","sources":["../../src/tools/payments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,sBAAsB,EAAE;QACtB,WAAW,EAAE,yEAAyE;QACtF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;YACf,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC;SACjD,CAAC;QACF,OAAO,EAAE,KAAK,EAAE,MAAwB,EAAE,IAA2B,EAAE,EAAE;YACvE,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,mBAAmB,IAAI,CAAC,SAAS,EAAE,CAA4B,CAAC;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;YACf,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4CAA4C,CAAC;YAC3E,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC;YAC5C,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,eAAe,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,gBAAgB,CAAC;YAClG,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;SAChF,CAAC;QACF,OAAO,EAAE,KAAK,EAAE,MAAwB,EAAE,IAA8E,EAAE,EAAE;YAC1H,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE;gBACjD,OAAO,EAAE,IAAI,CAAC,QAAQ;gBACtB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,aAAa,EAAE,IAAI,CAAC,MAAM;gBAC1B,SAAS,EAAE,IAAI,CAAC,SAAS;aAC1B,CAAC,CAAC;YACH,OAAO,MAAM,CAAC;QAChB,CAAC;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { CoordinaloClient } from '../client.js';
|
|
3
|
+
declare const ActorSchema: z.ZodObject<{
|
|
4
|
+
type: z.ZodEnum<["client", "provider", "organization", "agent"]>;
|
|
5
|
+
id: z.ZodString;
|
|
6
|
+
on_behalf_of: z.ZodOptional<z.ZodObject<{
|
|
7
|
+
type: z.ZodString;
|
|
8
|
+
id: z.ZodString;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
type: string;
|
|
11
|
+
id: string;
|
|
12
|
+
}, {
|
|
13
|
+
type: string;
|
|
14
|
+
id: string;
|
|
15
|
+
}>>;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
type: "client" | "provider" | "organization" | "agent";
|
|
18
|
+
id: string;
|
|
19
|
+
on_behalf_of?: {
|
|
20
|
+
type: string;
|
|
21
|
+
id: string;
|
|
22
|
+
} | undefined;
|
|
23
|
+
}, {
|
|
24
|
+
type: "client" | "provider" | "organization" | "agent";
|
|
25
|
+
id: string;
|
|
26
|
+
on_behalf_of?: {
|
|
27
|
+
type: string;
|
|
28
|
+
id: string;
|
|
29
|
+
} | undefined;
|
|
30
|
+
}>;
|
|
31
|
+
export declare const schedulingTools: {
|
|
32
|
+
'scheduling.check_availability': {
|
|
33
|
+
description: string;
|
|
34
|
+
schema: z.ZodObject<{
|
|
35
|
+
provider_id: z.ZodString;
|
|
36
|
+
service_id: z.ZodString;
|
|
37
|
+
date_range: z.ZodObject<{
|
|
38
|
+
from: z.ZodString;
|
|
39
|
+
to: z.ZodString;
|
|
40
|
+
}, "strip", z.ZodTypeAny, {
|
|
41
|
+
from: string;
|
|
42
|
+
to: string;
|
|
43
|
+
}, {
|
|
44
|
+
from: string;
|
|
45
|
+
to: string;
|
|
46
|
+
}>;
|
|
47
|
+
}, "strip", z.ZodTypeAny, {
|
|
48
|
+
provider_id: string;
|
|
49
|
+
service_id: string;
|
|
50
|
+
date_range: {
|
|
51
|
+
from: string;
|
|
52
|
+
to: string;
|
|
53
|
+
};
|
|
54
|
+
}, {
|
|
55
|
+
provider_id: string;
|
|
56
|
+
service_id: string;
|
|
57
|
+
date_range: {
|
|
58
|
+
from: string;
|
|
59
|
+
to: string;
|
|
60
|
+
};
|
|
61
|
+
}>;
|
|
62
|
+
handler: (client: CoordinaloClient, args: {
|
|
63
|
+
provider_id: string;
|
|
64
|
+
service_id: string;
|
|
65
|
+
date_range: {
|
|
66
|
+
from: string;
|
|
67
|
+
to: string;
|
|
68
|
+
};
|
|
69
|
+
}) => Promise<unknown>;
|
|
70
|
+
};
|
|
71
|
+
'scheduling.book': {
|
|
72
|
+
description: string;
|
|
73
|
+
schema: z.ZodObject<{
|
|
74
|
+
service_id: z.ZodString;
|
|
75
|
+
provider_id: z.ZodString;
|
|
76
|
+
client_id: z.ZodString;
|
|
77
|
+
starts_at: z.ZodString;
|
|
78
|
+
actor: z.ZodObject<{
|
|
79
|
+
type: z.ZodEnum<["client", "provider", "organization", "agent"]>;
|
|
80
|
+
id: z.ZodString;
|
|
81
|
+
on_behalf_of: z.ZodOptional<z.ZodObject<{
|
|
82
|
+
type: z.ZodString;
|
|
83
|
+
id: z.ZodString;
|
|
84
|
+
}, "strip", z.ZodTypeAny, {
|
|
85
|
+
type: string;
|
|
86
|
+
id: string;
|
|
87
|
+
}, {
|
|
88
|
+
type: string;
|
|
89
|
+
id: string;
|
|
90
|
+
}>>;
|
|
91
|
+
}, "strip", z.ZodTypeAny, {
|
|
92
|
+
type: "client" | "provider" | "organization" | "agent";
|
|
93
|
+
id: string;
|
|
94
|
+
on_behalf_of?: {
|
|
95
|
+
type: string;
|
|
96
|
+
id: string;
|
|
97
|
+
} | undefined;
|
|
98
|
+
}, {
|
|
99
|
+
type: "client" | "provider" | "organization" | "agent";
|
|
100
|
+
id: string;
|
|
101
|
+
on_behalf_of?: {
|
|
102
|
+
type: string;
|
|
103
|
+
id: string;
|
|
104
|
+
} | undefined;
|
|
105
|
+
}>;
|
|
106
|
+
}, "strip", z.ZodTypeAny, {
|
|
107
|
+
provider_id: string;
|
|
108
|
+
service_id: string;
|
|
109
|
+
client_id: string;
|
|
110
|
+
starts_at: string;
|
|
111
|
+
actor: {
|
|
112
|
+
type: "client" | "provider" | "organization" | "agent";
|
|
113
|
+
id: string;
|
|
114
|
+
on_behalf_of?: {
|
|
115
|
+
type: string;
|
|
116
|
+
id: string;
|
|
117
|
+
} | undefined;
|
|
118
|
+
};
|
|
119
|
+
}, {
|
|
120
|
+
provider_id: string;
|
|
121
|
+
service_id: string;
|
|
122
|
+
client_id: string;
|
|
123
|
+
starts_at: string;
|
|
124
|
+
actor: {
|
|
125
|
+
type: "client" | "provider" | "organization" | "agent";
|
|
126
|
+
id: string;
|
|
127
|
+
on_behalf_of?: {
|
|
128
|
+
type: string;
|
|
129
|
+
id: string;
|
|
130
|
+
} | undefined;
|
|
131
|
+
};
|
|
132
|
+
}>;
|
|
133
|
+
handler: (client: CoordinaloClient, args: {
|
|
134
|
+
service_id: string;
|
|
135
|
+
provider_id: string;
|
|
136
|
+
client_id: string;
|
|
137
|
+
starts_at: string;
|
|
138
|
+
actor: z.infer<typeof ActorSchema>;
|
|
139
|
+
}) => Promise<unknown>;
|
|
140
|
+
};
|
|
141
|
+
'scheduling.reschedule': {
|
|
142
|
+
description: string;
|
|
143
|
+
schema: z.ZodObject<{
|
|
144
|
+
session_id: z.ZodString;
|
|
145
|
+
new_datetime: z.ZodString;
|
|
146
|
+
actor: z.ZodObject<{
|
|
147
|
+
type: z.ZodEnum<["client", "provider", "organization", "agent"]>;
|
|
148
|
+
id: z.ZodString;
|
|
149
|
+
on_behalf_of: z.ZodOptional<z.ZodObject<{
|
|
150
|
+
type: z.ZodString;
|
|
151
|
+
id: z.ZodString;
|
|
152
|
+
}, "strip", z.ZodTypeAny, {
|
|
153
|
+
type: string;
|
|
154
|
+
id: string;
|
|
155
|
+
}, {
|
|
156
|
+
type: string;
|
|
157
|
+
id: string;
|
|
158
|
+
}>>;
|
|
159
|
+
}, "strip", z.ZodTypeAny, {
|
|
160
|
+
type: "client" | "provider" | "organization" | "agent";
|
|
161
|
+
id: string;
|
|
162
|
+
on_behalf_of?: {
|
|
163
|
+
type: string;
|
|
164
|
+
id: string;
|
|
165
|
+
} | undefined;
|
|
166
|
+
}, {
|
|
167
|
+
type: "client" | "provider" | "organization" | "agent";
|
|
168
|
+
id: string;
|
|
169
|
+
on_behalf_of?: {
|
|
170
|
+
type: string;
|
|
171
|
+
id: string;
|
|
172
|
+
} | undefined;
|
|
173
|
+
}>;
|
|
174
|
+
}, "strip", z.ZodTypeAny, {
|
|
175
|
+
actor: {
|
|
176
|
+
type: "client" | "provider" | "organization" | "agent";
|
|
177
|
+
id: string;
|
|
178
|
+
on_behalf_of?: {
|
|
179
|
+
type: string;
|
|
180
|
+
id: string;
|
|
181
|
+
} | undefined;
|
|
182
|
+
};
|
|
183
|
+
session_id: string;
|
|
184
|
+
new_datetime: string;
|
|
185
|
+
}, {
|
|
186
|
+
actor: {
|
|
187
|
+
type: "client" | "provider" | "organization" | "agent";
|
|
188
|
+
id: string;
|
|
189
|
+
on_behalf_of?: {
|
|
190
|
+
type: string;
|
|
191
|
+
id: string;
|
|
192
|
+
} | undefined;
|
|
193
|
+
};
|
|
194
|
+
session_id: string;
|
|
195
|
+
new_datetime: string;
|
|
196
|
+
}>;
|
|
197
|
+
handler: (client: CoordinaloClient, args: {
|
|
198
|
+
session_id: string;
|
|
199
|
+
new_datetime: string;
|
|
200
|
+
actor: z.infer<typeof ActorSchema>;
|
|
201
|
+
}) => Promise<unknown>;
|
|
202
|
+
};
|
|
203
|
+
'scheduling.cancel': {
|
|
204
|
+
description: string;
|
|
205
|
+
schema: z.ZodObject<{
|
|
206
|
+
session_id: z.ZodString;
|
|
207
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
208
|
+
actor: z.ZodObject<{
|
|
209
|
+
type: z.ZodEnum<["client", "provider", "organization", "agent"]>;
|
|
210
|
+
id: z.ZodString;
|
|
211
|
+
on_behalf_of: z.ZodOptional<z.ZodObject<{
|
|
212
|
+
type: z.ZodString;
|
|
213
|
+
id: z.ZodString;
|
|
214
|
+
}, "strip", z.ZodTypeAny, {
|
|
215
|
+
type: string;
|
|
216
|
+
id: string;
|
|
217
|
+
}, {
|
|
218
|
+
type: string;
|
|
219
|
+
id: string;
|
|
220
|
+
}>>;
|
|
221
|
+
}, "strip", z.ZodTypeAny, {
|
|
222
|
+
type: "client" | "provider" | "organization" | "agent";
|
|
223
|
+
id: string;
|
|
224
|
+
on_behalf_of?: {
|
|
225
|
+
type: string;
|
|
226
|
+
id: string;
|
|
227
|
+
} | undefined;
|
|
228
|
+
}, {
|
|
229
|
+
type: "client" | "provider" | "organization" | "agent";
|
|
230
|
+
id: string;
|
|
231
|
+
on_behalf_of?: {
|
|
232
|
+
type: string;
|
|
233
|
+
id: string;
|
|
234
|
+
} | undefined;
|
|
235
|
+
}>;
|
|
236
|
+
}, "strip", z.ZodTypeAny, {
|
|
237
|
+
actor: {
|
|
238
|
+
type: "client" | "provider" | "organization" | "agent";
|
|
239
|
+
id: string;
|
|
240
|
+
on_behalf_of?: {
|
|
241
|
+
type: string;
|
|
242
|
+
id: string;
|
|
243
|
+
} | undefined;
|
|
244
|
+
};
|
|
245
|
+
session_id: string;
|
|
246
|
+
reason?: string | undefined;
|
|
247
|
+
}, {
|
|
248
|
+
actor: {
|
|
249
|
+
type: "client" | "provider" | "organization" | "agent";
|
|
250
|
+
id: string;
|
|
251
|
+
on_behalf_of?: {
|
|
252
|
+
type: string;
|
|
253
|
+
id: string;
|
|
254
|
+
} | undefined;
|
|
255
|
+
};
|
|
256
|
+
session_id: string;
|
|
257
|
+
reason?: string | undefined;
|
|
258
|
+
}>;
|
|
259
|
+
handler: (client: CoordinaloClient, args: {
|
|
260
|
+
session_id: string;
|
|
261
|
+
reason?: string;
|
|
262
|
+
actor: z.infer<typeof ActorSchema>;
|
|
263
|
+
}) => Promise<unknown>;
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
export {};
|
|
267
|
+
//# sourceMappingURL=scheduling.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduling.d.ts","sourceRoot":"","sources":["../../src/tools/scheduling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOf,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAWA,gBAAgB,QAAQ;YAAE,WAAW,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE;gBAAE,IAAI,EAAE,MAAM,CAAC;gBAAC,EAAE,EAAE,MAAM,CAAA;aAAE,CAAA;SAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAmB7G,gBAAgB,QAAQ;YAAE,UAAU,EAAE,MAAM,CAAC;YAAC,WAAW,EAAE,MAAM,CAAC;YAAC,SAAS,EAAE,MAAM,CAAC;YAAC,SAAS,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAA;SAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAmB7I,gBAAgB,QAAQ;YAAE,UAAU,EAAE,MAAM,CAAC;YAAC,YAAY,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAA;SAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAgBxG,gBAAgB,QAAQ;YAAE,UAAU,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAA;SAAE;;CAQ9H,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const ActorSchema = z.object({
|
|
3
|
+
type: z.enum(['client', 'provider', 'organization', 'agent']),
|
|
4
|
+
id: z.string(),
|
|
5
|
+
on_behalf_of: z.object({
|
|
6
|
+
type: z.string(),
|
|
7
|
+
id: z.string(),
|
|
8
|
+
}).optional(),
|
|
9
|
+
});
|
|
10
|
+
export const schedulingTools = {
|
|
11
|
+
'scheduling.check_availability': {
|
|
12
|
+
description: 'Consulta los horarios disponibles de un proveedor para un servicio en un rango de fechas',
|
|
13
|
+
schema: z.object({
|
|
14
|
+
provider_id: z.string().describe('ID del proveedor'),
|
|
15
|
+
service_id: z.string().describe('ID del servicio'),
|
|
16
|
+
date_range: z.object({
|
|
17
|
+
from: z.string().describe('Fecha inicio (ISO date, ej: 2025-03-01)'),
|
|
18
|
+
to: z.string().describe('Fecha fin (ISO date, ej: 2025-03-07)'),
|
|
19
|
+
}),
|
|
20
|
+
}),
|
|
21
|
+
handler: async (client, args) => {
|
|
22
|
+
const result = await client.get(`/api/v1/providers/${args.provider_id}/slots`, {
|
|
23
|
+
service_id: args.service_id,
|
|
24
|
+
from: args.date_range.from,
|
|
25
|
+
to: args.date_range.to,
|
|
26
|
+
});
|
|
27
|
+
return result;
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
'scheduling.book': {
|
|
31
|
+
description: 'Agenda una nueva sesión para un cliente con un proveedor',
|
|
32
|
+
schema: z.object({
|
|
33
|
+
service_id: z.string().describe('ID del servicio'),
|
|
34
|
+
provider_id: z.string().describe('ID del proveedor'),
|
|
35
|
+
client_id: z.string().describe('ID del cliente'),
|
|
36
|
+
starts_at: z.string().describe('Fecha y hora de inicio (ISO datetime)'),
|
|
37
|
+
actor: ActorSchema.describe('Quién realiza la acción'),
|
|
38
|
+
}),
|
|
39
|
+
handler: async (client, args) => {
|
|
40
|
+
const result = await client.post('/api/v1/sessions', {
|
|
41
|
+
serviceId: args.service_id,
|
|
42
|
+
providerId: args.provider_id,
|
|
43
|
+
clientId: args.client_id,
|
|
44
|
+
startTime: args.starts_at,
|
|
45
|
+
actor: args.actor,
|
|
46
|
+
});
|
|
47
|
+
return result;
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
'scheduling.reschedule': {
|
|
51
|
+
description: 'Reagenda una sesión existente a una nueva fecha/hora',
|
|
52
|
+
schema: z.object({
|
|
53
|
+
session_id: z.string().describe('ID de la sesión a reagendar'),
|
|
54
|
+
new_datetime: z.string().describe('Nueva fecha y hora (ISO datetime)'),
|
|
55
|
+
actor: ActorSchema.describe('Quién realiza la acción'),
|
|
56
|
+
}),
|
|
57
|
+
handler: async (client, args) => {
|
|
58
|
+
const result = await client.put(`/api/v1/sessions/${args.session_id}`, {
|
|
59
|
+
startTime: args.new_datetime,
|
|
60
|
+
actor: args.actor,
|
|
61
|
+
});
|
|
62
|
+
return result;
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
'scheduling.cancel': {
|
|
66
|
+
description: 'Cancela una sesión existente',
|
|
67
|
+
schema: z.object({
|
|
68
|
+
session_id: z.string().describe('ID de la sesión a cancelar'),
|
|
69
|
+
reason: z.string().optional().describe('Motivo de la cancelación'),
|
|
70
|
+
actor: ActorSchema.describe('Quién realiza la acción'),
|
|
71
|
+
}),
|
|
72
|
+
handler: async (client, args) => {
|
|
73
|
+
const result = await client.post(`/api/v1/sessions/${args.session_id}/cancel`, {
|
|
74
|
+
reason: args.reason,
|
|
75
|
+
actor: args.actor,
|
|
76
|
+
});
|
|
77
|
+
return result;
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
//# sourceMappingURL=scheduling.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduling.js","sourceRoot":"","sources":["../../src/tools/scheduling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,UAAU,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;IAC7D,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC;QACrB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;KACf,CAAC,CAAC,QAAQ,EA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AC;YAC7D,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0BAA0B,CAAC;YAClE,KAAK,EAAE,WAAW,CAAC,QAAQ,CAAC,yBAAyB,CAAC;SACvD,CAAC;QACF,OAAO,EAAE,KAAK,EAAE,MAAwB,EAAE,IAAiF,EAAE,EAAE;YAC7H,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,oBAAoB,IAAI,CAAC,UAAU,SAAS,EAAE;gBAC7E,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,KAAK,EAAE,IAAI,CAAC,KAAK;aAClB,CAAC,CAAC;YACH,OAAO,MAAM,CAAC;QAChB,CAAC;KACF;CACF,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@servicialo/mcp-server",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MCP server for the Servicialo protocol — connects AI agents to professional services via Coordinalo API",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"servicialo-mcp": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"main": "./dist/index.js",
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc",
|
|
16
|
+
"dev": "tsc --watch",
|
|
17
|
+
"start": "node dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
21
|
+
"zod": "^3.24.2"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/node": "^22.13.4",
|
|
25
|
+
"typescript": "^5.7.3"
|
|
26
|
+
},
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=18"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"mcp",
|
|
32
|
+
"servicialo",
|
|
33
|
+
"coordinalo",
|
|
34
|
+
"ai-agents",
|
|
35
|
+
"professional-services",
|
|
36
|
+
"model-context-protocol"
|
|
37
|
+
]
|
|
38
|
+
}
|