Skip to main content
Glama
jotraynor

Soulseek MCP Server

by jotraynor

search

Find songs and music files on the Soulseek peer-to-peer network by searching with artist names, song titles, or album queries.

Instructions

Search for songs/files on the Soulseek network. Returns a list of available files matching the query.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query (artist name, song title, album, etc.)
limitNoMaximum number of results to return (default: 50)

Implementation Reference

  • MCP tool handler for 'search' tool: parses input with searchSchema, calls soulseekClient.search, formats results, and returns formatted text response.
    case 'search': {
      const parsed = searchSchema.parse(args);
      const results = await soulseekClient.search(parsed.query, parsed.limit);
    
      if (results.length === 0) {
        return {
          content: [
            {
              type: 'text',
              text: `No results found for "${parsed.query}".`,
            },
          ],
        };
      }
    
      const formatted = results.map((r, i) => formatSearchResult(r, i)).join('\n\n');
    
      // Also return structured data for programmatic use
      const jsonData = JSON.stringify(results, null, 2);
    
      return {
        content: [
          {
            type: 'text',
            text: `Found ${results.length} result(s) for "${parsed.query}":\n\n${formatted}\n\n---\nTo download a file, use the download tool with the username and full filename path.`,
          },
        ],
      };
    }
  • Zod schema for validating 'search' tool input parameters: query (required string), limit (optional number, default 50).
    const searchSchema = z.object({
      query: z.string().describe('Search query for songs/files'),
      limit: z.number().optional().default(50).describe('Maximum number of results to return'),
    });
  • src/index.ts:74-91 (registration)
    Registration of 'search' tool in ListToolsRequestHandler: defines name, description, and inputSchema matching searchSchema.
    {
      name: 'search',
      description: 'Search for songs/files on the Soulseek network. Returns a list of available files matching the query.',
      inputSchema: {
        type: 'object',
        properties: {
          query: {
            type: 'string',
            description: 'Search query (artist name, song title, album, etc.)',
          },
          limit: {
            type: 'number',
            description: 'Maximum number of results to return (default: 50)',
          },
        },
        required: ['query'],
      },
    },
  • Core search implementation in SoulseekClientWrapper: performs Soulseek network search, processes results into SearchResult[], sorts by availability and speed, limits results.
    async search(query: string, limit: number = 50): Promise<SearchResult[]> {
      await this.ensureConnected();
    
      if (!this.client) {
        throw new Error('Client not connected');
      }
    
      const results: SearchResult[] = [];
    
      try {
        const searchResults = await this.client.search(query, {
          timeout: 10000,
          onResult: (result) => {
            for (const file of result.files) {
              // Extract attributes
              const bitrate = file.attrs.get(0) ?? null; // FileAttribute.Bitrate = 0
              const duration = file.attrs.get(1) ?? null; // FileAttribute.Duration = 1
    
              results.push({
                username: result.username,
                filename: file.filename,
                size: Number(file.size),
                bitrate,
                duration,
                slotsFree: result.slotsFree,
                speed: result.avgSpeed,
                queueLength: result.queueLength,
              });
            }
          },
        });
    
        // Sort by: slots free first, then by speed descending
        results.sort((a, b) => {
          if (a.slotsFree !== b.slotsFree) {
            return a.slotsFree ? -1 : 1;
          }
          return b.speed - a.speed;
        });
    
        return results.slice(0, limit);
      } catch (error) {
        throw new Error(`Search failed: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
  • TypeScript interface defining the structure of search results returned by the search tool.
    export interface SearchResult {
      username: string;
      filename: string;
      size: number;
      bitrate: number | null;
      duration: number | null;
      slotsFree: boolean;
      speed: number;
      queueLength: number;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions that the tool 'Returns a list of available files matching the query', which gives some output context, but lacks critical details like whether this is a read-only operation, potential rate limits, network dependencies, error conditions, or pagination behavior. For a search tool with zero annotation coverage, this is insufficient.

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 two concise sentences that efficiently state the tool's function and output. It's front-loaded with the core purpose and avoids unnecessary verbiage. However, it could be slightly more structured by explicitly separating purpose from behavioral details.

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

Completeness2/5

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

Given no annotations, no output schema, and a search operation that likely involves network behavior and result formatting, the description is incomplete. It doesn't cover what the returned list contains (e.g., file details, user information), how results are sorted, error handling, or any limitations. For a tool with this complexity and lack of structured data, the description should provide more context.

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 input schema already fully documents both parameters ('query' and 'limit'). The description adds no additional parameter semantics beyond what the schema provides—it doesn't explain query syntax, result ordering, or limit implications. Baseline 3 is appropriate when the schema does all the parameter documentation work.

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: 'Search for songs/files on the Soulseek network' with the specific action 'search' and resource 'songs/files'. It distinguishes from sibling 'download' (which retrieves files) and 'get_status' (which checks system state), though it doesn't explicitly mention these distinctions. The description is specific but could be more explicit about sibling differentiation.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'download' or 'get_status'. It states what the tool does but offers no context about appropriate scenarios, prerequisites, or exclusions. This leaves the agent without usage direction beyond the basic function.

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/jotraynor/SoulseekMCP'

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