Fix: Use Zod schemas for messaging tools
- Replace plain object inputSchema with Zod schemas - Fixes TypeScript compilation error - Use z.enum() for role validation - Use z.record(z.any()) for optional data object 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { ToolHandler } from '../base/ToolHandler';
|
||||
import { NatsClient } from '../../nats/NatsClient';
|
||||
import { z } from 'zod';
|
||||
|
||||
// Detect current developer role from workspace
|
||||
function detectRole(): string {
|
||||
@@ -14,29 +15,12 @@ export class SendMessageTool extends ToolHandler {
|
||||
name = 'send_message';
|
||||
description = 'Send real-time message to another developer via NATS';
|
||||
|
||||
inputSchema = {
|
||||
type: 'object' as const,
|
||||
properties: {
|
||||
to: {
|
||||
type: 'string',
|
||||
description: 'Recipient role: admin-dev, api-dev, or web-dev',
|
||||
enum: ['admin-dev', 'api-dev', 'web-dev'],
|
||||
},
|
||||
subject: {
|
||||
type: 'string',
|
||||
description: 'Message subject/title',
|
||||
},
|
||||
message: {
|
||||
type: 'string',
|
||||
description: 'Message content',
|
||||
},
|
||||
data: {
|
||||
type: 'object',
|
||||
description: 'Optional structured data',
|
||||
},
|
||||
},
|
||||
required: ['to', 'subject', 'message'],
|
||||
};
|
||||
schema = z.object({
|
||||
to: z.enum(['admin-dev', 'api-dev', 'web-dev']).describe('Recipient role'),
|
||||
subject: z.string().describe('Message subject/title'),
|
||||
message: z.string().describe('Message content'),
|
||||
data: z.record(z.any()).optional().describe('Optional structured data'),
|
||||
});
|
||||
|
||||
constructor(private natsClient: NatsClient) {
|
||||
super();
|
||||
@@ -72,17 +56,9 @@ export class ReceiveMessagesTool extends ToolHandler {
|
||||
name = 'receive_messages';
|
||||
description = 'Receive real-time messages from other developers via NATS';
|
||||
|
||||
inputSchema = {
|
||||
type: 'object' as const,
|
||||
properties: {
|
||||
limit: {
|
||||
type: 'number',
|
||||
description: 'Maximum number of messages to return (default: 10)',
|
||||
default: 10,
|
||||
},
|
||||
},
|
||||
required: [],
|
||||
};
|
||||
schema = z.object({
|
||||
limit: z.number().default(10).describe('Maximum number of messages to return'),
|
||||
});
|
||||
|
||||
private messages: any[] = [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user