get_dataverse_relationship
Retrieve detailed configuration and settings for Dataverse table relationships to understand table connections and cascade behavior.
Instructions
Retrieves detailed information about a specific relationship between Dataverse tables, including its configuration, cascade settings, and menu behavior. Use this to inspect relationship definitions and understand table connections.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| schemaName | Yes | Schema name of the relationship to retrieve |
Implementation Reference
- src/tools/relationship-tools.ts:209-234 (handler)The handler function retrieves the relationship metadata by querying the Dataverse metadata endpoint with the provided schemaName and returns formatted text content with the JSON response or error.
async (params) => { try { const result = await client.getMetadata( `RelationshipDefinitions(SchemaName='${params.schemaName}')` ); return { content: [ { type: "text", text: `Relationship information for '${params.schemaName}':\n\n${JSON.stringify(result, null, 2)}` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error retrieving relationship: ${error instanceof Error ? error.message : 'Unknown error'}` } ], isError: true }; } } - Zod schema defining the input parameter 'schemaName' as a required string.
inputSchema: { schemaName: z.string().describe("Schema name of the relationship to retrieve") } - src/tools/relationship-tools.ts:199-236 (registration)Function that registers the 'get_dataverse_relationship' tool with the MCP server, specifying name, title, description, input schema, and handler function. This is invoked from src/index.ts.
export function getRelationshipTool(server: McpServer, client: DataverseClient) { server.registerTool( "get_dataverse_relationship", { title: "Get Dataverse Relationship", description: "Retrieves detailed information about a specific relationship between Dataverse tables, including its configuration, cascade settings, and menu behavior. Use this to inspect relationship definitions and understand table connections.", inputSchema: { schemaName: z.string().describe("Schema name of the relationship to retrieve") } }, async (params) => { try { const result = await client.getMetadata( `RelationshipDefinitions(SchemaName='${params.schemaName}')` ); return { content: [ { type: "text", text: `Relationship information for '${params.schemaName}':\n\n${JSON.stringify(result, null, 2)}` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error retrieving relationship: ${error instanceof Error ? error.message : 'Unknown error'}` } ], isError: true }; } } ); } - src/index.ts:154-154 (registration)Top-level invocation that calls getRelationshipTool to perform the tool registration during server initialization.
getRelationshipTool(server, dataverseClient);