Skip to main content
Glama

getCurrentProject

Retrieve the current Teamwork project associated with a solution by checking the .teamwork file or prompting the user for the project ID, enabling efficient project management on Teamwork MCP.

Instructions

Get the current solution's Teamwork project, always check the .teamwork file in the root of the solution for the Teamwork project ID or ask the user which project they are working on.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesThe current Teamwork project ID associated with the solution.

Implementation Reference

  • The handler function that executes the tool logic: validates input projectId, calls the teamwork service to get the project, and returns formatted result or error.
    export async function handleGetCurrentProject(input: any) { try { const projectId = String(input?.projectId); if (!projectId) { throw new Error("Project ID is required"); } const result = await teamworkService.getCurrentProject(projectId); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error: any) { logger.error(`Error in getCurrentProject handler: ${error.message}`); return { content: [{ type: "text", text: `Error retrieving current project: ${error.message}` }] }; } }
  • The tool schema/definition including name, description, input schema requiring projectId, and annotations.
    export const getCurrentProjectDefinition = { name: "getCurrentProject", description: "Get the current solution's Teamwork project, always check the `.teamwork` file in the root of the solution for the Teamwork project ID or ask the user which project they are working on.", inputSchema: { type: "object", properties: { projectId: { type: "integer", description: "The current Teamwork project ID associated with the solution." } }, required: ["projectId"] }, annotations: { title: "Get the Current Project", readOnlyHint: false, destructiveHint: false, openWorldHint: false } };
  • Registration of the getCurrentProject tool in the toolPairs array, pairing its definition and handler.
    { definition: getCurrentProject, handler: handleGetCurrentProject },
  • src/tools/index.ts:8-8 (registration)
    Import of the tool definition and handler from the projects module.
    import { getCurrentProjectDefinition as getCurrentProject, handleGetCurrentProject } from './projects/getCurrentProject.js';
  • Helper service function called by the handler to fetch project details from Teamwork API.
    export const getCurrentProject = async (projectId: string) => { try { if (!projectId) { return { success: false, error: `Current Teamwork project ID was not provided` }; } const api = ensureApiClient(); const response = await api.get(`/projects/${projectId}.json`); return response.data; } catch (error: any) { logger.error(`Error getting current project: ${error.message}`); throw new Error(`Failed to get current project`); }; };

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/Vizioz/Teamwork-MCP'

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