Skip to main content
Glama
elevenlabs

ElevenLabs MCP Server

Official
by elevenlabs

create_agent

Create a conversational AI agent with custom voice, language, and behavior settings for interactive audio applications.

Instructions

Create a conversational AI agent with custom configuration.

⚠️ COST WARNING: This tool makes an API call to ElevenLabs which may incur costs. Only use when explicitly requested by the user.

Args:
    name: Name of the agent
    first_message: First message the agent will say i.e. "Hi, how can I help you today?"
    system_prompt: System prompt for the agent
    voice_id: ID of the voice to use for the agent
    language: ISO 639-1 language code for the agent
    llm: LLM to use for the agent
    temperature: Temperature for the agent. The lower the temperature, the more deterministic the agent's responses will be. Range is 0 to 1.
    max_tokens: Maximum number of tokens to generate.
    asr_quality: Quality of the ASR. `high` or `low`.
    model_id: ID of the ElevenLabs model to use for the agent.
    optimize_streaming_latency: Optimize streaming latency. Range is 0 to 4.
    stability: Stability for the agent. Range is 0 to 1.
    similarity_boost: Similarity boost for the agent. Range is 0 to 1.
    turn_timeout: Timeout for the agent to respond in seconds. Defaults to 7 seconds.
    max_duration_seconds: Maximum duration of a conversation in seconds. Defaults to 600 seconds (10 minutes).
    record_voice: Whether to record the agent's voice.
    retention_days: Number of days to retain the agent's data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
first_messageYes
system_promptYes
voice_idNocgSgspJ2msm6clMCkdW9
languageNoen
llmNogemini-2.0-flash-001
temperatureNo
max_tokensNo
asr_qualityNohigh
model_idNoeleven_turbo_v2
optimize_streaming_latencyNo
stabilityNo
similarity_boostNo
turn_timeoutNo
max_duration_secondsNo
record_voiceNo
retention_daysNo

