Skip to main content
Glama

list-projects

Retrieve a paginated list of projects or workspaces from the Opik MCP Server. Supports sorting, filtering by workspace name, and customizable page size for efficient project management.

Instructions

Get a list of projects/workspaces

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageYesPage number for pagination
sizeYesNumber of items per page
sortByNoSort projects by this field
sortOrderNoSort order (asc or desc)
workspaceNameNoWorkspace name to use instead of the default

Implementation Reference

  • The main handler function for the 'list-projects' tool. It constructs the API URL with pagination parameters, calls makeApiRequest to fetch projects from the Opik API, and returns formatted MCP content blocks with summary and JSON data.
    async (args: any) => { const { page, size, workspaceName } = args; const url = `/v1/private/projects?page=${page}&size=${size}`; const response = await makeApiRequest<ProjectResponse>(url, {}, workspaceName); if (!response.data) { return { content: [{ type: 'text', text: response.error || 'Failed to fetch projects' }], }; } return { content: [ { type: 'text', text: `Found ${response.data.total} projects (page ${response.data.page} of ${Math.ceil(response.data.total / response.data.size)})`, }, { type: 'text', text: JSON.stringify(response.data.content, null, 2), }, ], }; } );
  • Zod schema defining the input parameters for the 'list-projects' tool: optional page (default 1), size (default 10), and workspaceName.
    { page: z.number().optional().default(1).describe('Page number for pagination'), size: z.number().optional().default(10).describe('Number of items per page'), workspaceName: z.string().optional().describe('Workspace name to use instead of the default'), },
  • Registration of the 'list-projects' tool using server.tool(), including the tool name, description, input schema, and handler function within the loadProjectTools loader.
    server.tool( 'list-projects', 'Get a list of projects with optional filtering', { page: z.number().optional().default(1).describe('Page number for pagination'), size: z.number().optional().default(10).describe('Number of items per page'), workspaceName: z.string().optional().describe('Workspace name to use instead of the default'), }, async (args: any) => { const { page, size, workspaceName } = args; const url = `/v1/private/projects?page=${page}&size=${size}`; const response = await makeApiRequest<ProjectResponse>(url, {}, workspaceName); if (!response.data) { return { content: [{ type: 'text', text: response.error || 'Failed to fetch projects' }], }; } return { content: [ { type: 'text', text: `Found ${response.data.total} projects (page ${response.data.page} of ${Math.ceil(response.data.total / response.data.size)})`, }, { type: 'text', text: JSON.stringify(response.data.content, null, 2), }, ], }; } );
  • src/index.ts:86-89 (registration)
    Top-level conditional registration of project tools (including 'list-projects') by calling loadProjectTools(server) when 'projects' toolset is enabled.
    if (config.enabledToolsets.includes('projects')) { server = loadProjectTools(server); logToFile('Loaded projects toolset'); }

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/comet-ml/opik-mcp'

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