cribl_getPipelineConfig
Retrieve the full configuration JSON of a Cribl pipeline by its ID, with optional worker group selection for targeted management.
Instructions
Retrieves full configuration JSON for a specified pipeline in a worker group.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| groupName | No | Optional: The name of the Worker Group/Fleet. If omitted, defaults to attempting to use Cribl Stream and if only one group exists for Stream, it will use that sole group. | |
| pipelineId | Yes | The ID of the pipeline to retrieve configuration for. |
Implementation Reference
- src/server.ts:210-269 (registration)Registration of the 'cribl_getPipelineConfig' tool with the MCP server, including its description, schema, and handler.
server.tool( 'cribl_getPipelineConfig', 'Retrieves full configuration JSON for a specified pipeline in a worker group.', GetPipelineConfigArgsShape, async (args: ValidatedArgs<typeof GetPipelineConfigArgsShape>) => { console.error(`[Tool Call] cribl_getPipelineConfig with args:`, args); const groupResolution = await resolveGroupName(args.groupName); // Pass directly, preprocess handles null if (groupResolution.error || !groupResolution.groupName) { return { isError: true, content: [{ type: 'text', text: groupResolution.error || 'Could not determine group name.' }] }; } const groupName = groupResolution.groupName; const { pipelineId } = args; // Input validation for pipelineId itself (prevent empty strings) if (!pipelineId || pipelineId.trim().length === 0) { // Fetch valid IDs to include in the error message const pipelinesListResult = await getPipelines(groupName); const validIdsString = pipelinesListResult.success ? `Valid pipeline IDs are: [${pipelinesListResult.data?.map(p => p.id).join(', ') || 'None found'}]` : `Failed to retrieve list of valid IDs: ${pipelinesListResult.error}`; return { isError: true, content: [{ type: 'text', text: `Pipeline ID argument is required and cannot be empty. ${validIdsString}` }], }; } const result = await getPipelineConfig(groupName, pipelineId); if (!result.success) { let errorMessage = result.error || 'Unknown error getting pipeline config.'; // Check if it's the specific 404 Item not found error const isNotFoundError = errorMessage.includes('(404)') && (errorMessage.toLowerCase().includes('item not found') || errorMessage.toLowerCase().includes('not found')); if (isNotFoundError) { console.error(`[stderr] Pipeline ID '${pipelineId}' not found in group '${groupName}', fetching valid IDs...`); const pipelinesListResult = await getPipelines(groupName); if (pipelinesListResult.success) { const validIds = pipelinesListResult.data?.map(p => p.id) || []; errorMessage = `Pipeline ID '${pipelineId}' not found in group '${groupName}'. Valid pipeline IDs are: [${validIds.join(', ') || 'None found'}]`; } else { errorMessage = `Pipeline ID '${pipelineId}' not found in group '${groupName}'. Additionally, failed to retrieve list of valid IDs: ${pipelinesListResult.error}`; } } console.error(`[Tool Error] cribl_getPipelineConfig (Group: ${groupName}, ID: ${pipelineId}):`, errorMessage); return { isError: true, content: [{ type: 'text', text: errorMessage }], }; } console.error(`[Tool Success] cribl_getPipelineConfig for Group: ${groupName}, ID: ${pipelineId}`); return { // Return the full pipeline object which includes the config content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }], }; } ); - src/server.ts:205-208 (schema)Zod validation schema for the 'cribl_getPipelineConfig' tool arguments: optional groupName and required pipelineId string.
const GetPipelineConfigArgsShape = { groupName: GroupNameArgSchema, pipelineId: z.string().describe('The ID of the pipeline to retrieve configuration for.'), }; - src/server.ts:214-268 (handler)Handler function that resolves the worker group name, validates pipelineId, calls the API client, and returns the pipeline configuration JSON.
async (args: ValidatedArgs<typeof GetPipelineConfigArgsShape>) => { console.error(`[Tool Call] cribl_getPipelineConfig with args:`, args); const groupResolution = await resolveGroupName(args.groupName); // Pass directly, preprocess handles null if (groupResolution.error || !groupResolution.groupName) { return { isError: true, content: [{ type: 'text', text: groupResolution.error || 'Could not determine group name.' }] }; } const groupName = groupResolution.groupName; const { pipelineId } = args; // Input validation for pipelineId itself (prevent empty strings) if (!pipelineId || pipelineId.trim().length === 0) { // Fetch valid IDs to include in the error message const pipelinesListResult = await getPipelines(groupName); const validIdsString = pipelinesListResult.success ? `Valid pipeline IDs are: [${pipelinesListResult.data?.map(p => p.id).join(', ') || 'None found'}]` : `Failed to retrieve list of valid IDs: ${pipelinesListResult.error}`; return { isError: true, content: [{ type: 'text', text: `Pipeline ID argument is required and cannot be empty. ${validIdsString}` }], }; } const result = await getPipelineConfig(groupName, pipelineId); if (!result.success) { let errorMessage = result.error || 'Unknown error getting pipeline config.'; // Check if it's the specific 404 Item not found error const isNotFoundError = errorMessage.includes('(404)') && (errorMessage.toLowerCase().includes('item not found') || errorMessage.toLowerCase().includes('not found')); if (isNotFoundError) { console.error(`[stderr] Pipeline ID '${pipelineId}' not found in group '${groupName}', fetching valid IDs...`); const pipelinesListResult = await getPipelines(groupName); if (pipelinesListResult.success) { const validIds = pipelinesListResult.data?.map(p => p.id) || []; errorMessage = `Pipeline ID '${pipelineId}' not found in group '${groupName}'. Valid pipeline IDs are: [${validIds.join(', ') || 'None found'}]`; } else { errorMessage = `Pipeline ID '${pipelineId}' not found in group '${groupName}'. Additionally, failed to retrieve list of valid IDs: ${pipelinesListResult.error}`; } } console.error(`[Tool Error] cribl_getPipelineConfig (Group: ${groupName}, ID: ${pipelineId}):`, errorMessage); return { isError: true, content: [{ type: 'text', text: errorMessage }], }; } console.error(`[Tool Success] cribl_getPipelineConfig for Group: ${groupName}, ID: ${pipelineId}`); return { // Return the full pipeline object which includes the config content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }], }; } - src/api/criblClient.ts:395-414 (helper)API client helper that performs the GET request to `/api/v1/m/{groupName}/pipelines/{pipelineId}` and returns the pipeline configuration.
export async function getPipelineConfig(groupName: string, pipelineId: string): Promise<ClientResult<CriblPipeline>> { const context = `getPipelineConfig (Group: ${groupName}, ID: ${pipelineId})`; if (!groupName) { return { success: false, error: 'Group name is required for getPipelineConfig.' }; } if (!pipelineId) { return { success: false, error: 'Pipeline ID is required for getPipelineConfig.' }; } // Use group-specific path const url = `/api/v1/m/${groupName}/pipelines/${pipelineId}`; console.error(`[stderr] Attempting API call: GET ${url}`); try { // Assuming the response is the full pipeline object, including its config const response = await apiClient.get<CriblPipeline>(url); return { success: true, data: response.data }; } catch (error) { const errorMessage = handleApiError(error, context); return { success: false, error: errorMessage }; } }