Skip to main content
Glama

enable_library_source

Add library content to campaigns by enabling entire sources or filtering by type and specific items like classes, spells, or monsters.

Instructions

Enable a library source for the current campaign.

Adds a library source to the campaign's enabled content. You can enable the entire source or filter by content type and specific items.

Examples: - enable_library_source("tome-of-heroes") - Enable all content - enable_library_source("tome-of-heroes", content_type="class") - Enable all classes - enable_library_source("tome-of-heroes", content_type="class", content_names=["dragon-knight"]) - Enable specific class

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
source_idYesThe source identifier (e.g., 'tome-of-heroes')
content_typeNoFilter by content type. Use 'all' or omit to enable entire source.all
content_namesNoSpecific content names to enable (e.g., ['dragon-knight', 'shadow-dancer']). Only used if content_type is specified.

Implementation Reference

  • The enable_library_source function is implemented in the DnDStorage class in src/dm20_protocol/storage.py. It validates that a campaign and library bindings exist, and updates the library bindings to enable the specified source.
    def enable_library_source(
        self,
        source_id: str,
        content_type: str | None = None,
        content_names: list[str] | None = None,
    ) -> None:
        """Enable a library source for the current campaign.
    
        Args:
            source_id: The source identifier to enable
            content_type: Optional content type to filter (e.g., "class", "spell").
                If None, enables all content from the source.
            content_names: Optional list of specific content names to enable.
                Only used if content_type is specified.
        """
        if not self._current_campaign:
            raise ValueError("No current campaign")
    
        if not self._library_bindings:
            raise ValueError("Library bindings not initialized")
    
        # Convert string content_type to ContentType enum if provided
        from .library.models import ContentType
        content_type_enum = None
        if content_type and content_type != "all":
            try:
                content_type_enum = ContentType(content_type)
            except ValueError:
                raise ValueError(f"Invalid content type: {content_type}")
    
        self._library_bindings.enable_source(
            source_id=source_id,
            content_type=content_type_enum,
            content_names=content_names,
        )
        self._save_library_bindings()
        logger.info(f"✅ Enabled library source '{source_id}' for campaign '{self._current_campaign.name}'")
Behavior3/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 states this is an 'enable' operation (implying a write/mutation), but doesn't mention permissions needed, whether changes are reversible, or what happens if the source is already enabled. The examples add practical context but don't cover behavioral traits like error conditions or side effects.

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

Conciseness5/5

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

The description is perfectly structured: a clear opening statement of purpose, followed by concise explanation of filtering options, then practical examples showing increasing specificity. Every sentence earns its place, with no wasted words or redundancy.

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?

For a mutation tool with no annotations and no output schema, the description does well by explaining the operation, parameters, and providing examples. However, it doesn't describe what the tool returns (success/failure indicators, confirmation messages, or error formats), which would be helpful given the lack of output schema.

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 description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds value through examples showing how parameters interact (e.g., content_names only used with content_type), but doesn't provide additional semantic meaning beyond what's in the schema descriptions. This meets the baseline for high schema coverage.

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 with a specific verb ('Enable') and resource ('library source for the current campaign'), and distinguishes it from its sibling 'disable_library_source'. It explains what the tool does: adds a library source to the campaign's enabled content, with optional filtering.

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 provides clear context for when to use this tool (to enable library sources in a campaign) and includes examples showing different usage scenarios. However, it doesn't explicitly state when NOT to use it or mention alternatives like 'disable_library_source' for disabling sources.

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/Polloinfilzato/dm20-protocol'

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