Skip to main content
Glama

listProjects

Retrieve all projects for the authenticated user from the Clockify MCP server to manage and organize time tracking activities.

Instructions

List all projects for the authenticated user.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The switch case in callToolHandler that implements the 'listProjects' tool. It fetches the list of projects from the user's active workspace using the clockifyFetch helper and returns them as JSON text.
    case "listProjects": { const projects = await clockifyFetch( `/workspaces/${workspaceId}/projects`, ); return { content: [ { type: "text", text: JSON.stringify(projects, null, 2), }, ], }; }
  • The tool definition in listToolsHandler, including name, description, and empty input schema (no parameters required).
    { name: "listProjects", description: "List all projects for the authenticated user.", inputSchema: { type: "object", properties: {}, required: [] }, },
  • src/index.ts:43-43 (registration)
    Registers the listToolsHandler on the MCP server, which exposes the 'listProjects' tool schema to clients.
    server.setRequestHandler(ListToolsRequestSchema, listToolsHandler);
  • src/index.ts:49-49 (registration)
    Registers the callToolHandler on the MCP server, which handles execution of the 'listProjects' tool via its switch case.
    server.setRequestHandler(CallToolRequestSchema, callToolHandler);
  • Helper function to make authenticated API calls to Clockify, used by the listProjects handler.
    async function clockifyFetch(endpoint: string, options: RequestInit = {}) { const apiKey = getApiKey(); const baseUrl = "https://api.clockify.me/api/v1"; const url = endpoint.startsWith("http") ? endpoint : `${baseUrl}${endpoint}`; const headers = { "X-Api-Key": apiKey, "Content-Type": "application/json", ...(options.headers || {}), }; const response = await fetch(url, { ...options, headers }); if (!response.ok) { const text = await response.text(); console.error( `[Error] Clockify API ${url} failed: ${response.status} ${text}`, ); throw new Error(`Clockify API error: ${response.status} ${text}`); } return response.json(); }

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/inakianduaga/clockify-mcp'

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