Skip to main content
Glama

homeassistant-mcp

by tevonsb
helpers.test.ts1.38 kB
import { jest, describe, it, expect } from '@jest/globals'; import { formatToolCall } from '../src/helpers.js'; describe('helpers', () => { describe('formatToolCall', () => { it('should format an object into the correct structure', () => { const testObj = { name: 'test', value: 123 }; const result = formatToolCall(testObj); expect(result).toEqual({ content: [{ type: 'text', text: JSON.stringify(testObj, null, 2), isError: false }] }); }); it('should handle error cases correctly', () => { const testObj = { error: 'test error' }; const result = formatToolCall(testObj, true); expect(result).toEqual({ content: [{ type: 'text', text: JSON.stringify(testObj, null, 2), isError: true }] }); }); it('should handle empty objects', () => { const testObj = {}; const result = formatToolCall(testObj); expect(result).toEqual({ content: [{ type: 'text', text: '{}', isError: false }] }); }); }); });

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/tevonsb/homeassistant-mcp'

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