Skip to main content
Glama

add_url_tool

Index YouTube videos, playlists, or GitHub repositories by URL to enable searchable content retrieval with citations.

Instructions

Add YouTube videos/playlists or GitHub repos to the index via URL.

For local files or directories, use add_document_tool instead.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathsYesURLs to index: YouTube video/playlist or GitHub repo.
tagsNoOptional list of tags, one per URL.
branchNoFor GitHub: override branch (default: main).
include_patternsNoFor GitHub: glob patterns for files to include.
exclude_patternsNoFor GitHub: glob patterns to exclude.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the `add_url_tool`. It validates the input URLs, checks for optional tags, branch and pattern parameters, and then calls `add_files` in a separate thread.
    async def add_url_tool(
        paths: Annotated[
            list[str],
            Field(description="URLs to index: YouTube video/playlist or GitHub repo."),
        ],
        tags: Annotated[
            list[str] | None, Field(description="Optional list of tags, one per URL.")
        ] = None,
        branch: Annotated[
            str | None, Field(description="For GitHub: override branch (default: main).")
        ] = None,
        include_patterns: Annotated[
            list[str] | None,
            Field(description="For GitHub: glob patterns for files to include."),
        ] = None,
        exclude_patterns: Annotated[
            list[str] | None, Field(description="For GitHub: glob patterns to exclude.")
        ] = None,
        ctx: Context | None = None,
    ) -> dict:
        """Add YouTube videos/playlists or GitHub repos to the index via URL.
    
        For local files or directories, use add_document_tool instead.
        """
        input_paths = list(paths or [])
        if not input_paths:
            raise ValueError("paths cannot be empty")
        for i, p in enumerate(input_paths):
            if not _is_url(p):
                raise ValueError(
                    f"path[{i}] is not a URL. Use add_document_tool for local files or directories."
                )
        if tags is not None and len(tags) != len(input_paths):
            raise ValueError("tags must have same length as paths when provided")
    
        def _run() -> dict:
            return add_files(
                paths=input_paths,
                persist_dir=config.get_persist_dir(),
                collection=config.get_collection_name(),
                tags=tags,
                branch=branch,
                include_patterns=include_patterns,
                exclude_patterns=exclude_patterns,
            )
    
        return await anyio.to_thread.run_sync(_run)
  • Registration of the `add_url_tool` using the `mcp.tool()` decorator and wrapping it with `_log_tool_errors`.
    @mcp.tool()
    @_log_tool_errors
Behavior3/5

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

No annotations provided, so description carries full burden. While it identifies the content sources (YouTube/GitHub), it lacks operational details: no mention of idempotency, whether existing entries are overwritten, async/sync processing, or failure modes.

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?

Two efficiently structured sentences. First establishes purpose and supported resources; second provides sibling alternative. No redundancy or unnecessary elaboration.

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?

Complete for tool selection: covers supported resources, indexing action, and sibling differentiation. With output schema present, return values need not be described. Minor gap: does not mention that this is a write/mutation operation or its side effects given lack of annotations.

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

Parameters4/5

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

Schema coverage is 100% (baseline 3). Description adds value by specifying the two distinct URL types (YouTube vs GitHub), which provides necessary semantic context for the domain-specific parameters (branch, include_patterns, exclude_patterns) that would otherwise seem arbitrary.

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?

States specific action ('Add'), resource types ('YouTube videos/playlists or GitHub repos'), destination ('to the index'), and input method ('via URL'). Clearly distinguishes scope from sibling add_document_tool.

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

Usage Guidelines5/5

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

Explicitly directs users to alternative: 'For local files or directories, use add_document_tool instead.' Provides clear when-not-to-use guidance.

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/ndjordjevic/pinrag'

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