run_ai_action_for_shared_link
Execute AI-driven actions on shared links by specifying their IDs, enabling automated processing and response generation in preferred languages.
Instructions
Run an AI Action (Prompt) for a shared link. You can run an AI Action for a shared link by its ID or a list of shared link IDs. You can also provide the language of the response.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| language | No | ||
| prompt_id | Yes | ||
| share_link_ids | Yes |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"language": {
"type": "string"
},
"prompt_id": {
"type": "string"
},
"share_link_ids": {
"items": {
"type": "string"
},
"type": "array"
}
},
"required": [
"prompt_id",
"share_link_ids"
],
"type": "object"
}
Implementation Reference
- src/server.ts:887-915 (registration)Registration of the MCP tool 'run_ai_action_for_shared_link'. Includes the tool description, input schema reference (createShareLinkAIResponseBody.shape), annotations, and the inline asynchronous handler function that authenticates using authInfo.token, calls simplifiedApi.createShareLinkAIResponse with the args, formats the response using formatToMCPToolResponse, and handles errors by logging and returning the error response.server.registerTool( 'run_ai_action_for_shared_link', { description: 'Run an AI Action (Prompt) for a shared link. You can run an AI Action for a shared link by its ID or a list of shared link IDs. ' + 'You can also provide the language of the response.', inputSchema: createShareLinkAIResponseBody.shape, annotations: { readOnlyHint: false, destructiveHint: false, }, }, async ( args: CreateShareLinkAIResponse, { authInfo }, ): Promise<McpToolResponse> => { try { return formatToMCPToolResponse( await simplifiedApi.createShareLinkAIResponse( args, setCarbonVoiceAuthHeader(authInfo?.token), ), ); } catch (error) { logger.error('Error running ai action for shared link:', { error }); return formatToMCPToolResponse(error); } }, );
- src/server.ts:899-914 (handler)The core handler function for the 'run_ai_action_for_shared_link' tool. It takes input args of type CreateShareLinkAIResponse and authInfo from context, sets auth headers, invokes the backend API simplifiedApi.createShareLinkAIResponse, formats the result to MCP tool response format, and catches errors for logging and error response.async ( args: CreateShareLinkAIResponse, { authInfo }, ): Promise<McpToolResponse> => { try { return formatToMCPToolResponse( await simplifiedApi.createShareLinkAIResponse( args, setCarbonVoiceAuthHeader(authInfo?.token), ), ); } catch (error) { logger.error('Error running ai action for shared link:', { error }); return formatToMCPToolResponse(error); } },
- Zod schema defining the input structure for the tool: prompt_id (required string), share_link_ids (required array of strings), language (optional string). This is used as the inputSchema in the tool registration via .shape.export const createShareLinkAIResponseBody = zod.object({ "prompt_id": zod.string(), "share_link_ids": zod.array(zod.string()), "language": zod.string().optional() })