Skip to main content
Glama

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
NameRequiredDescriptionDefault
organization_idYesResource ID
wallet_idYesWallet ID to add
role_idYesRole ID to assign

Implementation Reference

  • 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)); }
    });
  • IdParam schema definition used for validating the organization_id parameter - a non-empty string.
    export const IdParam = z.string().min(1).describe("Resource ID");
  • 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)); }
    });
  • 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;
    }
  • 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 };
    }
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/ro-ro-b/dual-mcp-server'

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