List Tags
list_tagsRetrieve all defined tags from MantisBT bug tracker installations, using the REST API endpoint when available or local metadata cache as fallback.
Instructions
List all tags defined in the MantisBT installation.
The MantisBT REST API exposes a GET /tags endpoint on some installations. If that endpoint is not available, this tool falls back to the local metadata cache populated by sync_metadata.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Page number (default: 1) | |
| page_size | No | Tags per page (default: 50) |
Implementation Reference
- src/tools/config.ts:267-299 (handler)The handler for the 'list_tags' tool, which attempts to fetch tags from the MantisBT API and falls back to a local metadata cache if the API returns a 404.
async ({ page, page_size }) => { try { const result = await client.get<unknown>('tags', { page, page_size }); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; } catch (error) { const msg = error instanceof Error ? error.message : String(error); if (msg.includes('404')) { // GET /tags endpoint not available — fall back to metadata cache const metadata = await cache.load(); if (metadata && Array.isArray(metadata.tags) && metadata.tags.length > 0) { const start = (page - 1) * page_size; const paginated = metadata.tags.slice(start, start + page_size); return { content: [{ type: 'text', text: JSON.stringify({ tags: paginated, source: 'cache' }, null, 2), }], }; } return { content: [{ type: 'text', text: `Error: ${msg}\n\nThe GET /tags endpoint is not available in this MantisBT installation. No cached tags found either — run sync_metadata to populate the cache if your installation provides this endpoint.`, }], isError: true, }; } return { content: [{ type: 'text', text: errorText(msg) }], isError: true }; } } ); - src/tools/config.ts:248-266 (registration)Registration and input schema definition for the 'list_tags' tool.
server.registerTool( 'list_tags', { title: 'List Tags', description: `List all tags defined in the MantisBT installation. The MantisBT REST API exposes a GET /tags endpoint on some installations. If that endpoint is not available, this tool falls back to the local metadata cache populated by sync_metadata.`, inputSchema: z.object({ page: z.coerce.number().int().positive().default(1).describe('Page number (default: 1)'), page_size: z.coerce.number().int().min(1).max(200).default(50).describe('Tags per page (default: 50)'), }), annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, }, },