Skip to main content
Glama
test-field-validation.jsβ€’1.72 kB
#!/usr/bin/env node // Test script for field validation improvements (Issue #388) import { handleUniversalCreate } from '../../dist/handlers/tool-configs/universal/shared-handlers.js'; import { UniversalResourceType } from '../../dist/handlers/tool-configs/universal/types.js'; async function testFieldValidation() { console.log('Testing field validation improvements for Issue #388\n'); console.log('='.repeat(60)); // Test 1: Wrong field name for tasks console.log('\nπŸ“ Test 1: Using wrong field name for tasks'); console.log( 'Attempting to create task with "title" instead of "content"...\n' ); try { await handleUniversalCreate({ resource_type: UniversalResourceType.TASKS, record_data: { title: 'My Task', // Wrong! Should be 'content' status: 'pending', // Also wrong! Should be 'is_completed' }, }); } catch (error) { console.log('Error message received:'); console.log('-'.repeat(40)); console.log(error.message); console.log('-'.repeat(40)); } // Test 2: Invalid resource type console.log('\n\nπŸ“ Test 2: Using invalid resource type'); console.log('Attempting to use "record" instead of "records"...\n'); try { await handleUniversalCreate({ resource_type: 'record', // Wrong! Not a valid type record_data: { name: 'Test', }, }); } catch (error) { console.log('Error message received:'); console.log('-'.repeat(40)); console.log(error.message); console.log('-'.repeat(40)); } console.log('\n\nβœ… Field validation test complete!'); console.log('The error messages above should be clear and helpful.'); } testFieldValidation().catch(console.error);

Latest Blog Posts

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/kesslerio/attio-mcp-server'

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