get_collection
Retrieve collection metadata and contained icons by ID, with options for thumbnail size, SVG inclusion, and result limits.
Instructions
Get a collection by ID. Returns collection metadata and the icons it contains.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| collection_id | Yes | The unique ID of the collection | |
| thumbnail_size | No | Thumbnail size to return for icons (42, 84, or 200 pixels) | |
| include_svg | No | Set to 1 to include SVG URLs in the response | |
| limit | No | Maximum number of icons to return from the collection |
Implementation Reference
- src/tools.ts:69-97 (registration)Registers the 'get_collection' tool in the TOOLS array for MCP, including name, description, and input schema definition.{ name: 'get_collection', description: 'Get a collection by ID. Returns collection metadata and the icons it contains.', inputSchema: { type: 'object', properties: { collection_id: { type: 'number', description: 'The unique ID of the collection', }, thumbnail_size: { type: 'number', enum: [42, 84, 200], description: 'Thumbnail size to return for icons (42, 84, or 200 pixels)', }, include_svg: { type: 'number', enum: [0, 1], description: 'Set to 1 to include SVG URLs in the response', }, limit: { type: 'number', description: 'Maximum number of icons to return from the collection', }, }, required: ['collection_id'], }, },
- src/api.ts:23-28 (schema)Defines the TypeScript interface for input parameters to the getCollection function.export interface GetCollectionParams { collection_id: number; thumbnail_size?: 42 | 84 | 200; include_svg?: 0 | 1; limit?: number; }
- src/api.ts:134-156 (handler)Core handler function that executes the 'get_collection' logic by constructing an OAuth-signed GET request to the Noun Project API's /v2/collection/{collection_id} endpoint and returns the response data.async getCollection(params: GetCollectionParams) { const { collection_id, ...rest } = params; const queryParams = new URLSearchParams( Object.fromEntries( Object.entries(rest) .filter(([_, v]) => v !== undefined) .map(([k, v]) => [k, String(v)]) ) ); const queryString = queryParams.toString(); const url = `${BASE_URL}/v2/collection/${collection_id}${ queryString ? `?${queryString}` : '' }`; const headers = this.oauth.getHeaders(url); const response = await this.client.get(`/v2/collection/${collection_id}`, { params: queryParams.toString() ? Object.fromEntries(queryParams) : undefined, headers, }); return response.data; }
- src/index.ts:78-88 (handler)MCP server tool call handler that dispatches 'get_collection' requests to the api.getCollection method and formats the response as MCP content.case 'get_collection': { const result = await api.getCollection(args as any); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }