Skip to main content
Glama
zas

MusicBrainz MCP Server

by zas

get_entity_relationships

Retrieve relationships for music entities like band members, producers, studios, and Wikipedia links using entity type and MBID from the MusicBrainz database.

Instructions

Get relationships for any entity type (e.g., band members, producers, recording studios, Wikipedia links). Args: entity_type: artist, release, release-group, recording, work, label, area, place, event, instrument, series entity_id: The MBID (must match the entity_type)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
entity_typeYes
entity_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The 'get_entity_relationships' function implementation which fetches entity metadata from the MusicBrainz API and formats relationship data.
    def get_entity_relationships(entity_type: str, entity_id: str) -> str:
        """
        Get relationships for any entity type (e.g., band members, producers,
        recording studios, Wikipedia links).
        Args:
            entity_type: artist, release, release-group, recording, work, label, area,
                         place, event, instrument, series
            entity_id: The MBID (must match the entity_type)
        """
        valid_types = {
            "artist": (musicbrainzngs.get_artist_by_id, ["artist-rels", "url-rels"]),
            "release": (musicbrainzngs.get_release_by_id, ["artist-rels", "url-rels"]),
            "release-group": (
                musicbrainzngs.get_release_group_by_id,
                ["artist-rels", "url-rels"],
            ),
            "recording": (
                musicbrainzngs.get_recording_by_id,
                ["artist-rels", "work-rels", "url-rels"],
            ),
            "work": (musicbrainzngs.get_work_by_id, ["artist-rels", "url-rels"]),
            "label": (musicbrainzngs.get_label_by_id, ["artist-rels", "url-rels"]),
            "area": (musicbrainzngs.get_area_by_id, ["area-rels", "url-rels"]),
            "place": (musicbrainzngs.get_place_by_id, ["place-rels", "url-rels"]),
            "event": (musicbrainzngs.get_event_by_id, ["artist-rels", "url-rels"]),
            "instrument": (
                musicbrainzngs.get_instrument_by_id,
                ["instrument-rels", "url-rels"],
            ),
            "series": (musicbrainzngs.get_series_by_id, ["series-rels", "url-rels"]),
        }
    
        if entity_type not in valid_types:
            return f"Invalid entity type. Choose from: {', '.join(valid_types.keys())}"
    
        func, includes = valid_types[entity_type]
        res = func(entity_id, includes=includes)
        entity = res.get(entity_type)
        if not entity:
            return f"No data found for {entity_type} {entity_id}."
    
        lines = [f"Relationships for {entity_type} {entity_id}:"]
        found = False
    
        # Standardize relation list keys (artist-relation-list, url-relation-list, etc.)
        for key, value in entity.items():
            if key.endswith("-relation-list") and isinstance(value, list):
                for rel in value:
                    rtype = rel.get("type", "Unknown")
                    target = (
                        rel.get("artist", {}).get("name")
                        or rel.get("work", {}).get("title")
                        or rel.get("release", {}).get("title")
                        or rel.get("label", {}).get("name")
                        or rel.get("target", "Unknown")
                    )
                    lines.append(f"  - {rtype.capitalize()}: {target}")
                    found = True
    
        if not found:
            return f"No relationships found for this {entity_type}."
    
        return "\n".join(lines)
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the tool 'gets relationships' but doesn't disclose behavioral traits like whether it's read-only, what authentication is needed, rate limits, pagination, error handling, or what specific relationship types are returned. The examples give some context but lack comprehensive behavioral disclosure for a tool with no annotation coverage.

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 appropriately sized with two sentences and a bullet-like Args section. It's front-loaded with the core purpose, followed by parameter details. No wasted words, though the Args formatting could be slightly more integrated into prose.

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

Completeness3/5

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

Given 2 parameters with 0% schema coverage, the description compensates well for parameters. However, with no annotations and an output schema (which isn't described), the description lacks behavioral context (e.g., safety, performance) and doesn't hint at return values. For a relationship-fetching tool, more context on relationship types or output structure would improve completeness.

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 description coverage is 0%, so the description must compensate. It adds crucial semantics: entity_type is enumerated with 11 specific values (artist, release, etc.) and entity_id is clarified as 'The MBID (must match the entity_type)'. This provides meaning beyond the bare schema, though it doesn't detail MBID format or relationship-specific constraints.

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 clearly states the tool's purpose: 'Get relationships for any entity type' with specific examples (band members, producers, etc.). It distinguishes from siblings like get_artist_details or get_release_details by focusing on relationships rather than core entity details. However, it doesn't explicitly contrast with browse_entities or search_entities which might also involve relationships.

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

Usage Guidelines3/5

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

The description implies usage through examples (e.g., 'band members, producers, recording studios, Wikipedia links') and lists valid entity types, suggesting when to use it for relationship data. However, it doesn't explicitly state when to choose this tool over alternatives like get_artist_details (which might include relationships) or browse_entities, nor does it mention prerequisites or exclusions.

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/zas/mcp-musicbrainz'

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