getCategories.ts•687 B
import ThingiversePuppeteer from '@/class/thingiverser.class';
import { mcpServer } from '@/index';
mcpServer.tool('get-categories', 'Get things categories from thingiverse', {}, async () => {
const thingiverser = new ThingiversePuppeteer(process.env.APP_TOKEN as string);
await thingiverser.init();
try {
const categories = await thingiverser.getCategories();
await thingiverser.close();
return {
content: [{ type: 'text', text: JSON.stringify(categories, null, 2) }],
};
} catch (error) {
await thingiverser.close();
return {
isError: true,
content: [{ type: 'text', text: `Error fetching random things: ${error}` }],
};
}
});