Skip to main content
Glama
by cristip73

asana_get_teams_for_workspace

Retrieve all teams within a specific Asana workspace to organize and manage team structures, access team information, and coordinate project assignments.

Instructions

Get teams in a workspace

Input Schema

NameRequiredDescriptionDefault
workspace_gidNoThe workspace GID to get teams for (optional if DEFAULT_WORKSPACE_ID is set)
opt_fieldsNoComma-separated list of optional fields to include

Input Schema (JSON Schema)

{ "properties": { "opt_fields": { "description": "Comma-separated list of optional fields to include", "type": "string" }, "workspace_gid": { "description": "The workspace GID to get teams for (optional if DEFAULT_WORKSPACE_ID is set)", "type": "string" } }, "required": [], "type": "object" }

Implementation Reference

  • Handler implementation that processes the tool call by extracting workspace_gid and opts, invoking the Asana client wrapper's getTeamsForWorkspace method, and returning the JSON-stringified response.
    case "asana_get_teams_for_workspace": { const { workspace_gid, ...opts } = args; const response = await asanaClient.getTeamsForWorkspace(workspace_gid || undefined, opts); return { content: [{ type: "text", text: JSON.stringify(response) }], }; }
  • Schema definition for the tool, specifying name, description, and input schema with optional workspace_gid and opt_fields.
    export const getTeamsForWorkspaceTool: Tool = { name: "asana_get_teams_for_workspace", description: "Get teams in a workspace", inputSchema: { type: "object", properties: { workspace_gid: { type: "string", description: "The workspace GID to get teams for (optional if DEFAULT_WORKSPACE_ID is set)" }, opt_fields: { type: "string", description: "Comma-separated list of optional fields to include" } }, required: [] } };
  • Registration of the tool in the exported tools array used for MCP tool discovery.
    getTeamsForWorkspaceTool,
  • Core helper method in AsanaClientWrapper that handles the actual Asana API call to retrieve teams for a workspace, including default workspace fallback and error handling.
    async getTeamsForWorkspace(workspace_gid: string | undefined, opts: any = {}) { try { // Use default workspace if not specified and available if (!workspace_gid && this.defaultWorkspaceId) { workspace_gid = this.defaultWorkspaceId; } if (!workspace_gid) { throw new Error("No workspace specified and no default workspace ID set"); } const response = await this.teams.getTeamsForWorkspace(workspace_gid, opts); return response.data; } catch (error) { console.error(`Error in getTeamsForWorkspace: ${error}`); throw error; } }
  • Import statement registering the tool schema for use in the tool handler.
    getTeamsForUserTool, getTeamsForWorkspaceTool, getUsersForWorkspaceTool } from './tools/user-tools.js';

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