Skip to main content
Glama
read-graph.js1.59 kB
// src/tools/graph/read-graph.ts // Outil: read_graph - Lire l'ensemble du graphe de connaissances import { knowledgeGraphManager } from "../../knowledge-graph/manager.js"; /** * Définition de l'outil read_graph */ export const readGraphTool = { name: "read_graph", description: "Read the entire knowledge graph", inputSchema: { type: "object", properties: {}, required: [], }, }; /** * Handler pour l'outil read_graph */ export const readGraphHandler = async (args) => { try { const graph = await knowledgeGraphManager.readGraph(); return { content: [{ type: "text", text: JSON.stringify(graph, null, 2) }] }; } catch (error) { console.error("Error in read_graph tool:", error); throw error; } }; /** * Test de l'outil (pour usage en développement) */ export async function testReadGraph() { console.log("Testing read_graph tool..."); try { // D'abord créer quelques données de test await knowledgeGraphManager.createEntities([ { name: "Test Entity for Read Graph", entityType: "Test", observations: ["Entity for testing read_graph tool"] } ]); // Lire le graphe const result = await readGraphHandler({}); console.log("✅ Test passed:", result ? "Oui" : "Non"); return result; } catch (error) { console.error("❌ Test failed:", error); throw 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/ali-48/rag-mcp-server'

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