Skip to main content
Glama
DivyamAgg24

Spotify-Claude MCP Server

by DivyamAgg24

get_artist

Retrieve artist information from Spotify to enhance music discovery through natural language queries.

Instructions

Get Artist name

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
methodYesGet or post request

Implementation Reference

  • The handler function for the 'get_artist' tool. It fetches artist data from the Spotify API using the provided HTTP method, processes the response, extracts artist names, and returns them in a text content block.
    async ({ method }) => {
      const methodUpper = method.toUpperCase();
      const artistData = await fetch("https://api.spotify.com/v1/artists?ids=0TnOYISbd1XYRBk9myaseg", {
        headers: {
          Authorization: `Bearer ${accessToken}`,
        },
        method
    })
    
    if (!artistData) {
    return {
        content: [
        {
            type: "text",
            text: "Failed to retrieve tracks",
        },
        ],
    };
    }
    const allArtistsData = await artistData.json()
    console.log(allArtistsData)
    const data = allArtistsData.artists || [];
    if (data.length===0) {
    return {
        content: [
        {
            type: "text",
            text: `No artists`,
        },
        ],
    };
    }
    let names = []
    for(let i = 0; i<data.length; i++){
        names.push(data[i].name)
    }
    
    const finalOutput = `Artist name is ${names}`;
    
    return {
        content: [
            {
                type: "text",
                text: finalOutput,
            },
        ],
        };
    },
  • Input schema defined using Zod, specifying a 'method' parameter as a string with minimum length 3.
    {
      method: z.string().min(3).describe("Get or post request")
    },
  • src/index.ts:15-69 (registration)
    Registration of the 'get_artist' tool on the MCP server, including name, description, input schema, and handler function.
    server.tool(
        "get_artist",
        "Get Artist name",
        {
          method: z.string().min(3).describe("Get or post request")
        },
        async ({ method }) => {
          const methodUpper = method.toUpperCase();
          const artistData = await fetch("https://api.spotify.com/v1/artists?ids=0TnOYISbd1XYRBk9myaseg", {
            headers: {
              Authorization: `Bearer ${accessToken}`,
            },
            method
        })
        
        if (!artistData) {
        return {
            content: [
            {
                type: "text",
                text: "Failed to retrieve tracks",
            },
            ],
        };
        }
        const allArtistsData = await artistData.json()
        console.log(allArtistsData)
        const data = allArtistsData.artists || [];
        if (data.length===0) {
        return {
            content: [
            {
                type: "text",
                text: `No artists`,
            },
            ],
        };
        }
        let names = []
        for(let i = 0; i<data.length; i++){
            names.push(data[i].name)
        }
    
        const finalOutput = `Artist name is ${names}`;
    
        return {
            content: [
                {
                    type: "text",
                    text: finalOutput,
                },
            ],
            };
        },
    )
Behavior1/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. The description 'Get Artist name' doesn't reveal any behavioral traits—it doesn't mention whether this is a read-only operation, what authentication might be required, potential rate limits, error conditions, or what the response format looks like. For a tool with zero annotation coverage, this is completely inadequate.

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

Conciseness2/5

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

While the description is brief with just two words, this represents under-specification rather than effective conciseness. The text doesn't earn its place by providing useful information—it's too sparse to be helpful. A truly concise description would still convey essential purpose and context efficiently, which this fails to do.

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

Completeness1/5

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

Given the tool's purpose (retrieving artist information) with no annotations and no output schema, the description is completely inadequate. It doesn't explain what the tool returns, how results are formatted, or any behavioral aspects. For a data retrieval tool, this leaves critical gaps that would hinder an AI agent's ability to use it effectively.

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?

The description provides no information about parameters, but the input schema has 100% description coverage with a single parameter 'method' documented as 'Get or post request'. Since schema coverage is high, the baseline score is 3. The description doesn't add any value beyond what the schema already provides, but it also doesn't detract from the existing documentation.

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

Purpose2/5

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

The description 'Get Artist name' is a tautology that essentially restates the tool name 'get_artist' with minor variation. It doesn't specify what resource is being retrieved (e.g., artist information from a database, API, or service) or provide any meaningful context about the operation. While it includes a verb ('Get'), it lacks specificity about what exactly is being obtained beyond the obvious from the name.

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

Usage Guidelines1/5

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

There are no usage guidelines provided in the description. It doesn't indicate when to use this tool, what prerequisites might be needed, or any alternative approaches. With no sibling tools mentioned, the absence of guidance is still problematic as it leaves the agent without context for proper tool selection.

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/DivyamAgg24/SpotifyMCP'

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