MCPcopy Create free account
hub / github.com/modelcontextprotocol/go-sdk / ReadGraph

Method ReadGraph

examples/server/memory/kb.go:525–538  ·  view source on GitHub ↗
(ctx context.Context, req *mcp.CallToolRequest, args any)

Source from the content-addressed store, hash-verified

523}
524
525func (k knowledgeBase) ReadGraph(ctx context.Context, req *mcp.CallToolRequest, args any) (*mcp.CallToolResult, KnowledgeGraph, error) {
526 var res mcp.CallToolResult
527
528 graph, err := k.loadGraph()
529 if err != nil {
530 return nil, KnowledgeGraph{}, err
531 }
532
533 res.Content = []mcp.Content{
534 &mcp.TextContent{Text: "Graph read successfully"},
535 }
536
537 return &res, graph, nil
538}
539
540func (k knowledgeBase) SearchNodes(ctx context.Context, req *mcp.CallToolRequest, args SearchNodesArgs) (*mcp.CallToolResult, KnowledgeGraph, error) {
541 var res mcp.CallToolResult

Callers 1

TestMCPServerIntegrationFunction · 0.95

Calls 1

loadGraphMethod · 0.95

Tested by 1

TestMCPServerIntegrationFunction · 0.76