Skip to main content
Glama
mwhesse

Dataverse MCP Server

by mwhesse

delete_dataverse_relationship

Permanently remove relationships between Dataverse tables to eliminate table connections and lookup fields. This irreversible action requires careful consideration before execution.

Instructions

Permanently deletes a relationship between Dataverse tables. WARNING: This action cannot be undone and will remove the connection between tables, including any lookup fields for One-to-Many relationships. Use with extreme caution.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
schemaNameYesSchema name of the relationship to delete

Implementation Reference

  • Exports and defines the deleteRelationshipTool function which registers the 'delete_dataverse_relationship' MCP tool using server.registerTool, including title, description, inputSchema, and handler function.
    export function deleteRelationshipTool(server: McpServer, client: DataverseClient) {
      server.registerTool(
        "delete_dataverse_relationship",
        {
          title: "Delete Dataverse Relationship",
          description: "Permanently deletes a relationship between Dataverse tables. WARNING: This action cannot be undone and will remove the connection between tables, including any lookup fields for One-to-Many relationships. Use with extreme caution.",
          inputSchema: {
            schemaName: z.string().describe("Schema name of the relationship to delete")
          }
        },
        async (params) => {
          try {
            await client.deleteMetadata(`RelationshipDefinitions(SchemaName='${params.schemaName}')`);
    
            return {
              content: [
                {
                  type: "text",
                  text: `Successfully deleted relationship '${params.schemaName}'.`
                }
              ]
            };
          } catch (error) {
            return {
              content: [
                {
                  type: "text",
                  text: `Error deleting relationship: ${error instanceof Error ? error.message : 'Unknown error'}`
                }
              ],
              isError: true
            };
          }
        }
      );
    }
  • Zod input schema for the tool, requiring the schemaName of the relationship to delete.
    inputSchema: {
      schemaName: z.string().describe("Schema name of the relationship to delete")
    }
  • The async handler function that executes the tool logic: deletes the relationship metadata using the DataverseClient's deleteMetadata method and returns success or error response.
    async (params) => {
      try {
        await client.deleteMetadata(`RelationshipDefinitions(SchemaName='${params.schemaName}')`);
    
        return {
          content: [
            {
              type: "text",
              text: `Successfully deleted relationship '${params.schemaName}'.`
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error deleting relationship: ${error instanceof Error ? error.message : 'Unknown error'}`
            }
          ],
          isError: true
        };
      }
    }
Install Server

Other Tools

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/mwhesse/mcp-dataverse'

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