Skip to content

Commit 9b8637a

Browse files
validate type
1 parent 1b78fa0 commit 9b8637a

File tree

3 files changed

+47
-3
lines changed

3 files changed

+47
-3
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@walkeros/mcp': patch
3+
---
4+
5+
Fix validate output schema rejecting dot-notation types like
6+
destinations.snowplow

packages/mcp/src/__tests__/tools/output-schemas.test.ts

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,43 @@ describe('output schemas', () => {
6868
expect(result.success).toBe(true);
6969
});
7070

71-
it('rejects invalid type enum', () => {
71+
it('accepts dot-notation destination type', () => {
7272
const result = parseShape(ValidateOutputShape, {
7373
valid: true,
74-
type: 'invalid',
74+
type: 'destinations.snowplow',
75+
errors: [],
76+
warnings: [],
77+
details: {},
78+
});
79+
expect(result.success).toBe(true);
80+
});
81+
82+
it('accepts dot-notation source type', () => {
83+
const result = parseShape(ValidateOutputShape, {
84+
valid: true,
85+
type: 'sources.datalayer',
86+
errors: [],
87+
warnings: [],
88+
details: {},
89+
});
90+
expect(result.success).toBe(true);
91+
});
92+
93+
it('accepts dot-notation transformer type', () => {
94+
const result = parseShape(ValidateOutputShape, {
95+
valid: true,
96+
type: 'transformers.router',
97+
errors: [],
98+
warnings: [],
99+
details: {},
100+
});
101+
expect(result.success).toBe(true);
102+
});
103+
104+
it('rejects invalid type', () => {
105+
const result = parseShape(ValidateOutputShape, {
106+
valid: true,
107+
type: 'invalid.foo.bar',
75108
errors: [],
76109
warnings: [],
77110
details: {},

packages/mcp/src/schemas/output.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ export const ErrorOutputShape = {
1313
// CLI tool output shapes
1414
export const ValidateOutputShape = {
1515
valid: z.boolean().describe('Whether validation passed'),
16-
type: z.enum(['event', 'flow', 'mapping']).describe('What was validated'),
16+
type: z
17+
.union([
18+
z.enum(['event', 'flow', 'mapping']),
19+
z.string().regex(/^(destinations|sources|transformers)\.\w+$/),
20+
])
21+
.describe('What was validated'),
1722
errors: z
1823
.array(
1924
z.object({

0 commit comments

Comments
 (0)