Skip to main content
Glama
latte-chan
by latte-chan

CSB: Read card index

csb_read_card_index

Retrieve the mapping between Oracle IDs and CSB IDs from local cache to enable efficient card data lookups in Magic: The Gathering applications.

Instructions

Read oracleId→CSB id index from local cache.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
sizeYes
totalYes
cachedAtMsYes

Implementation Reference

  • Inline handler function for csb_read_card_index tool: computes cache path, reads index using readCsbIndex helper, computes size, returns structured content with path/total/size/cachedAtMs or text error if not found.
    async () => {
        const cachePath = process.env.CSB_CARD_INDEX_PATH || require('node:path').join(process.cwd(), 'cache', 'csb-card-index.json');
        const disk = await readCsbIndex(cachePath);
        if (!disk) return { content: [{ type: "text", text: "No CSB card index cache found" }] } as any;
        const size = Object.keys(disk.data.oracleToId || {}).length;
        return { structuredContent: { path: cachePath, total: disk.data.total, size, cachedAtMs: disk.at } } as any;
    }
  • Output schema definition for csb_read_card_index tool using zod schemas.
    const csbReadIndexOutput = {
        path: z.string(),
        total: z.number().int().nonnegative(),
        size: z.number().int().nonnegative(),
        cachedAtMs: z.number()
    } as const;
  • Registers the csb_read_card_index tool on the MCP server with title, description, output schema, and handler.
    server.registerTool(
        "csb_read_card_index",
        {
            title: "CSB: Read card index",
            description: "Read oracleId→CSB id index from local cache.",
            outputSchema: csbReadIndexOutput
        },
        async () => {
            const cachePath = process.env.CSB_CARD_INDEX_PATH || require('node:path').join(process.cwd(), 'cache', 'csb-card-index.json');
            const disk = await readCsbIndex(cachePath);
            if (!disk) return { content: [{ type: "text", text: "No CSB card index cache found" }] } as any;
            const size = Object.keys(disk.data.oracleToId || {}).length;
            return { structuredContent: { path: cachePath, total: disk.data.total, size, cachedAtMs: disk.at } } as any;
        }
    );
  • Helper function readCsbIndex reads the JSON cache file, parses it as CsbCardIndex, returns data with mtimeMs or null on error.
    export async function readCsbIndex(cachePath = DEFAULT_CACHE_PATH): Promise<{ data: CsbCardIndex; at: number } | null> {
        try {
            const [buf, st] = await Promise.all([readFile(cachePath, "utf8"), stat(cachePath)]);
            const data = JSON.parse(buf) as CsbCardIndex;
            return { data, at: st.mtimeMs };
        } catch {
            return null;
        }
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states it reads from a 'local cache', implying it's a read-only operation, but doesn't specify performance characteristics, cache freshness, error handling, or what happens if the cache is empty. This is a significant gap for a tool with zero annotation coverage.

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?

The description is a single, efficient sentence that directly states the tool's function without any fluff. It's front-loaded and wastes no words, making it highly concise and well-structured.

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

Completeness3/5

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

Given the tool has 0 parameters, 100% schema coverage, and an output schema exists, the description is minimally complete. However, it lacks behavioral details (e.g., cache behavior, output format hints) that could enhance agent understanding, especially with no annotations, making it adequate but with clear gaps.

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

Parameters4/5

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

The tool has 0 parameters, and schema description coverage is 100%, so no parameter documentation is needed. The description doesn't add param info, but that's appropriate here, earning a baseline score of 4 for adequately handling the lack of parameters.

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

Purpose4/5

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

The description clearly states the action ('Read') and the resource ('oracleId→CSB id index from local cache'), making the purpose understandable. However, it doesn't explicitly differentiate this from sibling tools like 'csb_lookup_by_oracle_ids' or 'read_tagger_cache', which might involve similar cache operations, so it misses full sibling distinction.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, context, or exclusions, leaving the agent with no usage direction beyond the basic purpose.

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/latte-chan/scryfall-connector'

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