Skip to main content
Glama

listProjects

Retrieve all projects for the authenticated user using the tool integrated with Clockify MCP, enabling efficient project management and organization.

Instructions

List all projects for the authenticated user.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler for the 'listProjects' tool. It fetches the list of projects from the Clockify API using the user's active workspace ID and returns them as a JSON-formatted text response.
    case "listProjects": { const projects = await clockifyFetch( `/workspaces/${workspaceId}/projects`, ); return { content: [ { type: "text", text: JSON.stringify(projects, null, 2), }, ], }; }
  • Tool schema definition 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 which exposes the listProjects tool among others.
    server.setRequestHandler(ListToolsRequestSchema, listToolsHandler);
  • Helper function used by the listProjects handler to make authenticated API calls to Clockify.
    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(); }
  • Helper function to retrieve the Clockify API key from environment, used indirectly by listProjects via clockifyFetch.
    function getApiKey(): string { const apiKey = process.env.CLOCKIFY_API_KEY; if (!apiKey) { throw new Error("CLOCKIFY_API_KEY is not set in MCP config."); } return apiKey; }

Other Tools

Related Tools

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