Skip to main content
Glama

Get AsyncAPI Spec Metadata

get_asyncapi_spec_metadata

Retrieves metadata including source, version, cache, and size for the AsyncAPI specification, optionally specifying a version.

Instructions

Return source, version, cache, and size metadata for the latest AsyncAPI specification.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
versionNoOptional spec version, for example "3.0.0". Defaults to latest from master.

Implementation Reference

  • The handler function for the 'get_asyncapi_spec_metadata' tool. It calls fetchAsyncApiSpec(version) to retrieve the spec entry, then getSpecMetadata(entry) to extract metadata, and returns it as JSON.
    async ({ version }) => {
        try {
            const entry = await fetchAsyncApiSpec(version);
            const metadata = getSpecMetadata(entry);
    
            return {
                content: [{ type: 'text', text: JSON.stringify(metadata, null, 2) }],
                structuredContent: metadata,
            };
        } catch (error) {
            return {
                isError: true,
                content: [{ type: 'text', text: formatUnknownError(error) }],
            };
        }
    }
  • Input schema for the 'get_asyncapi_spec_metadata' tool. It accepts an optional 'version' string parameter (e.g., '3.0.0').
    inputSchema: z.object({
        version: z
            .string()
            .optional()
            .describe('Optional spec version, for example "3.0.0". Defaults to latest from master.'),
    }),
  • src/tools.ts:42-70 (registration)
    Registration of the 'get_asyncapi_spec_metadata' tool on the MCP server via mcpServer.registerTool().
    mcpServer.registerTool(
        'get_asyncapi_spec_metadata',
        {
            title: 'Get AsyncAPI Spec Metadata',
            description: 'Return source, version, cache, and size metadata for the latest AsyncAPI specification.',
            inputSchema: z.object({
                version: z
                    .string()
                    .optional()
                    .describe('Optional spec version, for example "3.0.0". Defaults to latest from master.'),
            }),
        },
        async ({ version }) => {
            try {
                const entry = await fetchAsyncApiSpec(version);
                const metadata = getSpecMetadata(entry);
    
                return {
                    content: [{ type: 'text', text: JSON.stringify(metadata, null, 2) }],
                    structuredContent: metadata,
                };
            } catch (error) {
                return {
                    isError: true,
                    content: [{ type: 'text', text: formatUnknownError(error) }],
                };
            }
        }
    );
  • The getSpecMetadata() helper function that constructs a SpecMetadata object from a SpecCacheEntry, including sourceUrl, version, cache age, content size, etc.
    export const getSpecMetadata = (entry: SpecCacheEntry): SpecMetadata => ({
        sourceUrl: entry.sourceUrl,
        version: entry.version ?? null,
        requestedVersion: entry.requestedVersion ?? null,
        resolvedTag: entry.resolvedTag ?? null,
        fetchedAt: entry.fetchedAt.toISOString(),
        cacheAgeSeconds: Math.floor((Date.now() - entry.fetchedAt.getTime()) / 1000),
        hasEtag: Boolean(entry.etag),
        hasLastModified: Boolean(entry.lastModified),
        contentSizeBytes: new TextEncoder().encode(entry.text).byteLength,
    });
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. Describes what is returned but does not disclose side effects, authentication needs, or error behavior (e.g., if version not found). Adequate but minimal.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence of 12 words, front-loaded with key information. No fluff or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple tool with one optional parameter and no output schema, the description is largely complete. Could specify the output format, but the complexity is low and the listed metadata fields are sufficient.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Single parameter 'version' is fully described in schema with example and default behavior (100% coverage). Tool description adds no extra meaning, so baseline score is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states it returns metadata (source, version, cache, size) for the latest AsyncAPI spec, distinguishing it from siblings like get_asyncapi_spec_section (returns a section) and list_asyncapi_spec_versions (lists versions).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Implied usage: when metadata about the spec is needed. The optional version parameter is noted, but no explicit contrast with alternatives like search or validate is provided. Clear enough given sibling names.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Souvikns/asyncapi-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server