Skip to main content
Glama
by RadonX
debug-create-note.js•2.76 kB
#!/usr/bin/env node import 'dotenv/config'; import { TriliumClient } from '../src/utils/trilium-client.js'; import { createNote } from '../src/tools/create-note.js'; console.log('šŸ” Create Note Debugging Script'); console.log('================================'); const client = new TriliumClient(); async function debugCreateNote() { try { console.log('šŸ“Š Testing different scenarios...\n'); // Test 1: Without parentNoteId (current failing case) console.log('1ļøāƒ£ Testing without parentNoteId (likely to fail):'); try { const result1 = await createNote(client, { title: 'Test Note 1', content: 'This is a test note without parentNoteId', type: 'text' }); console.log('āœ… Success:', result1.content[0].text); } catch (error) { console.log('āŒ Failed:', error.message); } console.log('\n2ļøāƒ£ Testing with parentNoteId="root":'); try { const result2 = await createNote(client, { title: 'Test Note 2', content: 'This is a test note with root parentNoteId', type: 'text', parentNoteId: 'root' }); console.log('āœ… Success:', result2.content[0].text); } catch (error) { console.log('āŒ Failed:', error.message); } console.log('\n3ļøāƒ£ Testing direct API call to understand response:'); try { const directResult = await client.post('create-note', { title: 'Direct API Test', content: 'Testing direct API call', type: 'text', parentNoteId: 'root' }); console.log('āœ… Direct API Success:', JSON.stringify(directResult, null, 2)); } catch (error) { console.log('āŒ Direct API Failed:', error.message); if (error.response) { console.log(' Status:', error.response.status); console.log(' Data:', JSON.stringify(error.response.data, null, 2)); } } console.log('\n4ļøāƒ£ Testing what happens with missing title:'); try { const result4 = await createNote(client, { content: 'Note without title', type: 'text', parentNoteId: 'root' }); console.log('āœ… Success without title:', result4.content[0].text); } catch (error) { console.log('āŒ Failed without title:', error.message); } } catch (error) { console.error('🚨 Debugging script failed:', error); } } // First test connectivity console.log('šŸ”— Testing connectivity...'); try { const info = await client.get('app-info'); console.log('āœ… Connected to TriliumNext:', info?.appVersion || 'Unknown version'); console.log(); await debugCreateNote(); } catch (error) { console.error('āŒ Cannot connect to TriliumNext:', error.message); process.exit(1); }

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/RadonX/mcp-trilium'

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