Skip to main content
Glama
by cristip73

asana_list_workspaces

Retrieve available Asana workspaces to select the right environment for task and project management. When DEFAULT_WORKSPACE_ID is configured, returns only that specific workspace.

Instructions

List all available workspaces in Asana. If DEFAULT_WORKSPACE_ID is set, only returns that workspace.

Input Schema

NameRequiredDescriptionDefault
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" } }, "type": "object" }

Implementation Reference

  • Core implementation of the listWorkspaces method in AsanaClientWrapper, handling default workspace, pagination, and Asana API calls.
    async listWorkspaces(opts: any = {}) { try { // If DEFAULT_WORKSPACE_ID is set, only return that workspace if (this.defaultWorkspaceId) { console.error(`Using default workspace ID: ${this.defaultWorkspaceId}`); const response = await this.workspaces.getWorkspace(this.defaultWorkspaceId, opts); return [response.data]; // Return as an array with a single workspace } // Extract pagination parameters const { auto_paginate = false, max_pages = 10, limit, offset, ...otherOpts } = opts; // Build search parameters const searchParams: any = { ...otherOpts }; // Add pagination parameters 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.workspaces.getWorkspaces(searchParams), // Next page fetch function (nextOffset) => this.workspaces.getWorkspaces({ ...searchParams, offset: nextOffset }), // Pagination options { auto_paginate, max_pages } ); } catch (error: any) { console.error(`Error listing workspaces: ${error.message}`); throw error; } }
  • MCP tool handler dispatch case that executes asanaClient.listWorkspaces with validated arguments and returns JSON response.
    case "asana_list_workspaces": { const response = await asanaClient.listWorkspaces(args); return { content: [{ type: "text", text: JSON.stringify(response) }], }; }
  • Defines the tool metadata, description, and input schema for asana_list_workspaces.
    export const listWorkspacesTool: Tool = { name: "asana_list_workspaces", description: "List all available workspaces in Asana. If DEFAULT_WORKSPACE_ID is set, only returns that workspace.", inputSchema: { type: "object", properties: { opt_fields: { type: "string", description: "Comma-separated list of optional fields to include" } } } };
  • Registers listWorkspacesTool (imported at line 7) in the exported tools array used for MCP tool discovery.
    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 ];

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