Skip to main content
Glama

spix_playbook_create

Create a call or SMS playbook to define AI behavior for phone interactions. Specify goal, persona, briefing, context, voice, language, and other settings.

Instructions

Create a new call or SMS playbook

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeYesPlaybook type
nameYesPlaybook name
goalNoCall playbook goal
personaNoAI persona description
briefingNoPlaybook briefing text
contextNoPlaybook context
voice_idNoVoice UUID for TTS
languageNoLanguage code (e.g. en, es, fr)
default_emotionNoDefault TTS emotion
speaking_rateNoSpeaking rate (0.6-1.5)
tts_volumeNoTTS volume (0.5-2.0)
max_duration_secNoMax call duration in seconds
recordNoRecord calls
amd_actionNoAnswering machine detection action

Implementation Reference

  • The CommandSchema definition for 'playbook.create'. Defines path='playbook.create', HTTP method POST to '/playbooks', and all parameters (type, name, goal, persona, briefing, context, voice_id, language, default_emotion, speaking_rate, tts_volume, max_duration_sec, record, amd_action). This schema is the source of truth for the tool definition and its input validation.
    CommandSchema(
        path="playbook.create",
        cli_usage="spix playbook create --type <call|sms> --name <n>",
        http_method="POST",
        api_endpoint="/playbooks",
        mcp_expose="tool",
        mcp_profile="safe",
        description="Create a new call or SMS playbook",
        params=[
            CommandParam("type", "enum", required=True, choices=["call", "sms"], description="Playbook type"),
            CommandParam("name", "string", required=True, description="Playbook name"),
            CommandParam("goal", "string", description="Call playbook goal"),
            CommandParam("persona", "string", description="AI persona description"),
            CommandParam("briefing", "string", description="Playbook briefing text"),
            CommandParam("context", "string", description="Playbook context"),
            CommandParam("voice_id", "uuid", description="Voice UUID for TTS"),
            CommandParam("language", "string", description="Language code (e.g. en, es, fr)"),
            CommandParam("default_emotion", "string", description="Default TTS emotion"),
            CommandParam("speaking_rate", "number", description="Speaking rate (0.6-1.5)"),
            CommandParam("tts_volume", "number", description="TTS volume (0.5-2.0)"),
            CommandParam("max_duration_sec", "integer", description="Max call duration in seconds"),
            CommandParam("record", "boolean", default=True, description="Record calls"),
            CommandParam(
                "amd_action",
                "enum",
                choices=["hang_up", "voicemail_leave_message", "retry_later"],
                description="Answering machine detection action",
            ),
        ],
    ),
  • The create_tool_handler function is the generic MCP tool handler that dispatches the 'spix_playbook_create' tool call (and all other tools). It resolves the tool name to a schema, validates session scope/channel/playbook access, builds the endpoint URL, sends a POST request to '/playbooks', and returns the response.
    async def create_tool_handler(
        session: McpSessionContext,
        tool_name: str,
        arguments: dict,
    ) -> list:
        """Execute an MCP tool call by dispatching to the backend API.
    
        This function:
        1. Resolves the tool name to a command schema
        2. Validates session scope (playbook access, channel access)
        3. Builds the API request
        4. Dispatches to the backend
        5. Returns the response as MCP TextContent
    
        Args:
            session: The MCP session context for scope validation.
            tool_name: The MCP tool name (e.g., "spix_playbook_create").
            arguments: The tool arguments from the MCP client.
    
        Returns:
            List containing a single TextContent with the JSON response.
        """
        # Import here to avoid circular imports and handle missing mcp package
        try:
            from mcp.types import TextContent
        except ImportError:
            # Fallback for when mcp is not installed
            class TextContent:  # type: ignore[no-redef]
                def __init__(self, type: str, text: str) -> None:
                    self.type = type
                    self.text = text
    
        # Resolve tool name to schema
        schema = get_schema_by_tool_name(tool_name)
        if not schema:
            return [
                TextContent(
                    type="text",
                    text=orjson.dumps(
                        {"ok": False, "error": {"code": "unknown_tool", "message": f"Unknown tool: {tool_name}"}}
                    ).decode(),
                )
            ]
    
        # Validate tool access (not disabled)
        try:
            session.validate_tool_access(schema.path)
        except Exception as e:
            from spix_mcp.session import McpScopeError
    
            if isinstance(e, McpScopeError):
                return [TextContent(type="text", text=orjson.dumps({"ok": False, "error": e.to_dict()}).decode())]
            raise
    
        # Validate channel access if applicable
        channel = infer_channel_from_tool(schema.path)
        if channel:
            try:
                session.validate_channel_access(channel)
            except Exception as e:
                from spix_mcp.session import McpScopeError
    
                if isinstance(e, McpScopeError):
                    return [TextContent(type="text", text=orjson.dumps({"ok": False, "error": e.to_dict()}).decode())]
                raise
    
        # Handle playbook_id: validate and apply default
        playbook_id = arguments.get("playbook_id")
        try:
            effective_playbook = session.validate_playbook_access(playbook_id)
            if effective_playbook and not playbook_id:
                # Apply default playbook
                arguments["playbook_id"] = effective_playbook
        except Exception as e:
            from spix_mcp.session import McpScopeError
    
            if isinstance(e, McpScopeError):
                return [TextContent(type="text", text=orjson.dumps({"ok": False, "error": e.to_dict()}).decode())]
            raise
    
        # Build endpoint URL with path parameters
        endpoint, remaining_args = build_endpoint_url(schema, arguments)
    
        # Dispatch to backend API
        client = session.client
        method = schema.http_method.lower()
    
        if method == "get":
            response = await asyncio.to_thread(client.get, endpoint, params=remaining_args if remaining_args else None)
        elif method == "post":
            response = await asyncio.to_thread(client.post, endpoint, json=remaining_args if remaining_args else None)
        elif method == "patch":
            response = await asyncio.to_thread(client.patch, endpoint, json=remaining_args if remaining_args else None)
        elif method == "delete":
            response = await asyncio.to_thread(client.delete, endpoint, params=remaining_args if remaining_args else None)
        else:
            response = await asyncio.to_thread(client.get, endpoint)
    
        # Build response envelope
        envelope: dict = {"ok": response.ok, "meta": response.meta}
        if response.ok:
            envelope["data"] = response.data
            if response.pagination:
                envelope["pagination"] = response.pagination
            if response.warnings:
                envelope["warnings"] = response.warnings
        else:
            envelope["error"] = response.error
    
        return [TextContent(type="text", text=orjson.dumps(envelope).decode())]
  • Registration of the 'spix_playbook_create' tool. The tool name is constructed as f'spix_{schema.path.replace(".", "_")}' which maps 'playbook.create' to 'spix_playbook_create'. The Tool object is built with name, description, and inputSchema from the registry.
    tool_schemas = get_mcp_tools(profile=tool_profile, disabled=disabled_tools)
    tool_defs: list[Tool] = []
    
    for schema in tool_schemas:
        # Convert path to tool name: playbook.create -> spix_playbook_create
        tool_name = f"spix_{schema.path.replace('.', '_')}"
        tool_defs.append(
            Tool(
                name=tool_name,
                description=schema.description or f"Spix {schema.path}",
                inputSchema=build_json_schema(schema),
            )
        )
  • The MCP call_tool handler that routes incoming tool calls (including 'spix_playbook_create') to the create_tool_handler function.
    @server.list_tools()
    async def list_tools() -> list[Tool]:
        return tool_defs
    
    @server.call_tool()
    async def call_tool(name: str, arguments: dict) -> Sequence[TextContent]:
        result = await create_tool_handler(session, name, arguments)
        return result
Behavior2/5

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

No annotations are provided, so the description must disclose behavioral traits. It does not mention whether creation is reversible, what side effects occur, or if any validation or constraints apply.

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 a single, well-focused sentence. It contains no unnecessary words, but lacks structured details.

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

Completeness2/5

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

No output schema is provided, and the description does not mention return values, error behavior, or any constraints. For a creation tool with 14 parameters, this is insufficient.

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

Parameters3/5

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

Schema coverage is 100%, and descriptions for each parameter exist. The tool description adds no extra meaning beyond the schema, so baseline score of 3 is appropriate.

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

Purpose4/5

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

The description 'Create a new call or SMS playbook' clearly identifies the action (create) and resource (playbook), and implicitly distinguishes from sibling tools that update, clone, or manage other aspects of playbooks.

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

Usage Guidelines2/5

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

No guidance on when to use this tool compared to alternatives like spix_playbook_update or spix_playbook_clone. Does not mention prerequisites, context, or scenarios where creation is appropriate.

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/Spix-HQ/spix-mcp'

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