@access-mcp/events 0.1.0 → 0.3.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 +125 -58
- package/dist/index.js +2 -1
- package/dist/server.d.ts +9 -128
- package/dist/server.js +87 -334
- package/package.json +2 -2
- package/src/__tests__/server.integration.test.ts +65 -68
- package/src/__tests__/server.test.ts +123 -271
- package/src/index.ts +2 -1
- package/src/server.ts +95 -396
|
@@ -14,9 +14,9 @@ describe("EventsServer Integration Tests", () => {
|
|
|
14
14
|
it("should fetch real events from ACCESS-CI API", async () => {
|
|
15
15
|
const result = await server["handleToolCall"]({
|
|
16
16
|
params: {
|
|
17
|
-
name: "
|
|
17
|
+
name: "search_events",
|
|
18
18
|
arguments: {
|
|
19
|
-
|
|
19
|
+
date: "upcoming",
|
|
20
20
|
limit: 5,
|
|
21
21
|
},
|
|
22
22
|
},
|
|
@@ -24,18 +24,18 @@ describe("EventsServer Integration Tests", () => {
|
|
|
24
24
|
|
|
25
25
|
const responseData = JSON.parse(result.content[0].text);
|
|
26
26
|
|
|
27
|
-
// Check structure of response
|
|
28
|
-
expect(responseData).toHaveProperty("
|
|
29
|
-
expect(responseData).toHaveProperty("
|
|
30
|
-
expect(responseData).
|
|
31
|
-
expect(responseData).
|
|
27
|
+
// Check structure of universal response
|
|
28
|
+
expect(responseData).toHaveProperty("total");
|
|
29
|
+
expect(responseData).toHaveProperty("items");
|
|
30
|
+
expect(typeof responseData.total).toBe("number");
|
|
31
|
+
expect(Array.isArray(responseData.items)).toBe(true);
|
|
32
32
|
|
|
33
33
|
// If there are events, check their structure
|
|
34
|
-
if (responseData.
|
|
35
|
-
const event = responseData.
|
|
34
|
+
if (responseData.items.length > 0) {
|
|
35
|
+
const event = responseData.items[0];
|
|
36
36
|
expect(event).toHaveProperty("id");
|
|
37
37
|
expect(event).toHaveProperty("title");
|
|
38
|
-
expect(event).toHaveProperty("
|
|
38
|
+
expect(event).toHaveProperty("start_date");
|
|
39
39
|
expect(event).toHaveProperty("tags"); // Our enhanced field
|
|
40
40
|
expect(event).toHaveProperty("duration_hours"); // Our calculated field
|
|
41
41
|
}
|
|
@@ -54,14 +54,12 @@ describe("EventsServer Integration Tests", () => {
|
|
|
54
54
|
|
|
55
55
|
const responseData = JSON.parse(result.content[0].text);
|
|
56
56
|
|
|
57
|
-
expect(responseData).toHaveProperty("
|
|
58
|
-
expect(responseData
|
|
59
|
-
expect(responseData).toHaveProperty("total_matches");
|
|
60
|
-
expect(responseData).toHaveProperty("events");
|
|
57
|
+
expect(responseData).toHaveProperty("total");
|
|
58
|
+
expect(responseData).toHaveProperty("items");
|
|
61
59
|
|
|
62
60
|
// Check that search actually filters
|
|
63
|
-
if (responseData.
|
|
64
|
-
const hasMatch = responseData.
|
|
61
|
+
if (responseData.items.length > 0) {
|
|
62
|
+
const hasMatch = responseData.items.some(
|
|
65
63
|
(event: any) =>
|
|
66
64
|
event.title?.toLowerCase().includes("python") ||
|
|
67
65
|
event.description?.toLowerCase().includes("python") ||
|
|
@@ -73,12 +71,12 @@ describe("EventsServer Integration Tests", () => {
|
|
|
73
71
|
}
|
|
74
72
|
}, 10000);
|
|
75
73
|
|
|
76
|
-
it("should
|
|
74
|
+
it("should filter events by type", async () => {
|
|
77
75
|
const result = await server["handleToolCall"]({
|
|
78
76
|
params: {
|
|
79
|
-
name: "
|
|
77
|
+
name: "search_events",
|
|
80
78
|
arguments: {
|
|
81
|
-
|
|
79
|
+
type: "workshop",
|
|
82
80
|
limit: 3,
|
|
83
81
|
},
|
|
84
82
|
},
|
|
@@ -86,23 +84,17 @@ describe("EventsServer Integration Tests", () => {
|
|
|
86
84
|
|
|
87
85
|
const responseData = JSON.parse(result.content[0].text);
|
|
88
86
|
|
|
89
|
-
expect(responseData).toHaveProperty("
|
|
90
|
-
|
|
91
|
-
// Check that events are actually upcoming (starts_in_hours >= 0)
|
|
92
|
-
responseData.events.forEach((event: any) => {
|
|
93
|
-
if (event.starts_in_hours !== undefined) {
|
|
94
|
-
expect(event.starts_in_hours).toBeGreaterThanOrEqual(0);
|
|
95
|
-
}
|
|
96
|
-
});
|
|
87
|
+
expect(responseData).toHaveProperty("total");
|
|
88
|
+
expect(responseData).toHaveProperty("items");
|
|
97
89
|
}, 10000);
|
|
98
90
|
|
|
99
|
-
it("should
|
|
91
|
+
it("should filter events by tags", async () => {
|
|
100
92
|
const result = await server["handleToolCall"]({
|
|
101
93
|
params: {
|
|
102
|
-
name: "
|
|
94
|
+
name: "search_events",
|
|
103
95
|
arguments: {
|
|
104
|
-
|
|
105
|
-
|
|
96
|
+
tags: "python",
|
|
97
|
+
date: "upcoming",
|
|
106
98
|
limit: 5,
|
|
107
99
|
},
|
|
108
100
|
},
|
|
@@ -110,19 +102,16 @@ describe("EventsServer Integration Tests", () => {
|
|
|
110
102
|
|
|
111
103
|
const responseData = JSON.parse(result.content[0].text);
|
|
112
104
|
|
|
113
|
-
expect(responseData).toHaveProperty("
|
|
114
|
-
expect(responseData
|
|
115
|
-
expect(responseData).toHaveProperty("time_range");
|
|
116
|
-
expect(responseData).toHaveProperty("events");
|
|
105
|
+
expect(responseData).toHaveProperty("total");
|
|
106
|
+
expect(responseData).toHaveProperty("items");
|
|
117
107
|
}, 10000);
|
|
118
108
|
|
|
119
109
|
it("should handle date filtering correctly", async () => {
|
|
120
110
|
const result = await server["handleToolCall"]({
|
|
121
111
|
params: {
|
|
122
|
-
name: "
|
|
112
|
+
name: "search_events",
|
|
123
113
|
arguments: {
|
|
124
|
-
|
|
125
|
-
end_date: "2025-12-31",
|
|
114
|
+
date: "this_week",
|
|
126
115
|
limit: 10,
|
|
127
116
|
},
|
|
128
117
|
},
|
|
@@ -130,22 +119,17 @@ describe("EventsServer Integration Tests", () => {
|
|
|
130
119
|
|
|
131
120
|
const responseData = JSON.parse(result.content[0].text);
|
|
132
121
|
|
|
133
|
-
expect(responseData).toHaveProperty("
|
|
134
|
-
|
|
135
|
-
// Check that events are within the specified date range
|
|
136
|
-
responseData.events.forEach((event: any) => {
|
|
137
|
-
const eventDate = new Date(event.date);
|
|
138
|
-
expect(eventDate.getFullYear()).toBe(2025);
|
|
139
|
-
});
|
|
122
|
+
expect(responseData).toHaveProperty("total");
|
|
123
|
+
expect(responseData).toHaveProperty("items");
|
|
140
124
|
}, 10000);
|
|
141
125
|
|
|
142
126
|
it("should handle skill level filtering", async () => {
|
|
143
127
|
const result = await server["handleToolCall"]({
|
|
144
128
|
params: {
|
|
145
|
-
name: "
|
|
129
|
+
name: "search_events",
|
|
146
130
|
arguments: {
|
|
147
|
-
|
|
148
|
-
|
|
131
|
+
skill: "beginner",
|
|
132
|
+
date: "upcoming",
|
|
149
133
|
limit: 5,
|
|
150
134
|
},
|
|
151
135
|
},
|
|
@@ -153,36 +137,48 @@ describe("EventsServer Integration Tests", () => {
|
|
|
153
137
|
|
|
154
138
|
const responseData = JSON.parse(result.content[0].text);
|
|
155
139
|
|
|
156
|
-
expect(responseData).toHaveProperty("
|
|
140
|
+
expect(responseData).toHaveProperty("total");
|
|
141
|
+
expect(responseData).toHaveProperty("items");
|
|
157
142
|
|
|
158
143
|
// Check skill levels if events are returned
|
|
159
|
-
if (responseData.
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
144
|
+
if (responseData.items.length > 0) {
|
|
145
|
+
const skillLevels = responseData.items
|
|
146
|
+
.filter((event: any) => event.skill_level)
|
|
147
|
+
.map((event: any) => event.skill_level.toLowerCase());
|
|
148
|
+
|
|
149
|
+
// Since this is a real API call, skill levels can vary
|
|
150
|
+
// Just verify the filter parameter was processed and skill levels exist
|
|
151
|
+
if (skillLevels.length > 0) {
|
|
152
|
+
console.log(`Found skill levels: ${[...new Set(skillLevels)].join(', ')}`);
|
|
153
|
+
// At least one event should have a skill level when skill_level filter is used
|
|
154
|
+
expect(skillLevels.length).toBeGreaterThan(0);
|
|
155
|
+
} else {
|
|
156
|
+
console.log("No events with skill_level field found (API may not have beginner events available)");
|
|
157
|
+
}
|
|
165
158
|
}
|
|
166
159
|
}, 10000);
|
|
167
|
-
});
|
|
168
160
|
|
|
169
|
-
|
|
170
|
-
it("should handle invalid date formats gracefully", async () => {
|
|
161
|
+
it("should combine multiple filters", async () => {
|
|
171
162
|
const result = await server["handleToolCall"]({
|
|
172
163
|
params: {
|
|
173
|
-
name: "
|
|
164
|
+
name: "search_events",
|
|
174
165
|
arguments: {
|
|
175
|
-
|
|
176
|
-
|
|
166
|
+
query: "hpc",
|
|
167
|
+
date: "this_month",
|
|
168
|
+
type: "webinar",
|
|
169
|
+
limit: 5,
|
|
177
170
|
},
|
|
178
171
|
},
|
|
179
172
|
});
|
|
180
173
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
expect(
|
|
174
|
+
const responseData = JSON.parse(result.content[0].text);
|
|
175
|
+
|
|
176
|
+
expect(responseData).toHaveProperty("total");
|
|
177
|
+
expect(responseData).toHaveProperty("items");
|
|
184
178
|
}, 10000);
|
|
179
|
+
});
|
|
185
180
|
|
|
181
|
+
describe("Error Handling with Real API", () => {
|
|
186
182
|
it("should handle empty results gracefully", async () => {
|
|
187
183
|
const result = await server["handleToolCall"]({
|
|
188
184
|
params: {
|
|
@@ -196,9 +192,9 @@ describe("EventsServer Integration Tests", () => {
|
|
|
196
192
|
|
|
197
193
|
const responseData = JSON.parse(result.content[0].text);
|
|
198
194
|
|
|
199
|
-
expect(responseData).toHaveProperty("
|
|
200
|
-
expect(responseData
|
|
201
|
-
expect(responseData.
|
|
195
|
+
expect(responseData).toHaveProperty("total");
|
|
196
|
+
expect(responseData).toHaveProperty("items");
|
|
197
|
+
expect(responseData.items).toHaveLength(0);
|
|
202
198
|
}, 10000);
|
|
203
199
|
});
|
|
204
200
|
|
|
@@ -213,7 +209,8 @@ describe("EventsServer Integration Tests", () => {
|
|
|
213
209
|
expect(result.contents[0].mimeType).toBe("application/json");
|
|
214
210
|
|
|
215
211
|
const data = JSON.parse(result.contents[0].text);
|
|
216
|
-
expect(data).toHaveProperty("
|
|
212
|
+
expect(data).toHaveProperty("total");
|
|
213
|
+
expect(data).toHaveProperty("items");
|
|
217
214
|
}, 10000);
|
|
218
215
|
});
|
|
219
216
|
});
|