From 53dd8f03c4c52903089d29ab9134f930cf414568 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 9 Oct 2025 07:22:40 +0200 Subject: [PATCH] Fix: Use Zod schemas for messaging tools MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- src/tools/builtin/messaging.ts | 44 ++++++++-------------------------- 1 file changed, 10 insertions(+), 34 deletions(-) diff --git a/src/tools/builtin/messaging.ts b/src/tools/builtin/messaging.ts index 88151c6..34f71cd 100644 --- a/src/tools/builtin/messaging.ts +++ b/src/tools/builtin/messaging.ts @@ -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[] = [];