Skip to main content
Glama
PhononX

Carbon Voice

by PhononX

run_ai_action

Execute AI prompts on specific Carbon Voice messages to generate responses, analyze content, or perform automated actions based on message IDs.

Instructions

Run an AI Action (Prompt) for a message. You can run an AI Action for a message by its ID or a list of message IDs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
prompt_idYes
message_idsYes
channel_idNo
workspace_idNo
languageNoThe language of the response. Defaults to original message.

Implementation Reference

  • The handler function that implements the core logic of the 'run_ai_action' tool. It invokes the simplified API's aIResponseControllerCreateResponse method with the input arguments and authentication header, formats the response, and handles errors.
    async (args: CreateAIResponse, { authInfo }): Promise<McpToolResponse> => {
      try {
        return formatToMCPToolResponse(
          await simplifiedApi.aIResponseControllerCreateResponse(
            args,
            setCarbonVoiceAuthHeader(authInfo?.token),
          ),
        );
      } catch (error) {
        logger.error('Error running ai action:', { error });
        return formatToMCPToolResponse(error);
      }
    },
  • src/server.ts:861-885 (registration)
    Registers the 'run_ai_action' tool on the MCP server, specifying its name, description, input schema, annotations, and handler function.
    server.registerTool(
      'run_ai_action',
      {
        description:
          'Run an AI Action (Prompt) for a message. You can run an AI Action for a message by its ID or a list of message IDs.',
        inputSchema: aIResponseControllerCreateResponseBody.shape,
        annotations: {
          readOnlyHint: false,
          destructiveHint: false,
        },
      },
      async (args: CreateAIResponse, { authInfo }): Promise<McpToolResponse> => {
        try {
          return formatToMCPToolResponse(
            await simplifiedApi.aIResponseControllerCreateResponse(
              args,
              setCarbonVoiceAuthHeader(authInfo?.token),
            ),
          );
        } catch (error) {
          logger.error('Error running ai action:', { error });
          return formatToMCPToolResponse(error);
        }
      },
    );
  • Zod schema definition for the input body of the aIResponseControllerCreateResponse API call, used as inputSchema for the tool.
    export const aIResponseControllerCreateResponseBody = zod.object({
      "prompt_id": zod.string(),
      "message_ids": zod.array(zod.string()),
      "channel_id": zod.string().optional(),
      "workspace_id": zod.string().optional(),
      "language": zod.string().optional().describe('The language of the response. Defaults to original message.')
    })
  • TypeScript interface defining the shape of the input arguments for the 'run_ai_action' handler.
    export interface CreateAIResponse {
      prompt_id: string;
      message_ids: string[];
      channel_id?: string;
      workspace_id?: string;
      /** The language of the response. Defaults to original message. */
      language?: string;
    }

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/PhononX/cv-mcp-server'

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