Sync Metadata Cache
sync_metadataFetch and cache all projects, users, versions, categories, and tags from MantisBT to provide a complete overview of your installation. Refresh stale data when needed.
Instructions
Fetch all projects and their associated users, versions, categories, and tags from MantisBT and store them in the local metadata cache.
Tags are fetched via the dedicated GET /tags endpoint when available. On installations where that endpoint is missing (MantisBT < 2.26), tags are collected by scanning all issues across all projects.
This is useful for getting a complete overview of your MantisBT installation. The cache is valid for 24 hours by default (configurable via MANTIS_CACHE_TTL env var). Use this tool to refresh stale data.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/metadata.ts:200-220 (handler)The handler function that executes the sync_metadata tool, calling fetchAndCacheMetadata to refresh the cache.
async () => { try { const data = await fetchAndCacheMetadata(client, cache); const projectCount = data.projects.length; const summary = data.projects.map((p) => { const meta = data.byProject[p.id]; return ` - ${p.name} (ID ${p.id}): ${meta?.users.length ?? 0} users, ${meta?.versions.length ?? 0} versions, ${meta?.categories.length ?? 0} categories`; }).join('\n'); return { content: [{ type: 'text', text: `Metadata synced successfully.\n\n${projectCount} project(s):\n${summary}\n\nGlobal tags: ${data.tags.length}`, }], }; } catch (error) { const msg = error instanceof Error ? error.message : String(error); return { content: [{ type: 'text', text: errorText(msg) }], isError: true }; } } ); - src/tools/metadata.ts:182-199 (registration)Registration of the sync_metadata tool within registerMetadataTools.
server.registerTool( 'sync_metadata', { title: 'Sync Metadata Cache', description: `Fetch all projects and their associated users, versions, categories, and tags from MantisBT and store them in the local metadata cache. Tags are fetched via the dedicated GET /tags endpoint when available. On installations where that endpoint is missing (MantisBT < 2.26), tags are collected by scanning all issues across all projects. This is useful for getting a complete overview of your MantisBT installation. The cache is valid for 24 hours by default (configurable via MANTIS_CACHE_TTL env var). Use this tool to refresh stale data.`, inputSchema: z.object({}), annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, }, },