Skip to main content
Glama

DetachRelation

Remove relationships between records in RushDB by specifying source ID, target IDs, and relation type to manage your graph database connections.

Instructions

Remove a relationship between records (single or multiple targets)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
directionNoDirection of the relationshipoutgoing
relationTypeNoType of the relationship to remove
sourceIdYesID of the source record
targetIdNoID of one target record (deprecated if targetIds provided)
targetIdsNoIDs of multiple target records
transactionIdNoOptional transaction ID for atomic relation removal

Implementation Reference

  • The core handler function that performs the DetachRelation operation using the database API.
    export async function DetachRelation(params: { sourceId: string targetId?: string targetIds?: string[] relationType?: string direction?: 'outgoing' | 'incoming' | 'bidirectional' transactionId?: string }) { const { sourceId, targetId, targetIds, relationType, direction = 'outgoing', transactionId } = params const options: any = {} if (relationType) { options.typeOrTypes = relationType } if (direction) { options.direction = direction } const targets: string[] = targetIds && targetIds.length > 0 ? targetIds : targetId ? [targetId] : [] if (targets.length === 0) { return { success: false, message: 'No targetId(s) provided' } } await db.records.detach({ source: sourceId, target: targets, options }, transactionId) return { success: true, message: `Relationship detached from '${sourceId}' to ${targets.length} target record(s)` } }
  • Defines the input schema, description, and registers DetachRelation in the tools list for MCP ListTools.
    { name: 'DetachRelation', description: 'Remove a relationship between records (single or multiple targets)', inputSchema: { type: 'object', properties: { sourceId: { type: 'string', description: 'ID of the source record' }, targetId: { type: 'string', description: 'ID of one target record (deprecated if targetIds provided)' }, targetIds: { type: 'array', items: { type: 'string' }, description: 'IDs of multiple target records' }, relationType: { type: 'string', description: 'Type of the relationship to remove' }, direction: { type: 'string', enum: ['outgoing', 'incoming', 'bidirectional'], description: 'Direction of the relationship', default: 'outgoing' }, transactionId: { type: 'string', description: 'Optional transaction ID for atomic relation removal' } }, required: ['sourceId'] } },
  • index.ts:239-255 (registration)
    Registers the tool handler in the MCP CallToolRequestSchema switch dispatcher.
    case 'DetachRelation': const detachResult = await DetachRelation({ sourceId: args.sourceId as string, targetId: args.targetId as string | undefined, targetIds: args.targetIds as string[] | undefined, relationType: args.relationType as string | undefined, direction: args.direction as 'outgoing' | 'incoming' | 'bidirectional' | undefined, transactionId: args.transactionId as string | undefined }) return { content: [ { type: 'text', text: detachResult.message } ] }

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/1pxone/RushDB'

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