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
| Name | Required | Description | Default |
|---|---|---|---|
| workspace_gid | No | The workspace GID to get teams for (optional if DEFAULT_WORKSPACE_ID is set) | |
| opt_fields | No | Comma-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
- src/tool-handler.ts:454-460 (handler)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) }], }; }
- src/tools/user-tools.ts:22-39 (schema)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: [] } };
- src/tool-handler.ts:96-96 (registration)Registration of the tool in the exported tools array used for MCP tool discovery.getTeamsForWorkspaceTool,
- src/asana-client-wrapper.ts:679-696 (helper)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; } }
- src/tool-handler.ts:51-54 (registration)Import statement registering the tool schema for use in the tool handler.getTeamsForUserTool, getTeamsForWorkspaceTool, getUsersForWorkspaceTool } from './tools/user-tools.js';