create_dataverse_team
Create new teams in Dataverse to organize users and manage permissions. Establish owner teams for record ownership or access teams for sharing records, grouping users with similar access requirements.
Instructions
Creates a new team in Dataverse for organizing users and managing permissions. Teams can be owner teams (for record ownership) or access teams (for sharing records). Use this to establish groups of users who work together and need similar access levels.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| administratorId | Yes | User ID of the team administrator | |
| azureActiveDirectoryObjectId | No | Azure AD Object ID for the team | |
| businessUnitId | No | Business unit ID to associate the team with (defaults to root business unit) | |
| delegatedAuthorizationId | No | Delegated authorization context for the team | |
| description | No | Description of the team | |
| emailAddress | No | Email address for the team | |
| membershipType | No | Membership type: 0=Members and guests, 1=Members, 2=Owners, 3=Guests | 0 |
| name | Yes | Name of the team | |
| queueId | No | Default queue ID for the team | |
| teamTemplateId | No | Team template ID to associate with the team | |
| teamType | No | Team type: 0=Owner, 1=Access, 2=Security Group, 3=Office Group | 0 |
| transactionCurrencyId | No | Currency ID associated with the team | |
| yomiName | No | Pronunciation of the team name in phonetic characters |
Implementation Reference
- src/tools/team-tools.ts:27-89 (handler)The core handler function that executes the tool logic: constructs team creation payload with OData bindings for relationships, fetches root business unit if needed, posts to /teams endpoint, and returns success/error response.async (params) => { try { const teamData: any = { name: params.name, description: params.description, teamtype: parseInt(params.teamType), membershiptype: parseInt(params.membershipType), emailaddress: params.emailAddress, yominame: params.yomiName, azureactivedirectoryobjectid: params.azureActiveDirectoryObjectId }; // Set administrator teamData['administratorid@odata.bind'] = `/systemusers(${params.administratorId})`; // Set business unit (default to root if not provided) if (params.businessUnitId) { teamData['businessunitid@odata.bind'] = `/businessunits(${params.businessUnitId})`; } else { // Get the root business unit const businessUnits = await client.get('businessunits?$filter=parentbusinessunitid eq null&$select=businessunitid'); if (businessUnits.value && businessUnits.value.length > 0) { teamData['businessunitid@odata.bind'] = `/businessunits(${businessUnits.value[0].businessunitid})`; } } // Set optional relationships if (params.queueId) { teamData['queueid@odata.bind'] = `/queues(${params.queueId})`; } if (params.teamTemplateId) { teamData['teamtemplateid@odata.bind'] = `/teamtemplates(${params.teamTemplateId})`; } if (params.delegatedAuthorizationId) { teamData['delegatedauthorizationid@odata.bind'] = `/delegatedauthorizations(${params.delegatedAuthorizationId})`; } if (params.transactionCurrencyId) { teamData['transactioncurrencyid@odata.bind'] = `/transactioncurrencies(${params.transactionCurrencyId})`; } const response = await client.post('teams', teamData); return { content: [ { type: "text", text: `Successfully created team '${params.name}'.\n\nTeam created successfully.\n\nResponse: ${JSON.stringify(response, null, 2)}` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error creating team: ${error instanceof Error ? error.message : 'Unknown error'}` } ], isError: true }; } }
- src/tools/team-tools.ts:8-26 (schema)Tool metadata (title, description) and Zod-based inputSchema defining all parameters for creating a Dataverse team, including required name/administratorId and optional fields with constraints.{ title: "Create Dataverse Team", description: "Creates a new team in Dataverse for organizing users and managing permissions. Teams can be owner teams (for record ownership) or access teams (for sharing records). Use this to establish groups of users who work together and need similar access levels.", inputSchema: { name: z.string().max(160).describe("Name of the team"), description: z.string().max(2000).optional().describe("Description of the team"), businessUnitId: z.string().optional().describe("Business unit ID to associate the team with (defaults to root business unit)"), administratorId: z.string().describe("User ID of the team administrator"), teamType: z.enum(['0', '1', '2', '3']).default('0').describe("Team type: 0=Owner, 1=Access, 2=Security Group, 3=Office Group"), membershipType: z.enum(['0', '1', '2', '3']).default('0').describe("Membership type: 0=Members and guests, 1=Members, 2=Owners, 3=Guests"), emailAddress: z.string().max(100).optional().describe("Email address for the team"), yomiName: z.string().max(160).optional().describe("Pronunciation of the team name in phonetic characters"), azureActiveDirectoryObjectId: z.string().optional().describe("Azure AD Object ID for the team"), queueId: z.string().optional().describe("Default queue ID for the team"), teamTemplateId: z.string().optional().describe("Team template ID to associate with the team"), delegatedAuthorizationId: z.string().optional().describe("Delegated authorization context for the team"), transactionCurrencyId: z.string().optional().describe("Currency ID associated with the team") } },
- src/tools/team-tools.ts:5-91 (registration)The exported createTeamTool function that performs the server.registerTool call to register the 'create_dataverse_team' tool with its schema and handler.export function createTeamTool(server: McpServer, client: DataverseClient) { server.registerTool( "create_dataverse_team", { title: "Create Dataverse Team", description: "Creates a new team in Dataverse for organizing users and managing permissions. Teams can be owner teams (for record ownership) or access teams (for sharing records). Use this to establish groups of users who work together and need similar access levels.", inputSchema: { name: z.string().max(160).describe("Name of the team"), description: z.string().max(2000).optional().describe("Description of the team"), businessUnitId: z.string().optional().describe("Business unit ID to associate the team with (defaults to root business unit)"), administratorId: z.string().describe("User ID of the team administrator"), teamType: z.enum(['0', '1', '2', '3']).default('0').describe("Team type: 0=Owner, 1=Access, 2=Security Group, 3=Office Group"), membershipType: z.enum(['0', '1', '2', '3']).default('0').describe("Membership type: 0=Members and guests, 1=Members, 2=Owners, 3=Guests"), emailAddress: z.string().max(100).optional().describe("Email address for the team"), yomiName: z.string().max(160).optional().describe("Pronunciation of the team name in phonetic characters"), azureActiveDirectoryObjectId: z.string().optional().describe("Azure AD Object ID for the team"), queueId: z.string().optional().describe("Default queue ID for the team"), teamTemplateId: z.string().optional().describe("Team template ID to associate with the team"), delegatedAuthorizationId: z.string().optional().describe("Delegated authorization context for the team"), transactionCurrencyId: z.string().optional().describe("Currency ID associated with the team") } }, async (params) => { try { const teamData: any = { name: params.name, description: params.description, teamtype: parseInt(params.teamType), membershiptype: parseInt(params.membershipType), emailaddress: params.emailAddress, yominame: params.yomiName, azureactivedirectoryobjectid: params.azureActiveDirectoryObjectId }; // Set administrator teamData['administratorid@odata.bind'] = `/systemusers(${params.administratorId})`; // Set business unit (default to root if not provided) if (params.businessUnitId) { teamData['businessunitid@odata.bind'] = `/businessunits(${params.businessUnitId})`; } else { // Get the root business unit const businessUnits = await client.get('businessunits?$filter=parentbusinessunitid eq null&$select=businessunitid'); if (businessUnits.value && businessUnits.value.length > 0) { teamData['businessunitid@odata.bind'] = `/businessunits(${businessUnits.value[0].businessunitid})`; } } // Set optional relationships if (params.queueId) { teamData['queueid@odata.bind'] = `/queues(${params.queueId})`; } if (params.teamTemplateId) { teamData['teamtemplateid@odata.bind'] = `/teamtemplates(${params.teamTemplateId})`; } if (params.delegatedAuthorizationId) { teamData['delegatedauthorizationid@odata.bind'] = `/delegatedauthorizations(${params.delegatedAuthorizationId})`; } if (params.transactionCurrencyId) { teamData['transactioncurrencyid@odata.bind'] = `/transactioncurrencies(${params.transactionCurrencyId})`; } const response = await client.post('teams', teamData); return { content: [ { type: "text", text: `Successfully created team '${params.name}'.\n\nTeam created successfully.\n\nResponse: ${JSON.stringify(response, null, 2)}` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error creating team: ${error instanceof Error ? error.message : 'Unknown error'}` } ], isError: true }; } } ); }
- src/index.ts:199-199 (registration)Invocation of createTeamTool in the main index.ts to register the tool during server initialization.createTeamTool(server, dataverseClient);