Get Cached Metadata
get_metadataRetrieve cached metadata summaries from MantisBT including project counts, tag counts, and per-project user, version, and category statistics. Automatically syncs if cache is expired.
Instructions
Return a compact summary of cached MantisBT metadata: project count, tag count, and per-project counts of users, versions, and categories.
If the cache does not exist or has expired (default TTL: 24 hours), it will automatically sync first. Use sync_metadata to force a refresh. For full lists use: list_projects (projects), get_project_users / get_project_versions / get_project_categories (per-project data), list_tags (tags).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/metadata.ts:226-270 (handler)The implementation of the get_metadata tool, which provides a summary of cached MantisBT metadata.
server.registerTool( 'get_metadata', { title: 'Get Cached Metadata', description: `Return a compact summary of cached MantisBT metadata: project count, tag count, and per-project counts of users, versions, and categories. If the cache does not exist or has expired (default TTL: 24 hours), it will automatically sync first. Use sync_metadata to force a refresh. For full lists use: list_projects (projects), get_project_users / get_project_versions / get_project_categories (per-project data), list_tags (tags).`, inputSchema: z.object({}), annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, }, }, async () => { try { const data: CachedMetadata = await cache.loadIfValid() ?? await fetchAndCacheMetadata(client, cache); const summary = { projects: data.projects.length, tags: data.tags.length, byProject: Object.fromEntries( data.projects.map((p) => { const meta = data.byProject[p.id]; return [String(p.id), { name: p.name, users: meta?.users.length ?? 0, versions: meta?.versions.length ?? 0, categories: meta?.categories.length ?? 0, }]; }) ), cached_at: new Date(data.timestamp).toISOString(), ttl_seconds: cache.getRemainingTtlSeconds(data.timestamp), }; return { content: [{ type: 'text', text: JSON.stringify(summary, null, 2) }], }; } catch (error) { const msg = error instanceof Error ? error.message : String(error); return { content: [{ type: 'text', text: errorText(msg) }], isError: true }; } } );