Skip to main content
Glama

toggl_list_clients

Retrieve client information from your Toggl workspace to manage time tracking projects and organize reporting data.

Instructions

List clients for a workspace

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspace_idNoWorkspace ID (uses default if not provided)

Implementation Reference

  • The primary handler for the 'toggl_list_clients' tool. It resolves the workspace ID, fetches clients using the TogglAPI, and returns a formatted JSON response containing workspace_id, count, and client details (id, name, archived).
    case 'toggl_list_clients': {
      const workspaceId = args?.workspace_id || defaultWorkspaceId;
      if (!workspaceId) {
        throw new Error('Workspace ID required (set TOGGL_DEFAULT_WORKSPACE_ID or provide workspace_id)');
      }
      
      const clients = await api.getClients(workspaceId as number);
      
      return {
        content: [{
          type: 'text',
          text: JSON.stringify({ 
            workspace_id: workspaceId,
            count: clients.length,
            clients: clients.map(c => ({
              id: c.id,
              name: c.name,
              archived: c.archived
            }))
          }, null, 2)
        }]
      };
    }
  • Tool schema definition for 'toggl_list_clients', including name, description, and input schema specifying an optional workspace_id parameter.
    {
      name: 'toggl_list_clients',
      description: 'List clients for a workspace',
      inputSchema: {
        type: 'object',
        properties: {
          workspace_id: {
            type: 'number',
            description: 'Workspace ID (uses default if not provided)'
          }
        }
      },
    },
  • src/index.ts:386-388 (registration)
    Registration of all tools (including toggl_list_clients) via the ListToolsRequestSchema handler, which returns the complete tools array.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return { tools };
    });
  • Helper method in TogglAPI class that makes the HTTP request to retrieve clients for a specific workspace from the Toggl Track API.
    async getClients(workspaceId: number): Promise<Client[]> {
      return this.request<Client[]>('GET', `/workspaces/${workspaceId}/clients`);
    }

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/verygoodplugins/mcp-toggl'

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