salesflare-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/API.md +691 -0
- package/CHANGELOG.md +49 -0
- package/CLAUDE.md +117 -0
- package/CONTRIBUTING.md +399 -0
- package/FIX_PLAN.md +70 -0
- package/INSPECTOR.md +191 -0
- package/LICENSE +21 -0
- package/PUBLISH.md +73 -0
- package/README.md +383 -0
- package/dist/auth/api-key-auth.d.ts +75 -0
- package/dist/auth/api-key-auth.d.ts.map +1 -0
- package/dist/auth/api-key-auth.js +103 -0
- package/dist/auth/oauth-auth.d.ts +81 -0
- package/dist/auth/oauth-auth.d.ts.map +1 -0
- package/dist/auth/oauth-auth.js +123 -0
- package/dist/auth/token-manager.d.ts +105 -0
- package/dist/auth/token-manager.d.ts.map +1 -0
- package/dist/auth/token-manager.js +87 -0
- package/dist/client/salesflare-client.d.ts +219 -0
- package/dist/client/salesflare-client.d.ts.map +1 -0
- package/dist/client/salesflare-client.js +484 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +82 -0
- package/dist/server.d.ts +39 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +140 -0
- package/dist/tools/companies.d.ts +45 -0
- package/dist/tools/companies.d.ts.map +1 -0
- package/dist/tools/companies.js +392 -0
- package/dist/tools/contacts.d.ts +45 -0
- package/dist/tools/contacts.d.ts.map +1 -0
- package/dist/tools/contacts.js +290 -0
- package/dist/tools/deals.d.ts +46 -0
- package/dist/tools/deals.d.ts.map +1 -0
- package/dist/tools/deals.js +442 -0
- package/dist/tools/pipeline.d.ts +43 -0
- package/dist/tools/pipeline.d.ts.map +1 -0
- package/dist/tools/pipeline.js +328 -0
- package/dist/tools/tasks.d.ts +44 -0
- package/dist/tools/tasks.d.ts.map +1 -0
- package/dist/tools/tasks.js +406 -0
- package/dist/transport/http-transport.d.ts +36 -0
- package/dist/transport/http-transport.d.ts.map +1 -0
- package/dist/transport/http-transport.js +173 -0
- package/dist/transport/stdio-transport.d.ts +37 -0
- package/dist/transport/stdio-transport.d.ts.map +1 -0
- package/dist/transport/stdio-transport.js +129 -0
- package/dist/types/company.d.ts +223 -0
- package/dist/types/company.d.ts.map +1 -0
- package/dist/types/company.js +8 -0
- package/dist/types/contact.d.ts +166 -0
- package/dist/types/contact.d.ts.map +1 -0
- package/dist/types/contact.js +8 -0
- package/dist/types/deal.d.ts +203 -0
- package/dist/types/deal.d.ts.map +1 -0
- package/dist/types/deal.js +8 -0
- package/dist/types/pipeline.d.ts +116 -0
- package/dist/types/pipeline.d.ts.map +1 -0
- package/dist/types/pipeline.js +8 -0
- package/dist/types/task.d.ts +154 -0
- package/dist/types/task.d.ts.map +1 -0
- package/dist/types/task.js +8 -0
- package/dist/utils/errors.d.ts +128 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +205 -0
- package/dist/utils/validation.d.ts +354 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +716 -0
- package/package.json +49 -0
- package/test-tasks-debug.js +21 -0
- package/test-tasks-params.js +52 -0
- package/test-tools.js +171 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deal types for Salesflare MCP Server
|
|
3
|
+
*
|
|
4
|
+
* TypeScript interfaces and type definitions for Deal CRUD operations.
|
|
5
|
+
*
|
|
6
|
+
* @module types/deal
|
|
7
|
+
*/
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
import { createDealListSchema, createDealCreateSchema, createDealUpdateSchema } from '../utils/validation.js';
|
|
10
|
+
/**
|
|
11
|
+
* Core deal entity interface
|
|
12
|
+
* Represents a deal/opportunity in Salesflare CRM with essential fields (per D-01 to D-06)
|
|
13
|
+
*/
|
|
14
|
+
export interface Deal {
|
|
15
|
+
/** Unique identifier (UUID) */
|
|
16
|
+
id: string;
|
|
17
|
+
/** Deal name (required per D-01) */
|
|
18
|
+
name: string;
|
|
19
|
+
/** Deal value in cents (required per D-03) */
|
|
20
|
+
value: number;
|
|
21
|
+
/** Currency code (3-letter ISO per D-04, default 'USD') */
|
|
22
|
+
currency: string;
|
|
23
|
+
/** Pipeline ID the deal belongs to (required per D-01) */
|
|
24
|
+
pipeline_id: string;
|
|
25
|
+
/** Stage ID within the pipeline (optional per D-02) */
|
|
26
|
+
stage_id?: string;
|
|
27
|
+
/** Deal status (open, won, or lost per D-07) */
|
|
28
|
+
status: 'open' | 'won' | 'lost';
|
|
29
|
+
/** Expected close date (ISO 8601, optional per D-02) */
|
|
30
|
+
close_date?: string;
|
|
31
|
+
/** Assigned user information (optional per D-02) */
|
|
32
|
+
assigned_user?: {
|
|
33
|
+
/** User UUID */
|
|
34
|
+
id: string;
|
|
35
|
+
/** User name */
|
|
36
|
+
name: string;
|
|
37
|
+
};
|
|
38
|
+
/** Associated company (optional per D-06) */
|
|
39
|
+
company?: {
|
|
40
|
+
/** Company UUID */
|
|
41
|
+
id: string;
|
|
42
|
+
/** Company name */
|
|
43
|
+
name: string;
|
|
44
|
+
};
|
|
45
|
+
/** Associated contacts (optional per D-06) */
|
|
46
|
+
contacts?: Array<{
|
|
47
|
+
/** Contact UUID */
|
|
48
|
+
id: string;
|
|
49
|
+
/** Contact name */
|
|
50
|
+
name: string;
|
|
51
|
+
}>;
|
|
52
|
+
/** Deal description (optional per D-02) */
|
|
53
|
+
description?: string;
|
|
54
|
+
/** Creation timestamp (ISO 8601) */
|
|
55
|
+
created_at: string;
|
|
56
|
+
/** Last update timestamp (ISO 8601) */
|
|
57
|
+
updated_at: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Paginated deal list response
|
|
61
|
+
* Returned by the list deals endpoint
|
|
62
|
+
*/
|
|
63
|
+
export interface DealListResponse {
|
|
64
|
+
/** Array of deals for the current page */
|
|
65
|
+
deals: Deal[];
|
|
66
|
+
/** Total number of deals matching the filter */
|
|
67
|
+
total: number;
|
|
68
|
+
/** Current page number (1-indexed) */
|
|
69
|
+
page: number;
|
|
70
|
+
/** Number of items per page */
|
|
71
|
+
limit: number;
|
|
72
|
+
/** Whether there are more pages available */
|
|
73
|
+
has_more: boolean;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Filter parameters for listing deals
|
|
77
|
+
* All fields are optional - omit to skip filtering (per D-15 to D-20)
|
|
78
|
+
*/
|
|
79
|
+
export interface DealListFilters {
|
|
80
|
+
/** Filter by deal status (per D-15) */
|
|
81
|
+
status?: 'open' | 'won' | 'lost';
|
|
82
|
+
/** Filter by pipeline ID (per D-16) */
|
|
83
|
+
pipeline_id?: string;
|
|
84
|
+
/** Filter by assigned user ID (per D-17) */
|
|
85
|
+
assigned_user_id?: string;
|
|
86
|
+
/** Filter by stage ID (per D-18) */
|
|
87
|
+
stage_id?: string;
|
|
88
|
+
/** Minimum deal value in cents (per D-19) */
|
|
89
|
+
min_value?: number;
|
|
90
|
+
/** Maximum deal value in cents (per D-19) */
|
|
91
|
+
max_value?: number;
|
|
92
|
+
/** Free-text search across deal fields (per D-20) */
|
|
93
|
+
search?: string;
|
|
94
|
+
/** Page number (default: 1) */
|
|
95
|
+
page?: number;
|
|
96
|
+
/** Items per page (default: 20, max: 100) */
|
|
97
|
+
limit?: number;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Input data for creating a new deal
|
|
101
|
+
* Name, value, and pipeline_id are required per D-01
|
|
102
|
+
*/
|
|
103
|
+
export interface DealCreateInput {
|
|
104
|
+
/** Deal name (required per D-01) */
|
|
105
|
+
name: string;
|
|
106
|
+
/** Deal value in dollars (will be converted to cents per D-22) */
|
|
107
|
+
value: number;
|
|
108
|
+
/** Currency code (3-letter ISO, default 'USD') */
|
|
109
|
+
currency?: string;
|
|
110
|
+
/** Pipeline ID the deal belongs to (required per D-01) */
|
|
111
|
+
pipeline_id: string;
|
|
112
|
+
/** Stage ID within the pipeline (optional) */
|
|
113
|
+
stage_id?: string;
|
|
114
|
+
/** Expected close date (ISO 8601) */
|
|
115
|
+
close_date?: string;
|
|
116
|
+
/** Assigned user ID (UUID) */
|
|
117
|
+
assigned_user_id?: string;
|
|
118
|
+
/** Associated company ID (UUID per D-06) */
|
|
119
|
+
company_id?: string;
|
|
120
|
+
/** Associated contact IDs (UUID array per D-06) */
|
|
121
|
+
contact_ids?: string[];
|
|
122
|
+
/** Deal description */
|
|
123
|
+
description?: string;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Input data for updating an existing deal
|
|
127
|
+
* All fields are optional - only provided fields will be updated (PATCH semantics per D-25)
|
|
128
|
+
*/
|
|
129
|
+
export interface DealUpdateInput {
|
|
130
|
+
/** Deal name (optional) */
|
|
131
|
+
name?: string;
|
|
132
|
+
/** Deal value in dollars (will be converted to cents) */
|
|
133
|
+
value?: number;
|
|
134
|
+
/** Currency code (3-letter ISO) */
|
|
135
|
+
currency?: string;
|
|
136
|
+
/** Pipeline ID the deal belongs to (optional) */
|
|
137
|
+
pipeline_id?: string;
|
|
138
|
+
/** Stage ID within the pipeline (optional) */
|
|
139
|
+
stage_id?: string;
|
|
140
|
+
/** Expected close date (ISO 8601) */
|
|
141
|
+
close_date?: string;
|
|
142
|
+
/** Assigned user ID (UUID) */
|
|
143
|
+
assigned_user_id?: string;
|
|
144
|
+
/** Associated company ID (UUID) */
|
|
145
|
+
company_id?: string;
|
|
146
|
+
/** Associated contact IDs (UUID array) */
|
|
147
|
+
contact_ids?: string[];
|
|
148
|
+
/** Deal description */
|
|
149
|
+
description?: string;
|
|
150
|
+
/** Deal status (open, won, or lost) */
|
|
151
|
+
status?: 'open' | 'won' | 'lost';
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Input data for moving a deal to a new stage
|
|
155
|
+
* Both IDs are required per D-26
|
|
156
|
+
*/
|
|
157
|
+
export interface DealMoveStageInput {
|
|
158
|
+
/** Deal ID to move (required) */
|
|
159
|
+
deal_id: string;
|
|
160
|
+
/** Target stage ID (required) */
|
|
161
|
+
stage_id: string;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Type inference from schemas for runtime validation
|
|
165
|
+
* These types are derived from the Zod validation schemas
|
|
166
|
+
*/
|
|
167
|
+
/** Type for deal list parameters (inferred from schema) */
|
|
168
|
+
export type DealListParams = z.infer<ReturnType<typeof createDealListSchema>>;
|
|
169
|
+
/** Type for deal create data (inferred from schema) */
|
|
170
|
+
export type DealCreateData = z.infer<ReturnType<typeof createDealCreateSchema>>;
|
|
171
|
+
/** Type for deal update data (inferred from schema) */
|
|
172
|
+
export type DealUpdateData = z.infer<ReturnType<typeof createDealUpdateSchema>>;
|
|
173
|
+
/**
|
|
174
|
+
* Standard MCP tool response format for deal operations
|
|
175
|
+
* Returns both human-readable text and structured JSON data
|
|
176
|
+
*/
|
|
177
|
+
export interface DealToolResponse {
|
|
178
|
+
/** Response content array */
|
|
179
|
+
content: [
|
|
180
|
+
/** Human-readable summary text */
|
|
181
|
+
{
|
|
182
|
+
type: 'text';
|
|
183
|
+
text: string;
|
|
184
|
+
},
|
|
185
|
+
/** JSON stringified data */
|
|
186
|
+
{
|
|
187
|
+
type: 'text';
|
|
188
|
+
text: string;
|
|
189
|
+
}
|
|
190
|
+
];
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* MCP tool response format for delete operations
|
|
194
|
+
* Returns only a success confirmation (no deal data for deleted records)
|
|
195
|
+
*/
|
|
196
|
+
export interface DealDeleteResponse {
|
|
197
|
+
/** Response content array with single text item */
|
|
198
|
+
content: [{
|
|
199
|
+
type: 'text';
|
|
200
|
+
text: string;
|
|
201
|
+
}];
|
|
202
|
+
}
|
|
203
|
+
//# sourceMappingURL=deal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deal.d.ts","sourceRoot":"","sources":["../../src/types/deal.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL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,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE;QAC9B,4BAA4B;QAC5B;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE;KAC/B,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,mDAAmD;IACnD,OAAO,EAAE,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC3C"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pipeline types for Salesflare MCP Server
|
|
3
|
+
*
|
|
4
|
+
* TypeScript interfaces and type definitions for Pipeline operations.
|
|
5
|
+
*
|
|
6
|
+
* @module types/pipeline
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Pipeline stage entity interface (per D-17)
|
|
10
|
+
*/
|
|
11
|
+
export interface PipelineStage {
|
|
12
|
+
/** Unique identifier (UUID) */
|
|
13
|
+
id: string;
|
|
14
|
+
/** Stage name (e.g., "Prospecting") */
|
|
15
|
+
name: string;
|
|
16
|
+
/** Parent pipeline ID (UUID) */
|
|
17
|
+
pipeline_id: string;
|
|
18
|
+
/** Position/order in pipeline */
|
|
19
|
+
position: number;
|
|
20
|
+
/** Creation timestamp (ISO 8601) */
|
|
21
|
+
created_at: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Response for listing pipeline stages
|
|
25
|
+
*/
|
|
26
|
+
export interface PipelineStageListResponse {
|
|
27
|
+
/** Array of pipeline stages */
|
|
28
|
+
stages: PipelineStage[];
|
|
29
|
+
/** Pipeline ID if filtered by specific pipeline */
|
|
30
|
+
pipeline_id?: string;
|
|
31
|
+
/** Total number of stages */
|
|
32
|
+
total: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Filter parameters for listing pipeline stages (per D-20 to D-22)
|
|
36
|
+
*/
|
|
37
|
+
export interface PipelineStageListFilters {
|
|
38
|
+
/** Filter by pipeline ID (optional per D-21) */
|
|
39
|
+
pipeline_id?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Statistics for a single pipeline stage (per D-18)
|
|
43
|
+
*/
|
|
44
|
+
export interface PipelineStageStatistics {
|
|
45
|
+
/** Stage ID (UUID) */
|
|
46
|
+
stage_id: string;
|
|
47
|
+
/** Stage name */
|
|
48
|
+
stage_name: string;
|
|
49
|
+
/** Position in pipeline */
|
|
50
|
+
position: number;
|
|
51
|
+
/** Number of deals in this stage */
|
|
52
|
+
deal_count: number;
|
|
53
|
+
/** Total value in cents */
|
|
54
|
+
total_value_cents: number;
|
|
55
|
+
/** Formatted value for display (e.g., "$10,000.00") per D-24 */
|
|
56
|
+
total_value_display: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Pipeline overview statistics (per D-18)
|
|
60
|
+
*/
|
|
61
|
+
export interface PipelineOverview {
|
|
62
|
+
/** Pipeline ID (UUID) */
|
|
63
|
+
pipeline_id: string;
|
|
64
|
+
/** Pipeline name */
|
|
65
|
+
pipeline_name: string;
|
|
66
|
+
/** Total number of deals across all stages */
|
|
67
|
+
total_deals: number;
|
|
68
|
+
/** Total value in cents */
|
|
69
|
+
total_value_cents: number;
|
|
70
|
+
/** Formatted total value for display (e.g., "$10,000.00") per D-24 */
|
|
71
|
+
total_value_display: string;
|
|
72
|
+
/** Statistics for each stage */
|
|
73
|
+
stages: PipelineStageStatistics[];
|
|
74
|
+
/** Number of open deals */
|
|
75
|
+
open_deals: number;
|
|
76
|
+
/** Number of won deals */
|
|
77
|
+
won_deals: number;
|
|
78
|
+
/** Number of lost deals */
|
|
79
|
+
lost_deals: number;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Filter parameters for pipeline overview (per D-25)
|
|
83
|
+
*/
|
|
84
|
+
export interface PipelineOverviewFilters {
|
|
85
|
+
/** Filter by pipeline ID (optional) */
|
|
86
|
+
pipeline_id?: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Response wrapper for pipeline overview
|
|
90
|
+
*/
|
|
91
|
+
export interface PipelineOverviewResponse {
|
|
92
|
+
/** Array of pipeline overviews */
|
|
93
|
+
pipelines: PipelineOverview[];
|
|
94
|
+
/** Total number of pipelines */
|
|
95
|
+
total_pipelines: number;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Standard MCP tool response format for pipeline operations
|
|
99
|
+
* Returns both human-readable text and structured JSON data
|
|
100
|
+
*/
|
|
101
|
+
export interface PipelineToolResponse {
|
|
102
|
+
/** Response content array */
|
|
103
|
+
content: [
|
|
104
|
+
/** Human-readable summary text */
|
|
105
|
+
{
|
|
106
|
+
type: 'text';
|
|
107
|
+
text: string;
|
|
108
|
+
},
|
|
109
|
+
/** JSON stringified data */
|
|
110
|
+
{
|
|
111
|
+
type: 'text';
|
|
112
|
+
text: string;
|
|
113
|
+
}
|
|
114
|
+
];
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=pipeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/types/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,+BAA+B;IAC/B,EAAE,EAAE,MAAM,CAAC;IAEX,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IAEb,gCAAgC;IAChC,WAAW,EAAE,MAAM,CAAC;IAEpB,iCAAiC;IACjC,QAAQ,EAAE,MAAM,CAAC;IAEjB,oCAAoC;IACpC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,+BAA+B;IAC/B,MAAM,EAAE,aAAa,EAAE,CAAC;IAExB,mDAAmD;IACnD,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,6BAA6B;IAC7B,KA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kCAAkC;QAClC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE;QAC9B,4BAA4B;QAC5B;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE;KAC/B,CAAC;CACH"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task types for Salesflare MCP Server
|
|
3
|
+
*
|
|
4
|
+
* TypeScript interfaces and type definitions for Task CRUD operations.
|
|
5
|
+
*
|
|
6
|
+
* @module types/task
|
|
7
|
+
*/
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
import { createTaskListSchema, createTaskCreateSchema, createTaskUpdateSchema } from '../utils/validation.js';
|
|
10
|
+
/**
|
|
11
|
+
* Core task entity interface
|
|
12
|
+
* Represents a task in Salesflare CRM with essential fields (per D-01 to D-05)
|
|
13
|
+
*/
|
|
14
|
+
export interface Task {
|
|
15
|
+
/** Unique identifier (UUID) */
|
|
16
|
+
id: string;
|
|
17
|
+
/** Task description (required per D-01) */
|
|
18
|
+
description: string;
|
|
19
|
+
/** Task status: 'open' or 'completed' (per D-03) */
|
|
20
|
+
status: 'open' | 'completed';
|
|
21
|
+
/** Due date (ISO 8601, optional per D-02) */
|
|
22
|
+
due_date?: string;
|
|
23
|
+
/** Assigned user information (optional per D-02) */
|
|
24
|
+
assigned_user?: {
|
|
25
|
+
/** User UUID */
|
|
26
|
+
id: string;
|
|
27
|
+
/** User name */
|
|
28
|
+
name: string;
|
|
29
|
+
};
|
|
30
|
+
/** Related contact information (optional per D-05, mutually exclusive with related_deal) */
|
|
31
|
+
related_contact?: {
|
|
32
|
+
/** Contact UUID */
|
|
33
|
+
id: string;
|
|
34
|
+
/** Contact name */
|
|
35
|
+
name: string;
|
|
36
|
+
};
|
|
37
|
+
/** Related deal information (optional per D-05, mutually exclusive with related_contact) */
|
|
38
|
+
related_deal?: {
|
|
39
|
+
/** Deal UUID */
|
|
40
|
+
id: string;
|
|
41
|
+
/** Deal name */
|
|
42
|
+
name: string;
|
|
43
|
+
};
|
|
44
|
+
/** Completion timestamp (ISO 8601, set when status changes to 'completed' per D-02) */
|
|
45
|
+
completed_at?: string;
|
|
46
|
+
/** Whether the task is overdue (calculated field per D-04) */
|
|
47
|
+
is_overdue: boolean;
|
|
48
|
+
/** Creation timestamp (ISO 8601) */
|
|
49
|
+
created_at: string;
|
|
50
|
+
/** Last update timestamp (ISO 8601) */
|
|
51
|
+
updated_at: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Paginated task list response
|
|
55
|
+
* Returned by the list tasks endpoint
|
|
56
|
+
*/
|
|
57
|
+
export interface TaskListResponse {
|
|
58
|
+
/** Array of tasks for the current page */
|
|
59
|
+
tasks: Task[];
|
|
60
|
+
/** Total number of tasks matching the filter */
|
|
61
|
+
total: number;
|
|
62
|
+
/** Current page number (1-indexed) */
|
|
63
|
+
page: number;
|
|
64
|
+
/** Number of items per page */
|
|
65
|
+
limit: number;
|
|
66
|
+
/** Whether there are more pages available */
|
|
67
|
+
has_more: boolean;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Filter parameters for listing tasks
|
|
71
|
+
* All fields are optional - omit to skip filtering (per D-06 to D-12)
|
|
72
|
+
*/
|
|
73
|
+
export interface TaskListFilters {
|
|
74
|
+
/** Filter by task status (per D-06) */
|
|
75
|
+
status?: 'open' | 'completed';
|
|
76
|
+
/** Filter by assigned user ID (per D-07) */
|
|
77
|
+
assigned_user_id?: string;
|
|
78
|
+
/** Filter by related contact ID (per D-08) */
|
|
79
|
+
related_contact_id?: string;
|
|
80
|
+
/** Filter by related deal ID (per D-09) */
|
|
81
|
+
related_deal_id?: string;
|
|
82
|
+
/** Filter by overdue status (per D-10) */
|
|
83
|
+
is_overdue?: boolean;
|
|
84
|
+
/** Filter tasks due before this date (ISO 8601, per D-11) */
|
|
85
|
+
due_before?: string;
|
|
86
|
+
/** Filter tasks due after this date (ISO 8601, per D-11) */
|
|
87
|
+
due_after?: string;
|
|
88
|
+
/** Page number (default: 1) */
|
|
89
|
+
page?: number;
|
|
90
|
+
/** Items per page (default: 20, max: 100) */
|
|
91
|
+
limit?: number;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Input data for creating a new task
|
|
95
|
+
* Description is required per D-26; other fields are optional
|
|
96
|
+
*/
|
|
97
|
+
export interface TaskCreateInput {
|
|
98
|
+
/** Task description (required per D-26) */
|
|
99
|
+
description: string;
|
|
100
|
+
/** Due date (ISO 8601, optional) */
|
|
101
|
+
due_date?: string;
|
|
102
|
+
/** Assigned user ID (UUID, optional) */
|
|
103
|
+
assigned_user_id?: string;
|
|
104
|
+
/** Related contact ID (UUID, optional per D-05, mutually exclusive with related_deal_id) */
|
|
105
|
+
related_contact_id?: string;
|
|
106
|
+
/** Related deal ID (UUID, optional per D-05, mutually exclusive with related_contact_id) */
|
|
107
|
+
related_deal_id?: string;
|
|
108
|
+
/** Task status (defaults to 'open' per D-30) */
|
|
109
|
+
status?: 'open' | 'completed';
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Input data for updating an existing task
|
|
113
|
+
* All fields are optional - only provided fields will be updated (PATCH semantics per D-25)
|
|
114
|
+
*/
|
|
115
|
+
export interface TaskUpdateInput {
|
|
116
|
+
/** Task description (optional) */
|
|
117
|
+
description?: string;
|
|
118
|
+
/** Due date (ISO 8601, optional) */
|
|
119
|
+
due_date?: string;
|
|
120
|
+
/** Assigned user ID (UUID, optional) */
|
|
121
|
+
assigned_user_id?: string;
|
|
122
|
+
/** Task status (optional) */
|
|
123
|
+
status?: 'open' | 'completed';
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Type inference from schemas for runtime validation
|
|
127
|
+
* These types are derived from the Zod validation schemas
|
|
128
|
+
*/
|
|
129
|
+
/** Type for task list parameters (inferred from schema) */
|
|
130
|
+
export type TaskListParams = z.infer<ReturnType<typeof createTaskListSchema>>;
|
|
131
|
+
/** Type for task create data (inferred from schema) */
|
|
132
|
+
export type TaskCreateData = z.infer<ReturnType<typeof createTaskCreateSchema>>;
|
|
133
|
+
/** Type for task update data (inferred from schema) */
|
|
134
|
+
export type TaskUpdateData = z.infer<ReturnType<typeof createTaskUpdateSchema>>;
|
|
135
|
+
/**
|
|
136
|
+
* Standard MCP tool response format for task operations
|
|
137
|
+
* Returns both human-readable text and structured JSON data
|
|
138
|
+
*/
|
|
139
|
+
export interface TaskToolResponse {
|
|
140
|
+
/** Response content array */
|
|
141
|
+
content: [
|
|
142
|
+
/** Human-readable summary text */
|
|
143
|
+
{
|
|
144
|
+
type: 'text';
|
|
145
|
+
text: string;
|
|
146
|
+
},
|
|
147
|
+
/** JSON stringified data */
|
|
148
|
+
{
|
|
149
|
+
type: 'text';
|
|
150
|
+
text: string;
|
|
151
|
+
}
|
|
152
|
+
];
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=task.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task.d.ts","sourceRoot":"","sources":["../../src/types/task.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAEhC;;;GAGG;AACH,MAAM,WAAW,IAAI;IACnB,+BAA+B;IAC/B,EAAE,EAAE,MAAM,CAAC;IAEX,2CAA2C;IAC3C,WAAW,EAAE,MAAM,CAAC;IAEpB,oDAAoD;IACpD,MAAM,EAAE,MAAM,GAAG,WAAW,CAAC;IAE7B,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,oDAAoD;IACpD,aAAa,CAAC,EAAE;QACd,gBAAgB;QAChB,EAAE,EAAE,MAAM,CAAC;QACX,gBAAgB;QAChB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IAEF,4FAA4F;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CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE;KAC/B,CAAC;CACH"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error handling utilities for Salesflare MCP Server
|
|
3
|
+
*
|
|
4
|
+
* Provides standardized error types with actionable messages for LLM consumers.
|
|
5
|
+
*
|
|
6
|
+
* @module utils/errors
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Standardized error codes for Salesflare MCP Server
|
|
10
|
+
*
|
|
11
|
+
* These codes enable programmatic error handling by LLMs.
|
|
12
|
+
*/
|
|
13
|
+
export declare enum ErrorCode {
|
|
14
|
+
AUTH_INVALID = "AUTH_INVALID",
|
|
15
|
+
AUTH_EXPIRED = "AUTH_EXPIRED",
|
|
16
|
+
AUTH_REQUIRED = "AUTH_REQUIRED",
|
|
17
|
+
NOT_FOUND = "NOT_FOUND",
|
|
18
|
+
RATE_LIMIT = "RATE_LIMIT",
|
|
19
|
+
SERVER_ERROR = "SERVER_ERROR",
|
|
20
|
+
API_ERROR = "API_ERROR",
|
|
21
|
+
NETWORK_ERROR = "NETWORK_ERROR",
|
|
22
|
+
VALIDATION_ERROR = "VALIDATION_ERROR",
|
|
23
|
+
INVALID_INPUT = "INVALID_INPUT",
|
|
24
|
+
CONFIG_ERROR = "CONFIG_ERROR",
|
|
25
|
+
MISSING_ENV_VAR = "MISSING_ENV_VAR"
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Structured error metadata for LLM consumption
|
|
29
|
+
*/
|
|
30
|
+
export interface ErrorMetadata {
|
|
31
|
+
/** The error code for programmatic handling */
|
|
32
|
+
code: ErrorCode;
|
|
33
|
+
/** Human-readable error message */
|
|
34
|
+
message: string;
|
|
35
|
+
/** Suggested fix for the error */
|
|
36
|
+
fix?: string;
|
|
37
|
+
/** Whether the operation can be retried */
|
|
38
|
+
retryable: boolean;
|
|
39
|
+
/** HTTP status code if from API */
|
|
40
|
+
statusCode?: number;
|
|
41
|
+
/** Additional context */
|
|
42
|
+
details?: Record<string, unknown>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Base error class for Salesflare MCP Server
|
|
46
|
+
*
|
|
47
|
+
* Provides structured error information with codes, fix suggestions,
|
|
48
|
+
* and retry guidance for LLM consumers.
|
|
49
|
+
*/
|
|
50
|
+
export declare class SalesflareError extends Error {
|
|
51
|
+
/** Error code for programmatic handling */
|
|
52
|
+
readonly code: ErrorCode;
|
|
53
|
+
/** Suggested fix for the error */
|
|
54
|
+
readonly fix?: string;
|
|
55
|
+
/** Whether the operation can be retried */
|
|
56
|
+
readonly retryable: boolean;
|
|
57
|
+
/** HTTP status code if applicable */
|
|
58
|
+
readonly statusCode?: number;
|
|
59
|
+
/** Additional error details */
|
|
60
|
+
readonly details?: Record<string, unknown>;
|
|
61
|
+
/**
|
|
62
|
+
* Create a new SalesflareError
|
|
63
|
+
*
|
|
64
|
+
* @param metadata - Error metadata including code, message, and fix
|
|
65
|
+
*/
|
|
66
|
+
constructor(metadata: ErrorMetadata);
|
|
67
|
+
/**
|
|
68
|
+
* Convert error to JSON-serializable object
|
|
69
|
+
*
|
|
70
|
+
* @returns Error metadata as plain object
|
|
71
|
+
*/
|
|
72
|
+
toJSON(): ErrorMetadata;
|
|
73
|
+
/**
|
|
74
|
+
* Format error for MCP tool response
|
|
75
|
+
*
|
|
76
|
+
* @returns Formatted error string with fix suggestion
|
|
77
|
+
*/
|
|
78
|
+
toToolResponse(): string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Create an authentication error
|
|
82
|
+
*
|
|
83
|
+
* @param message - Error message
|
|
84
|
+
* @param fix - Suggested fix
|
|
85
|
+
* @returns SalesflareError with AUTH_INVALID code
|
|
86
|
+
*/
|
|
87
|
+
export declare function createAuthError(message: string, fix?: string): SalesflareError;
|
|
88
|
+
/**
|
|
89
|
+
* Create a validation error
|
|
90
|
+
*
|
|
91
|
+
* @param message - Error message
|
|
92
|
+
* @param details - Validation details
|
|
93
|
+
* @returns SalesflareError with VALIDATION_ERROR code
|
|
94
|
+
*/
|
|
95
|
+
export declare function createValidationError(message: string, details?: Record<string, unknown>): SalesflareError;
|
|
96
|
+
/**
|
|
97
|
+
* Create a configuration error
|
|
98
|
+
*
|
|
99
|
+
* @param message - Error message
|
|
100
|
+
* @param fix - Suggested fix
|
|
101
|
+
* @returns SalesflareError with CONFIG_ERROR code
|
|
102
|
+
*/
|
|
103
|
+
export declare function createConfigError(message: string, fix?: string): SalesflareError;
|
|
104
|
+
/**
|
|
105
|
+
* Create a missing environment variable error
|
|
106
|
+
*
|
|
107
|
+
* @param varName - Name of the missing environment variable
|
|
108
|
+
* @returns SalesflareError with MISSING_ENV_VAR code
|
|
109
|
+
*/
|
|
110
|
+
export declare function createMissingEnvVarError(varName: string): SalesflareError;
|
|
111
|
+
/**
|
|
112
|
+
* Formatted error response with actionable fix suggestion
|
|
113
|
+
*/
|
|
114
|
+
export interface ErrorResponse {
|
|
115
|
+
code: ErrorCode;
|
|
116
|
+
message: string;
|
|
117
|
+
details?: Record<string, unknown>;
|
|
118
|
+
retryable: boolean;
|
|
119
|
+
fix: string;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Format any error into a consistent error response with actionable fix suggestion
|
|
123
|
+
*
|
|
124
|
+
* @param error - The error to format (SalesflareError, generic Error, or unknown)
|
|
125
|
+
* @returns Formatted error response with code, message, details, retryable flag, and fix suggestion
|
|
126
|
+
*/
|
|
127
|
+
export declare function formatErrorResponse(error: unknown): ErrorResponse;
|
|
128
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;GAIG;AACH,oBAAY,SAAS;IAEnB,YAAY,iBAAiB;IAC7B,YAAY,iBAAiB;IAC7B,aAAa,kBAAkB;IAG/B,SAAS,cAAc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