Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jun 7, 2025

Adds the missing queryGraph method to the SDK's MemoryClient class to support the graph query endpoint that was added in commit 376ce93.

Changes

  • Added queryGraph method to MemoryClient class following the same pattern as other query methods
  • Imported graph query schemas (QueryGraphRequest, QueryGraphResponse, queryGraphResponseSchema) from the existing schema module
  • Exported query-graph schema from SDK index to make types available to consumers

Usage

import { MemoryClient } from '@marcelsamyn/memory/sdk';

const client = new MemoryClient({ baseUrl: 'http://localhost:3000' });

// Query the knowledge graph
const result = await client.queryGraph({
  userId: 'user123',
  query: 'machine learning',  // optional
  maxNodes: 50               // optional, defaults to 100
});

console.log(result.nodes);  // Array of graph nodes
console.log(result.edges);  // Array of graph edges

Implementation Details

The implementation is minimal and maintains consistency with the existing codebase:

  • Uses the same _fetch pattern as other query methods
  • Leverages existing schemas for type safety
  • No breaking changes to existing functionality

Fixes #21.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: iamarcel <1212234+iamarcel@users.noreply.github.com>
Copilot AI changed the title [WIP] SDK graph query Add queryGraph method to SDK MemoryClient Jun 7, 2025
Copilot AI requested a review from marcelsamyn June 7, 2025 08:01
@marcelsamyn marcelsamyn marked this pull request as ready for review June 7, 2025 08:14
@marcelsamyn marcelsamyn merged commit 14e93a5 into main Jun 7, 2025
1 check failed
@marcelsamyn marcelsamyn deleted the copilot/fix-21 branch June 7, 2025 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SDK graph query

2 participants