Skip to main content
Glama

list_workspaces

Retrieve all accessible Bitbucket workspaces for the current user to manage repositories and collaborate on projects.

Instructions

List all workspaces accessible by the current user.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function that fetches and formats the list of Bitbucket workspaces accessible by the user.
    export async function listWorkspaces( axiosInstance: AxiosInstance, config: Config, args: any ): Promise<{ content: Array<{ type: string; text: string }> }> { try { const response = await axiosInstance.get< BitbucketPaginatedResponse<BitbucketWorkspace> >(`/workspaces`); const workspaces = response.data.values; const summary = `Found ${workspaces.length} workspaces.`; const workspaceList = workspaces .map( workspace => `**${workspace.name}** - Slug: ${workspace.slug} - Private: ${workspace.is_private}` ) .join('\n\n'); return { content: [ { type: 'text', text: `${summary}\n\n${workspaceList}`, }, ], }; } catch (error) { console.error('Error fetching workspaces:', error); return { content: [ { type: 'text', text: `Error fetching workspaces: ${ error instanceof Error ? error.message : 'Unknown error' }`, }, ], }; } }
  • Tool metadata including name, description, and input schema (empty, no parameters required).
    export const listWorkspacesTool = { name: 'list_workspaces', description: 'List all workspaces accessible by the current user.', inputSchema: { type: 'object', properties: {}, }, };
  • src/index.ts:112-134 (registration)
    Registration of listWorkspacesTool in the ListToolsRequestSchema handler, making it discoverable.
    tools: [ // Repositories listRepositoriesTool, getRepositoryDetailsTool, // Commits listCommitsTool, getCommitTool, // Branching Model updateRepositoryBranchingModelSettingsTool, updateProjectBranchingModelSettingsTool, listBranchRestrictionsTool, getBranchRestrictionTool, // Projects getProjectTool, listDefaultReviewersTool, // Pull Requests listPullRequestsTool, getPullRequestTool, createPullRequestTool, updatePullRequestTool, // Workspaces listWorkspacesTool, ],
  • src/index.ts:143-174 (registration)
    Mapping of 'list_workspaces' tool name to its handler function in the CallToolRequestSchema handler.
    string, ( axiosInstance: AxiosInstance, config: Config, args: any ) => Promise<{ content: Array<{ type: string; text: string }> }> > = { // Repositories list_repositories: listRepositories, get_repository_details: getRepositoryDetails, // Commits list_commits: listCommits, get_commit: getCommit, // Branching Model update_repository_branching_model_settings: updateRepositoryBranchingModelSettings, update_project_branching_model_settings: updateProjectBranchingModelSettings, list_branch_restrictions: listBranchRestrictions, get_branch_restriction: getBranchRestriction, // Projects get_project: getProject, list_default_reviewers: listDefaultReviewers, // Pull Requests list_pull_requests: listPullRequests, get_pull_request: getPullRequest, create_pull_request: createPullRequest, update_pull_request: updatePullRequest, // Workspaces list_workspaces: listWorkspaces, };

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/Korfu/mcp-bitbucket'

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