Skip to content

Commit f3ccf67

Browse files
author
flowcore-platform
committed
feat: bumbed flowcore sdk to latest version and added sensitive data support
1 parent fa519fd commit f3ccf67

File tree

4 files changed

+48
-33
lines changed

4 files changed

+48
-33
lines changed

bun.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"": {
55
"name": "mcp-flowcore-platform",
66
"dependencies": {
7-
"@flowcore/sdk": "^1.24.4",
7+
"@flowcore/sdk": "^1.47.1",
88
"@flowcore/sdk-oidc-client": "^1.3.1",
99
"@modelcontextprotocol/sdk": "^1.8.0",
1010
"jwt-decode": "^4.0.0",
@@ -43,7 +43,7 @@
4343

4444
"@deno/shim-deno-test": ["@deno/[email protected]", "", {}, "sha512-4nMhecpGlPi0cSzT67L+Tm+GOJqvuk8gqHBziqcUQOarnuIax1z96/gJHCSIz2Z0zhxE6Rzwb3IZXPtFh51j+w=="],
4545

46-
"@flowcore/sdk": ["@flowcore/sdk@1.24.4", "", { "dependencies": { "@deno/shim-deno": "~0.18.0", "@sinclair/typebox": "0.32.15", "rxjs": "^7.8.1", "ws": "^8.13.0" } }, "sha512-k3AyS+hfK0EbpnW8PnidLQHYv7AuyQ5fsK28lI1rm9tCHusjrRujBZ0vkqhhjEyjZnMUB4Dk6QdaDSmdRAXUxQ=="],
46+
"@flowcore/sdk": ["@flowcore/sdk@1.47.1", "", { "dependencies": { "@deno/shim-deno": "~0.18.0", "@sinclair/typebox": "0.32.15", "rxjs": "^7.8.1", "ws": "^8.13.0" } }, "sha512-Z92MoJUVuM3PKqI8jCFdv93DE16dcUG9eYJ/jOJt7bmufabTzHR0aSlLFfr7leUmJqIDTMaxqwh3a8LVWhDpvQ=="],
4747

4848
"@flowcore/sdk-oidc-client": ["@flowcore/[email protected]", "", {}, "sha512-fUHOmKDQYMqMDlh/KucJiDZ9he12QUkQ2KOJKCVy6GD7qsJs9qiJ8jV9th1Xeuz9kAca4TRXt+spMUhZ4CfUDw=="],
4949

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"typescript": "^5"
3232
},
3333
"dependencies": {
34-
"@flowcore/sdk": "^1.24.4",
34+
"@flowcore/sdk": "^1.47.1",
3535
"@flowcore/sdk-oidc-client": "^1.3.1",
3636
"@modelcontextprotocol/sdk": "^1.8.0",
3737
"jwt-decode": "^4.0.0",

src/index.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,16 +165,23 @@ server.tool(
165165

166166
server.tool(
167167
"get_event_type_info",
168-
"Get event information about an event type, like first and last time bucket and 5 example events",
168+
"Get event information about an event type, like first and last time bucket and 5 example events. Sensitive data should not be needed as it is masked in a correct format in the response, but if you need it ask the user if they are sure they want to include sensitive data, is false by default",
169169
{
170170
eventTypeId: z.string().describe("The event type ID to get information for"),
171+
tenant: z.string().describe("The tenant name to get event type info for"),
172+
includeSensitiveData: z
173+
.boolean()
174+
.optional()
175+
.describe(
176+
"Whether to include sensitive data in the response, CAUTION: This will return sensitive data from the event type, so use with caution, ask the user if they are sure they want to include sensitive data, is false by default",
177+
),
171178
},
172179
getEventTypeInfoHandler(flowcoreClient),
173180
)
174181

175182
server.tool(
176183
"get_events",
177-
"Get events for an event type, this can be paginated by using the cursor returned from the previous call. This is good for getting the payload of the events to inspect them. You can pageinate by using the cursor returned from the previous call. You can also filter by event id, time bucket, from event id, to event id, order, and page size. The order is ascending by default, and the page size is 500 by default. The cursor returned can be called nextCursor, it is a stringified object or a string, you need to pass it as is to paginate.",
184+
"Get events for an event type, this can be paginated by using the cursor returned from the previous call. This is good for getting the payload of the events to inspect them. You can pageinate by using the cursor returned from the previous call. You can also filter by event id, time bucket, from event id, to event id, order, and page size. The order is ascending by default, and the page size is 500 by default. The cursor returned can be called nextCursor, it is a stringified object or a string, you need to pass it as is to paginate. Sensitive data should not be needed as it is masked in a correct format in the response, but if you need it ask the user if they are sure they want to include sensitive data, is false by default",
178185
{
179186
tenant: z.string().describe("The tenant name to get events for"),
180187
eventTypeId: z.string().describe("The event type ID to get events for"),
@@ -198,6 +205,12 @@ server.tool(
198205
.enum(["asc", "desc"])
199206
.optional()
200207
.describe("The order of events (asc or desc). When using desc, pagination and filters are not possible"),
208+
includeSensitiveData: z
209+
.boolean()
210+
.optional()
211+
.describe(
212+
"Whether to include sensitive data in the response, CAUTION: This will return sensitive data from the event type, so use with caution, ask the user if they are sure they want to include sensitive data, is false by default",
213+
),
201214
},
202215
getEventsHandler(flowcoreClient),
203216
)

src/tools/get-event-type-info.ts

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,34 @@
1-
import { EventTypeInfoCommand, type FlowcoreClient } from "@flowcore/sdk";
1+
import { EventTypeInfoCommand, type FlowcoreClient } from "@flowcore/sdk"
22

33
export const getEventTypeInfoHandler =
4-
(flowcoreClient: FlowcoreClient) =>
5-
async ({ eventTypeId }: { eventTypeId: string }) => {
6-
try {
7-
const result = await flowcoreClient.execute(
8-
new EventTypeInfoCommand({ eventTypeId }),
9-
);
4+
(flowcoreClient: FlowcoreClient) =>
5+
async ({
6+
eventTypeId,
7+
tenant,
8+
includeSensitiveData,
9+
}: { eventTypeId: string; tenant: string; includeSensitiveData?: boolean }) => {
10+
try {
11+
const result = await flowcoreClient.execute(
12+
new EventTypeInfoCommand({ eventTypeId, tenant, includeSensitiveData: includeSensitiveData ?? false }),
13+
)
1014

11-
return {
12-
content: [
13-
{
14-
type: "text" as const,
15-
text: JSON.stringify(result),
16-
},
17-
],
18-
};
19-
} catch (error) {
20-
// Create properly typed content array for error
21-
const content = [
22-
{
23-
type: "text" as const,
24-
text: JSON.stringify(
25-
`Failed to get event type info with error: ${error}`,
26-
),
27-
},
28-
];
15+
return {
16+
content: [
17+
{
18+
type: "text" as const,
19+
text: JSON.stringify(result),
20+
},
21+
],
22+
}
23+
} catch (error) {
24+
// Create properly typed content array for error
25+
const content = [
26+
{
27+
type: "text" as const,
28+
text: JSON.stringify(`Failed to get event type info with error: ${error}`),
29+
},
30+
]
2931

30-
return { isError: true, content };
31-
}
32-
};
32+
return { isError: true, content }
33+
}
34+
}

0 commit comments

Comments
 (0)