@promptlab/mcp
Advanced tools
+71
-96
@@ -26,7 +26,3 @@ #!/usr/bin/env node | ||
| }); | ||
| server.resource('experiments', 'promptlab://experiments', { | ||
| name: 'List of all experiments', | ||
| description: 'List of all experiments associated with the user account', | ||
| mimeType: 'application/json' | ||
| }, async () => { | ||
| server.tool('listExperiments', 'Retrieve all experiments associated with the user account', {}, async () => { | ||
| try { | ||
@@ -43,7 +39,8 @@ const experiments = await fetch(new URL('experiments', getUrl()), { | ||
| return { | ||
| contents: [{ | ||
| uri: 'promptlab://experiments', | ||
| text: JSON.stringify(data, null, 2), | ||
| mimeType: 'application/json' | ||
| }] | ||
| content: [ | ||
| { | ||
| type: 'text', | ||
| text: JSON.stringify(data, null, 2) | ||
| } | ||
| ] | ||
| }; | ||
@@ -84,13 +81,6 @@ } | ||
| }); | ||
| server.resource('experiment-details', 'promptlab://experiment/{experimentId}', { | ||
| name: 'Experiment details', | ||
| description: 'Detailed information about a specific experiment', | ||
| mimeType: 'application/json' | ||
| }, async (uri) => { | ||
| server.tool('getExperimentDetails', 'Fetch detailed information about a specific experiment by ID. Use this when you need comprehensive experiment data for updates or analysis.', { | ||
| experimentId: z.string().describe('ID of the experiment to get') | ||
| }, async ({ experimentId }) => { | ||
| try { | ||
| const url = new URL(uri.toString()); | ||
| const experimentId = url.pathname.split('/').pop(); | ||
| if (!experimentId) { | ||
| throw new Error('Missing experiment ID in URI'); | ||
| } | ||
| const response = await fetch(new URL(`experiments/${experimentId}`, getUrl()), { | ||
@@ -106,7 +96,8 @@ headers: { | ||
| return { | ||
| contents: [{ | ||
| uri: uri.toString(), | ||
| text: JSON.stringify(data, null, 2), | ||
| mimeType: 'application/json' | ||
| }] | ||
| content: [ | ||
| { | ||
| type: 'text', | ||
| text: JSON.stringify(data, null, 2) | ||
| } | ||
| ] | ||
| }; | ||
@@ -179,21 +170,25 @@ } | ||
| }); | ||
| server.resource('models', 'promptlab://models', { | ||
| name: 'Available models', | ||
| description: 'Available models for the user based on their credits and API keys', | ||
| mimeType: 'application/json' | ||
| }, async (uri) => { | ||
| server.tool('getUserModels', 'Retrieve all available models for the user based on their credits and API keys', { | ||
| limit: z | ||
| .number() | ||
| .default(50) | ||
| .describe('Maximum number of models to return'), | ||
| offset: z | ||
| .number() | ||
| .default(0) | ||
| .describe('Number of models to skip for pagination'), | ||
| searchQuery: z | ||
| .string() | ||
| .optional() | ||
| .describe('Optional search query to filter models') | ||
| }, async ({ limit, offset, searchQuery }) => { | ||
| try { | ||
| const url = new URL(uri.toString()); | ||
| const params = new URLSearchParams(url.search); | ||
| const limit = params.get('limit') || '50'; | ||
| const offset = params.get('offset') || '0'; | ||
| const searchQuery = params.get('searchQuery'); | ||
| const searchParams = new URLSearchParams({ | ||
| limit, | ||
| offset | ||
| const params = new URLSearchParams({ | ||
| limit: limit.toString(), | ||
| offset: offset.toString() | ||
| }); | ||
| if (searchQuery) { | ||
| searchParams.append('searchQuery', searchQuery); | ||
| params.append('searchQuery', searchQuery); | ||
| } | ||
| const response = await fetch(new URL(`models?${searchParams}`, getUrl()), { | ||
| const response = await fetch(new URL(`models?${params}`, getUrl()), { | ||
| headers: { | ||
@@ -208,7 +203,8 @@ Authorization: secret | ||
| return { | ||
| contents: [{ | ||
| uri: uri.toString(), | ||
| text: JSON.stringify(data, null, 2), | ||
| mimeType: 'application/json' | ||
| }] | ||
| content: [ | ||
| { | ||
| type: 'text', | ||
| text: JSON.stringify(data, null, 2) | ||
| } | ||
| ] | ||
| }; | ||
@@ -220,14 +216,6 @@ } | ||
| }); | ||
| server.resource('experiment-models', 'promptlab://experiment/{experimentId}/models', { | ||
| name: 'Experiment models', | ||
| description: 'Models configured for a specific experiment', | ||
| mimeType: 'application/json' | ||
| }, async (uri) => { | ||
| server.tool('getExperimentModels', 'Get the models configured for a specific experiment', { | ||
| experimentId: z.string().describe('ID of the experiment') | ||
| }, async ({ experimentId }) => { | ||
| try { | ||
| const url = new URL(uri.toString()); | ||
| const pathParts = url.pathname.split('/'); | ||
| const experimentId = pathParts[pathParts.length - 2]; | ||
| if (!experimentId) { | ||
| throw new Error('Missing experiment ID in URI'); | ||
| } | ||
| const response = await fetch(new URL(`experiments/${experimentId}/models`, getUrl()), { | ||
@@ -243,7 +231,8 @@ headers: { | ||
| return { | ||
| contents: [{ | ||
| uri: uri.toString(), | ||
| text: JSON.stringify(data, null, 2), | ||
| mimeType: 'application/json' | ||
| }] | ||
| content: [ | ||
| { | ||
| type: 'text', | ||
| text: JSON.stringify(data, null, 2) | ||
| } | ||
| ] | ||
| }; | ||
@@ -574,16 +563,8 @@ } | ||
| }); | ||
| server.resource('block-details', 'promptlab://experiment/{experimentId}/message/{messageId}/block/{blockId}', { | ||
| name: 'Block details', | ||
| description: 'Block with all its variants from an experiment', | ||
| mimeType: 'application/json' | ||
| }, async (uri) => { | ||
| server.tool('getBlock', 'Get a block with all its variants from an experiment', { | ||
| experimentId: z.string().describe('ID of the experiment'), | ||
| messageId: z.string().describe('ID of the message containing the block'), | ||
| blockId: z.string().describe('ID of the block to get') | ||
| }, async ({ experimentId, messageId, blockId }) => { | ||
| try { | ||
| const url = new URL(uri.toString()); | ||
| const pathParts = url.pathname.split('/'); | ||
| const experimentId = pathParts[2]; | ||
| const messageId = pathParts[4]; | ||
| const blockId = pathParts[6]; | ||
| if (!experimentId || !messageId || !blockId) { | ||
| throw new Error('Missing experimentId, messageId, or blockId in URI'); | ||
| } | ||
| const response = await fetch(new URL(`experiments/${experimentId}/messages/${messageId}/blocks/${blockId}`, getUrl()), { | ||
@@ -599,7 +580,8 @@ headers: { | ||
| return { | ||
| contents: [{ | ||
| uri: uri.toString(), | ||
| text: JSON.stringify(data, null, 2), | ||
| mimeType: 'application/json' | ||
| }] | ||
| content: [ | ||
| { | ||
| type: 'text', | ||
| text: JSON.stringify(data, null, 2) | ||
| } | ||
| ] | ||
| }; | ||
@@ -611,15 +593,7 @@ } | ||
| }); | ||
| server.resource('message-details', 'promptlab://experiment/{experimentId}/message/{messageId}', { | ||
| name: 'Message details', | ||
| description: 'Message with all its blocks and variants from an experiment', | ||
| mimeType: 'application/json' | ||
| }, async (uri) => { | ||
| server.tool('getMessage', 'Get a message with all its blocks and variants from an experiment', { | ||
| experimentId: z.string().describe('ID of the experiment'), | ||
| messageId: z.string().describe('ID of the message to get') | ||
| }, async ({ experimentId, messageId }) => { | ||
| try { | ||
| const url = new URL(uri.toString()); | ||
| const pathParts = url.pathname.split('/'); | ||
| const experimentId = pathParts[2]; | ||
| const messageId = pathParts[4]; | ||
| if (!experimentId || !messageId) { | ||
| throw new Error('Missing experimentId or messageId in URI'); | ||
| } | ||
| const response = await fetch(new URL(`experiments/${experimentId}/messages/${messageId}`, getUrl()), { | ||
@@ -635,7 +609,8 @@ headers: { | ||
| return { | ||
| contents: [{ | ||
| uri: uri.toString(), | ||
| text: JSON.stringify(data, null, 2), | ||
| mimeType: 'application/json' | ||
| }] | ||
| content: [ | ||
| { | ||
| type: 'text', | ||
| text: JSON.stringify(data, null, 2) | ||
| } | ||
| ] | ||
| }; | ||
@@ -642,0 +617,0 @@ } |
+1
-1
| { | ||
| "name": "@promptlab/mcp", | ||
| "version": "1.1.0", | ||
| "version": "1.1.1", | ||
| "description": "Model Context Protocol server for PromptLab experiments", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
30374
-4.41%714
-3.38%