search_sounds
Find and retrieve audio samples from Freesound using text queries, with options to filter by duration, sort by various criteria, and control pagination for precise sound discovery.
Instructions
Search for sounds on Freesound using text queries
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query terms | |
| filter | No | Filter query using Solr syntax (e.g., 'duration:[1 TO 5]') | |
| sort | No | Sort results by: score, duration_desc, duration_asc, created_desc, created_asc, downloads_desc, downloads_asc, rating_desc, rating_asc | |
| page | No | Page number (default: 1) | |
| page_size | No | Number of results per page (default: 15, max: 150) |
Implementation Reference
- src/freesound-client.ts:125-137 (handler)Core handler function that executes the Freesound API search request and returns results.async searchSounds(params: SearchParams): Promise<SearchResults> { const response = await this.axiosInstance.get('/search/text/', { params: { query: params.query, filter: params.filter, sort: params.sort, page: params.page || 1, page_size: params.page_size || 15, group_by_pack: params.group_by_pack ? 1 : 0, }, }); return response.data; }
- src/freesound-client.ts:3-10 (schema)TypeScript interface defining the input parameters for the search_sounds tool.export interface SearchParams { query: string; filter?: string; sort?: string; page?: number; page_size?: number; group_by_pack?: boolean; }
- src/freesound-client.ts:97-102 (schema)TypeScript interface defining the output structure of search results.export interface SearchResults { count: number; next: string | null; previous: string | null; results: Sound[]; }
- src/index.ts:35-65 (registration)MCP tool registration including name, description, and input schema for listTools handler.{ name: "search_sounds", description: "Search for sounds on Freesound using text queries", inputSchema: { type: "object", properties: { query: { type: "string", description: "Search query terms", }, filter: { type: "string", description: "Filter query using Solr syntax (e.g., 'duration:[1 TO 5]')", }, sort: { type: "string", description: "Sort results by: score, duration_desc, duration_asc, created_desc, created_asc, downloads_desc, downloads_asc, rating_desc, rating_asc", enum: ["score", "duration_desc", "duration_asc", "created_desc", "created_asc", "downloads_desc", "downloads_asc", "rating_desc", "rating_asc"], }, page: { type: "number", description: "Page number (default: 1)", }, page_size: { type: "number", description: "Number of results per page (default: 15, max: 150)", }, }, required: ["query"], }, },
- src/index.ts:213-229 (handler)Dispatch handler in CallToolRequestSchema that invokes the searchSounds method.case "search_sounds": { const results = await freesoundClient.searchSounds({ query: args.query as string, filter: args.filter as string | undefined, sort: args.sort as string | undefined, page: args.page as number | undefined, page_size: args.page_size as number | undefined, }); return { content: [ { type: "text", text: JSON.stringify(results, null, 2), }, ], }; }