Skip to main content
Glama
cristip73

MCP Server for Asana

by cristip73

asana_list_workspace_users

Retrieve user information from an Asana workspace, including names and emails, with options for pagination and custom field selection.

Instructions

Get users in a workspace

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspace_idNoThe workspace ID to get users for (optional if DEFAULT_WORKSPACE_ID is set)
opt_fieldsNoComma-separated list of optional fields to include (e.g., 'photo,resource_type'). Fields 'name' and 'email' are included by default.
limitNoMaximum number of results to return per page (1-100). Helps prevent timeouts and ensures more reliable responses.
offsetNoPagination token from previous response. Must be the exact token returned in a previous response's next_page.offset field.
auto_paginateNoIf true, automatically fetches all pages and combines results (limited by max_pages)
max_pagesNoMaximum number of pages to fetch when auto_paginate is true

Implementation Reference

  • Core handler implementation in AsanaClientWrapper that fetches users from a workspace using Asana SDK, with full pagination support (limit, offset, auto_paginate), default workspace handling, and opt_fields management.
    async getUsersForWorkspace(workspaceId: string | undefined, opts: any = {}) {
      try {
        // Use default workspace if not specified and available
        if (!workspaceId && this.defaultWorkspaceId) {
          workspaceId = this.defaultWorkspaceId;
        }
        
        if (!workspaceId) {
          throw new Error("No workspace specified and no default workspace ID set");
        }
        
        // Extract pagination parameters
        const { 
          auto_paginate = false, 
          max_pages = 10,
          limit,
          offset,
          opt_fields,
          ...otherOpts
        } = opts;
        
        // Build search parameters
        const searchParams: any = {
          ...otherOpts
        };
        
        // Add default opt_fields if not specified
        if (!opt_fields) {
          searchParams.opt_fields = "name,email";
        } else {
          searchParams.opt_fields = opt_fields;
        }
        
        // Add pagination parameters if provided
        if (limit !== undefined) {
          // Ensure limit is between 1 and 100
          searchParams.limit = Math.min(Math.max(1, Number(limit)), 100);
        }
        if (offset) searchParams.offset = offset;
        
        // Use the paginated results handler for more reliable pagination
        return await this.handlePaginatedResults(
          // Initial fetch function
          () => this.users.getUsersForWorkspace(workspaceId, searchParams),
          // Next page fetch function
          (nextOffset) => this.users.getUsersForWorkspace(workspaceId, { ...searchParams, offset: nextOffset }),
          // Pagination options
          { auto_paginate, max_pages }
        );
      } catch (error: any) {
        console.error(`Error getting users for workspace ${workspaceId}: ${error.message}`);
        
        // Add detailed error handling for common issues
        if (error.message?.includes('Not Found')) {
          throw new Error(`Workspace with ID ${workspaceId} not found or inaccessible.`);
        }
        
        if (error.message?.includes('Bad Request')) {
          if (opts.limit && (opts.limit < 1 || opts.limit > 100)) {
            throw new Error(`Invalid limit parameter: ${opts.limit}. Limit must be between 1 and 100.`);
          }
          
          throw new Error(`Error retrieving users for workspace: ${error.message}. Check that all parameters are valid.`);
        }
        
        throw error;
      }
    }
  • Tool dispatch handler case that destructures arguments and calls the AsanaClientWrapper.getUsersForWorkspace method.
    case "asana_list_workspace_users": {
      const { workspace_id, ...opts } = args;
      const response = await asanaClient.getUsersForWorkspace(workspace_id || undefined, opts);
      return {
        content: [{ type: "text", text: JSON.stringify(response) }],
      };
    }
  • Tool schema definition including input schema with support for workspace_id, pagination parameters (limit, offset, auto_paginate, max_pages), and opt_fields.
    export const getUsersForWorkspaceTool: Tool = {
      name: "asana_list_workspace_users",
      description: "Get users in a workspace",
      inputSchema: {
        type: "object",
        properties: {
          workspace_id: {
            type: "string",
            description: "The workspace ID to get users for (optional if DEFAULT_WORKSPACE_ID is set)"
          },
          opt_fields: {
            type: "string",
            description: "Comma-separated list of optional fields to include (e.g., 'photo,resource_type'). Fields 'name' and 'email' are included by default."
          },
          limit: {
            type: "number",
            description: "Maximum number of results to return per page (1-100). Helps prevent timeouts and ensures more reliable responses.",
            minimum: 1,
            maximum: 100
          },
          offset: {
            type: "string",
            description: "Pagination token from previous response. Must be the exact token returned in a previous response's next_page.offset field."
          },
          auto_paginate: {
            type: "boolean",
            description: "If true, automatically fetches all pages and combines results (limited by max_pages)",
            default: false
          },
          max_pages: {
            type: "number",
            description: "Maximum number of pages to fetch when auto_paginate is true",
            default: 10
          }
        },
        required: []
      }
    }; 
  • Registration of the tool in the main tools array export used by the MCP server.
    export const tools: Tool[] = [
      listWorkspacesTool,
      searchProjectsTool,
      getProjectTool,
      getProjectTaskCountsTool,
      getProjectSectionsTool,
      createSectionForProjectTool,
      createProjectForWorkspaceTool,
      updateProjectTool,
      reorderSectionsTool,
      getProjectStatusTool,
      getProjectStatusesForProjectTool,
      createProjectStatusTool,
      deleteProjectStatusTool,
      searchTasksTool,
      getTaskTool,
      createTaskTool,
      updateTaskTool,
      createSubtaskTool,
      getMultipleTasksByGidTool,
      addTaskToSectionTool,
      getTasksForSectionTool,
      getProjectHierarchyTool,
      getSubtasksForTaskTool,
      getTasksForProjectTool,
      getTasksForTagTool,
      getTagsForWorkspaceTool,
      addTagsToTaskTool,
      addTaskDependenciesTool,
      addTaskDependentsTool,
      setParentForTaskTool,
      addFollowersToTaskTool,
      getStoriesForTaskTool,
      createTaskStoryTool,
      getTeamsForUserTool,
      getTeamsForWorkspaceTool,
      addMembersForProjectTool,
      addFollowersForProjectTool,
      getUsersForWorkspaceTool,
      getAttachmentsForObjectTool,
      uploadAttachmentForObjectTool,
      downloadAttachmentTool
    ];
  • Import of the getUsersForWorkspaceTool (named 'asana_list_workspace_users') from user-tools.js.
      getTeamsForUserTool,
      getTeamsForWorkspaceTool,
      getUsersForWorkspaceTool
    } from './tools/user-tools.js';
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'Get users' implies a read operation, but the description doesn't cover critical behaviors like pagination handling (though the schema hints at it), rate limits, authentication requirements, or error conditions. It mentions nothing about the return format or what 'users' entails (e.g., basic vs. detailed info).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's appropriately sized for a simple tool, though it could be more front-loaded with key details (e.g., 'List all users in a workspace with pagination support'). No fluff or redundancy is present.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (6 parameters, no annotations, no output schema), the description is incomplete. It lacks information on return values (e.g., user object structure), error handling, authentication needs, and usage context. While the schema covers parameters well, the description fails to compensate for missing behavioral and output details, making it inadequate for reliable agent use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all 6 parameters (workspace_id, opt_fields, limit, offset, auto_paginate, max_pages). The description adds no additional meaning beyond what's in the schema—it doesn't explain parameter interactions (e.g., how auto_paginate affects limit) or provide examples. Baseline 3 is appropriate when the schema does all the work.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Get users in a workspace' clearly states the verb ('Get') and resource ('users in a workspace'), but it's vague about scope and doesn't distinguish from potential siblings. It doesn't specify if this retrieves all users, active users, or a filtered subset, nor does it differentiate from other user-related tools that might exist (though none are listed in siblings).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention prerequisites (e.g., workspace access), compare it to other user-fetching methods, or indicate scenarios where it's preferred. With no annotations and no output schema, this lack of context leaves the agent guessing about appropriate usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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/cristip73/mcp-server-asana'

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