Skip to main content
Glama

HomeAssistant MCP

test-final-schema.ts1.56 kB
import { z } from 'zod'; import { zodToJsonSchema } from 'zod-to-json-schema'; const schema = z.object({ action: z .enum(["create", "update", "delete", "duplicate"]) .describe("Action to perform with automation config"), automation_id: z .string() .optional() .describe("Automation ID (required for update, delete, and duplicate)"), config: z .record(z.string(), z.unknown()) .optional() .describe("Automation configuration object (required for create and update)"), }); try { const jsonSchema = zodToJsonSchema(schema); console.log(JSON.stringify(jsonSchema, null, 2)); // Verify it has proper array validation const verify = (obj: any, path: string[] = []): boolean => { if (!obj) return true; if (obj.type === 'array' && !obj.items) { console.error(`ERROR: Array at ${path.join('.')} missing items!`); return false; } for (const [key, value] of Object.entries(obj)) { if (typeof value === 'object' && value !== null && !Array.isArray(value)) { if (!verify(value, [...path, key])) return false; } else if (Array.isArray(value)) { for (const item of value) { if (typeof item === 'object' && item !== null) { if (!verify(item, [...path, key])) return false; } } } } return true; }; if (verify(jsonSchema)) { console.log('\n✓ Schema validation passed: all arrays have items property'); } } catch (error) { console.error('Error:', error instanceof Error ? error.message : error); }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jango-blockchained/advanced-homeassistant-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server