dual_add_org_member
Add a wallet to an organization with a specific role to manage access and permissions within the DUAL Web3 ecosystem.
Instructions
Add a wallet as a member to an organization with a specific role.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| organization_id | Yes | Resource ID | |
| wallet_id | Yes | Wallet ID to add | |
| role_id | Yes | Role ID to assign |
Implementation Reference
- src/tools/organizations.ts:104-110 (handler)Handler function for dual_add_org_member tool. Takes organization_id, wallet_id, and role_id as parameters, makes a POST request to add the wallet as a member with the specified role, and returns a success message.
}, async (params) => { try { const { organization_id, ...body } = params; await makeApiRequest(`organizations/${organization_id}/members`, "POST", body); return textResult(`Member ${params.wallet_id} added to organization.`); } catch (e) { return errorResult(handleApiError(e)); } }); - src/schemas/common.ts:21-21 (schema)IdParam schema definition used for validating the organization_id parameter - a non-empty string.
export const IdParam = z.string().min(1).describe("Resource ID"); - src/tools/organizations.ts:95-110 (registration)Registration of dual_add_org_member tool with server. Defines title, description, inputSchema with organization_id, wallet_id, and role_id parameters, and annotations indicating it's a non-readonly, idempotent operation.
server.registerTool("dual_add_org_member", { title: "Add Organization Member", description: "Add a wallet as a member to an organization with a specific role.", inputSchema: { organization_id: IdParam, wallet_id: z.string().describe("Wallet ID to add"), role_id: z.string().describe("Role ID to assign"), }, annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true }, }, async (params) => { try { const { organization_id, ...body } = params; await makeApiRequest(`organizations/${organization_id}/members`, "POST", body); return textResult(`Member ${params.wallet_id} added to organization.`); } catch (e) { return errorResult(handleApiError(e)); } }); - src/services/api-client.ts:40-62 (helper)makeApiRequest helper function that makes HTTP requests to the DUAL API. Used by the handler to POST member data to the organizations/{id}/members endpoint.
export async function makeApiRequest<T>( endpoint: string, method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" = "GET", data?: unknown, params?: Record<string, unknown>, options?: { timeout?: number; multipart?: boolean } ): Promise<T> { const config: AxiosRequestConfig = { method, url: `${API_BASE_URL}/${endpoint}`, headers: getAuthHeaders(), timeout: options?.timeout ?? 30000, }; if (data !== undefined) config.data = data; if (params) config.params = params; if (options?.multipart) { config.headers = { ...config.headers, "Content-Type": "multipart/form-data" }; } const response = await axios(config); return response.data as T; } - src/services/formatters.ts:39-46 (helper)textResult and errorResult helper functions that format MCP tool responses. textResult creates a success response, errorResult creates an error response with isError flag.
export function textResult(text: string) { return { content: [{ type: "text" as const, text }] }; } /** Standard error content response */ export function errorResult(text: string) { return { content: [{ type: "text" as const, text }], isError: true as const }; }