arcade-mcp/toolkits/spotify/arcade_spotify/tools/tracks.py
Renato Byrro c5e29693e7
Remove tools relying on deprecated Spotify endpoints (#196)
Spotify deprecated several endpoints in Nov, 2024. Two of them were
being used in Tracks tools. We're removing those from the Toolkit.

Spotify announcement:
https://developer.spotify.com/blog/2024-11-27-changes-to-the-web-api
Archive: https://archive.is/LMBe5
2025-01-08 16:40:36 -03:00

22 lines
618 B
Python

from typing import Annotated
from arcade.sdk import ToolContext, tool
from arcade.sdk.auth import Spotify
from arcade_spotify.tools.utils import (
get_url,
send_spotify_request,
)
@tool(requires_auth=Spotify())
async def get_track_from_id(
context: ToolContext,
track_id: Annotated[str, "The Spotify ID of the track"],
) -> Annotated[dict, "Information about the track"]:
"""Get information about a track"""
url = get_url("tracks_get_track", track_id=track_id)
response = await send_spotify_request(context, "GET", url)
response.raise_for_status()
return dict(response.json())