get_project
Retrieve a specific Bitbucket project by its key to access project details and configuration within your Bitbucket workspace.
Instructions
Get a single project by its key.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_key | Yes | The key of the project. |
Implementation Reference
- src/tools/projects/getProject.ts:19-67 (handler)The main handler function that fetches the specified Bitbucket project details using the provided axios instance and config, formats the information, and returns it in the required MCP content format. Handles errors gracefully.export async function getProject( axiosInstance: AxiosInstance, config: Config, args: any ): Promise<{ content: Array<{ type: string; text: string }> }> { try { const { project_key } = args; if (!project_key) { throw new Error('Project key is required'); } console.error(`Fetching project: ${project_key}`); const response = await axiosInstance.get<BitbucketProject>( `/workspaces/${config.BITBUCKET_WORKSPACE}/projects/${project_key}` ); const project = response.data; const projectDetails = `**Project Details: ${project.name}** - Key: ${project.key} - Description: ${project.description || 'No description'} - Private: ${project.is_private} - Created: ${new Date(project.created_on).toLocaleDateString()} - Updated: ${new Date(project.updated_on).toLocaleDateString()} - URL: ${project.links.html.href}`; return { content: [ { type: 'text', text: projectDetails, }, ], }; } catch (error) { console.error('Error fetching project:', error); return { content: [ { type: 'text', text: `Error fetching project: ${ error instanceof Error ? error.message : 'Unknown error' }`, }, ], }; } }
- Defines the tool metadata including name, description, and input schema requiring a 'project_key' string parameter.export const getProjectTool = { name: 'get_project', description: 'Get a single project by its key.', inputSchema: { type: 'object', properties: { project_key: { type: 'string', description: 'The key of the project.', }, }, required: ['project_key'], }, };
- src/index.ts:124-126 (registration)Registers the getProjectTool in the server's list of available tools returned by ListToolsRequestHandler.// Projects getProjectTool, listDefaultReviewersTool,
- src/index.ts:163-165 (registration)Maps the tool name 'get_project' to its handler function getProject in the CallToolRequestHandler dispatch.// Projects get_project: getProject, list_default_reviewers: listDefaultReviewers,