Skip to main content
Glama

getCurrentProject

Retrieve the active Teamwork project ID for the current solution by checking the .teamwork file or prompting the user for clarification.

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. It extracts the projectId from input, calls the teamworkService to get the current project details, formats the result as JSON text content, or returns an error response.
    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) { return createErrorResponse(error, 'Retrieving current project'); } }
  • The tool schema/definition specifying name, description, input schema requiring projectId (integer), 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 central toolPairs array, associating its definition and handler.
    { definition: getCurrentProject, handler: handleGetCurrentProject },
  • src/tools/index.ts:8-8 (registration)
    Import of the tool definition and handler from the specific projects file.
    import { getCurrentProjectDefinition as getCurrentProject, handleGetCurrentProject } from './projects/getCurrentProject.js';
  • Supporting service function called by the handler to fetch project details from the Teamwork API using the provided projectId.
    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