Implementation Reference

  • The @mcp.tool decorator registers the create_agent tool and defines its handler function, which creates a conversational AI agent by calling the ElevenLabs API with constructed conversation config and platform settings.
    @mcp.tool(
        description="""Create a conversational AI agent with custom configuration.
    
        ⚠️ COST WARNING: This tool makes an API call to ElevenLabs which may incur costs. Only use when explicitly requested by the user.
    
        Args:
            name: Name of the agent
            first_message: First message the agent will say i.e. "Hi, how can I help you today?"
            system_prompt: System prompt for the agent
            voice_id: ID of the voice to use for the agent
            language: ISO 639-1 language code for the agent
            llm: LLM to use for the agent
            temperature: Temperature for the agent. The lower the temperature, the more deterministic the agent's responses will be. Range is 0 to 1.
            max_tokens: Maximum number of tokens to generate.
            asr_quality: Quality of the ASR. `high` or `low`.
            model_id: ID of the ElevenLabs model to use for the agent.
            optimize_streaming_latency: Optimize streaming latency. Range is 0 to 4.
            stability: Stability for the agent. Range is 0 to 1.
            similarity_boost: Similarity boost for the agent. Range is 0 to 1.
            turn_timeout: Timeout for the agent to respond in seconds. Defaults to 7 seconds.
            max_duration_seconds: Maximum duration of a conversation in seconds. Defaults to 600 seconds (10 minutes).
            record_voice: Whether to record the agent's voice.
            retention_days: Number of days to retain the agent's data.
        """
    )
    def create_agent(
        name: str,
        first_message: str,
        system_prompt: str,
        voice_id: str | None = DEFAULT_VOICE_ID,
        language: str = "en",
        llm: str = "gemini-2.0-flash-001",
        temperature: float = 0.5,
        max_tokens: int | None = None,
        asr_quality: str = "high",
        model_id: str = "eleven_turbo_v2",
        optimize_streaming_latency: int = 3,
        stability: float = 0.5,
        similarity_boost: float = 0.8,
        turn_timeout: int = 7,
        max_duration_seconds: int = 300,
        record_voice: bool = True,
        retention_days: int = 730,
    ) -> TextContent:
        conversation_config = create_conversation_config(
            language=language,
            system_prompt=system_prompt,
            llm=llm,
            first_message=first_message,
            temperature=temperature,
            max_tokens=max_tokens,
            asr_quality=asr_quality,
            voice_id=voice_id,
            model_id=model_id,
            optimize_streaming_latency=optimize_streaming_latency,
            stability=stability,
            similarity_boost=similarity_boost,
            turn_timeout=turn_timeout,
            max_duration_seconds=max_duration_seconds,
        )
    
        platform_settings = create_platform_settings(
            record_voice=record_voice,
            retention_days=retention_days,
        )
    
        response = client.conversational_ai.agents.create(
            name=name,
            conversation_config=conversation_config,
            platform_settings=platform_settings,
        )
    
        return TextContent(
            type="text",
            text=f"""Agent created successfully: Name: {name}, Agent ID: {response.agent_id}, System Prompt: {system_prompt}, Voice ID: {voice_id or "Default"}, Language: {language}, LLM: {llm}, You can use this agent ID for future interactions with the agent.""",
        )
  • Helper function to create the conversation configuration dictionary used by the create_agent tool.
    def create_conversation_config(
        language: str,
        system_prompt: str,
        llm: str,
        first_message: str | None,
        temperature: float,
        max_tokens: int | None,
        asr_quality: str,
        voice_id: str | None,
        model_id: str,
        optimize_streaming_latency: int,
        stability: float,
        similarity_boost: float,
        turn_timeout: int,
        max_duration_seconds: int,
    ) -> dict:
        return {
            "agent": {
                "language": language,
                "prompt": {
                    "prompt": system_prompt,
                    "llm": llm,
                    "tools": [{"type": "system", "name": "end_call", "description": ""}],
                    "knowledge_base": [],
                    "temperature": temperature,
                    **({"max_tokens": max_tokens} if max_tokens else {}),
                },
                **({"first_message": first_message} if first_message else {}),
                "dynamic_variables": {"dynamic_variable_placeholders": {}},
            },
            "asr": {
                "quality": asr_quality,
                "provider": "elevenlabs",
                "user_input_audio_format": "pcm_16000",
                "keywords": [],
            },
            "tts": {
                **({"voice_id": voice_id} if voice_id else {}),
                "model_id": model_id,
                "agent_output_audio_format": "pcm_16000",
                "optimize_streaming_latency": optimize_streaming_latency,
                "stability": stability,
                "similarity_boost": similarity_boost,
            },
            "turn": {"turn_timeout": turn_timeout},
            "conversation": {
                "max_duration_seconds": max_duration_seconds,
                "client_events": [
                    "audio",
                    "interruption",
                    "user_transcript",
                    "agent_response",
                    "agent_response_correction",
                ],
            },
            "language_presets": {},
            "is_blocked_ivc": False,
            "is_blocked_non_ivc": False,
        }
  • Helper function to create the platform settings dictionary used by the create_agent tool.
    def create_platform_settings(
        record_voice: bool,
        retention_days: int,
    ) -> dict:
        return {
            "widget": {
                "variant": "full",
                "avatar": {"type": "orb", "color_1": "#6DB035", "color_2": "#F5CABB"},
                "feedback_mode": "during",
                "terms_text": '#### Terms and conditions\n\nBy clicking "Agree," and each time I interact with this AI agent, I consent to the recording, storage, and sharing of my communications with third-party service providers, and as described in the Privacy Policy.\nIf you do not wish to have your conversations recorded, please refrain from using this service.',
                "show_avatar_when_collapsed": True,
            },
            "evaluation": {},
            "auth": {"allowlist": []},
            "overrides": {},
            "call_limits": {"agent_concurrency_limit": -1, "daily_limit": 100000},
            "privacy": {
                "record_voice": record_voice,
                "retention_days": retention_days,
                "delete_transcript_and_pii": True,
                "delete_audio": True,
                "apply_to_existing_conversations": False,
            },
            "data_collection": {},
        }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively communicates that this is a creation/mutation tool (implied by 'Create'), includes a cost warning about API calls to ElevenLabs, and provides default values and ranges for many parameters. It doesn't fully describe what happens after creation (e.g., whether the agent is immediately usable, storage implications), but covers key behavioral aspects well given the annotation gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a clear purpose statement, important warning up front, and organized parameter explanations. While comprehensive, it's appropriately sized for a tool with 17 parameters. Some parameter explanations could be slightly more concise, but overall it's efficient and front-loaded with critical information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (17 parameters, no annotations, no output schema), the description provides substantial context. It explains the tool's purpose, includes a cost warning, and documents all parameters thoroughly. It doesn't describe the return value or what happens after creation, which would be helpful given no output schema, but covers most essential aspects well for this complex creation tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage and 17 parameters, the description provides excellent parameter semantics. It explains what each parameter means, provides examples ('i.e. "Hi, how can I help you today?"'), specifies ranges ('Range is 0 to 1'), explains effects ('The lower the temperature, the more deterministic the agent's responses will be'), and gives defaults. This fully compensates for the lack of schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Create a conversational AI agent with custom configuration.' It specifies the verb ('Create'), resource ('conversational AI agent'), and scope ('with custom configuration'), which distinguishes it from sibling tools like 'get_agent' or 'list_agents' that retrieve existing agents rather than creating new ones.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description includes a clear usage warning: '⚠️ COST WARNING: This tool makes an API call to ElevenLabs which may incur costs. Only use when explicitly requested by the user.' This provides important context about when to use it (only when explicitly requested) and cost implications. However, it doesn't explicitly mention alternatives or when not to use it beyond the cost warning.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/elevenlabs/elevenlabs-mcp'

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