Skip to main content
Glama

initialize

Load Disney park data and generate embeddings to enable semantic search for attractions, dining, and park information. Call once before using discover for meaning-based queries.

Instructions

Initialize the server by loading all Disney park data and generating embeddings for semantic search. Call this once before using discover for meaning-based queries. Returns statistics about loaded entities and embedding generation progress.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
destinationNoSync specific destination. Currently only 'wdw' (Walt Disney World) is supported.
skipEmbeddingsNoSkip embedding generation (faster, but semantic search won't work)
forceNoForce fresh fetch from API, bypassing cache. Use to retry Disney API after session established.

Implementation Reference

  • The main handler function for the 'initialize' tool. It synchronizes Disney park data (attractions, dining, etc.) for specified destinations and optionally generates embeddings for semantic search.
    export const handler: ToolHandler = async (args) => {
      return withTimeout(
        "initialize",
        async () => {
          const destinationFilter = args.destination as DestinationId | undefined;
          const skipEmbeddings = args.skipEmbeddings as boolean | undefined;
          const force = args.force as boolean | undefined;
    
          // DLR session establishment not working yet - focus on WDW for now
          const destinations: DestinationId[] = destinationFilter ? [destinationFilter] : ["wdw"];
          const fetchOptions = { skipCache: force ?? false };
    
          try {
            const client = getDisneyFinderClient();
            const byModel: Record<string, number> = {};
            const stats = {
              destinations: [] as string[],
              attractions: 0,
              dining: 0,
              shows: 0,
              shops: 0,
              events: 0,
              embeddings: {
                total: 0,
                byModel,
              },
              provider: "",
              timing: {
                dataLoadMs: 0,
                embeddingMs: 0,
              },
            };
    
            const dataStart = Date.now();
    
            // Fetch all entity types for each destination
            for (const dest of destinations) {
              stats.destinations.push(dest);
    
              const [attractions, dining, shows, shops, events] = await Promise.all([
                client.getAttractions(dest, undefined, fetchOptions),
                client.getDining(dest, undefined, fetchOptions),
                client.getShows(dest, undefined, fetchOptions),
                client.getShops(dest, undefined, fetchOptions),
                client.getEvents(dest, undefined, fetchOptions),
              ]);
    
              stats.attractions += attractions.length;
              stats.dining += dining.length;
              stats.shows += shows.length;
              stats.shops += shops.length;
              stats.events += events.length;
            }
    
            stats.timing.dataLoadMs = Date.now() - dataStart;
    
            // Initialize embedding provider and generate embeddings
            if (!skipEmbeddings) {
              const embeddingStart = Date.now();
    
              // Initialize provider (triggers model download if needed)
              const provider = await getEmbeddingProvider();
              stats.provider = provider.fullModelName;
    
              // Check if we need to generate embeddings
              // WHY: If data came from cache, no save events fired, so we need to ensure embeddings exist
              const currentEmbeddingStats = await getEmbeddingStats();
              const totalEntities =
                stats.attractions + stats.dining + stats.shows + stats.shops + stats.events;
    
              if (currentEmbeddingStats.total < totalEntities) {
                // Load all entities from DB and generate embeddings
                const allEntities: DisneyEntity[] = [];
                for (const dest of destinations) {
                  const entities = await getEntities<DisneyEntity>({ destinationId: dest });
                  allEntities.push(...entities);
                }
    
                if (allEntities.length > 0) {
                  // Generate embeddings synchronously (blocking)
                  await ensureEmbeddingsBatch(allEntities);
                }
              }
    
              // Get final embedding stats
              const embeddingStats = await getEmbeddingStats();
              stats.embeddings = embeddingStats;
              stats.timing.embeddingMs = Date.now() - embeddingStart;
            }
    
            const totalEntities =
              stats.attractions + stats.dining + stats.shows + stats.shops + stats.events;
    
            return {
              content: [
                {
                  type: "text" as const,
                  text: JSON.stringify(
                    {
                      success: true,
                      message: `Synced ${totalEntities} entities from ${destinations.join(", ")}`,
                      stats,
                      note:
                        stats.embeddings.total < totalEntities
                          ? "Embeddings are still generating in the background. Run status to check progress."
                          : "All embeddings ready for semantic search.",
                    },
                    null,
                    2
                  ),
                },
              ],
            };
          } catch (error) {
            return formatErrorResponse(error);
          }
        },
        TIMEOUTS.SYNC
      );
    };
  • The tool definition including name 'initialize', description, and input schema for parameters like destination (wdw), skipEmbeddings, and force.
    export const definition: ToolDefinition = {
      name: "initialize",
      description:
        "Initialize the server by loading all Disney park data and generating embeddings for semantic search. " +
        "Call this once before using discover for meaning-based queries. " +
        "Returns statistics about loaded entities and embedding generation progress.",
      inputSchema: {
        type: "object" as const,
        properties: {
          destination: {
            type: "string",
            description:
              "Sync specific destination. Currently only 'wdw' (Walt Disney World) is supported.",
            enum: ["wdw"],
          },
          skipEmbeddings: {
            type: "boolean",
            description: "Skip embedding generation (faster, but semantic search won't work)",
          },
          force: {
            type: "boolean",
            description:
              "Force fresh fetch from API, bypassing cache. Use to retry Disney API after session established.",
          },
        },
        required: [],
      },
    };
  • Static registration of the 'initialize' tool (imported from sync.ts) in the tools array, used by getTool() and getToolDefinitions() for MCP ListTools and CallTool requests.
    import * as sync from "./sync.js";
    
    export type { ToolDefinition, ToolHandler, ToolResult, ToolEntry };
    
    /** All available tools */
    const tools: ToolEntry[] = [
      { definition: destinations.definition, handler: destinations.handler },
      { definition: attractions.definition, handler: attractions.handler },
      { definition: dining.definition, handler: dining.handler },
      { definition: search.definition, handler: search.handler },
      { definition: discover.definition, handler: discover.handler },
      { definition: status.definition, handler: status.handler },
      { definition: sync.definition, handler: sync.handler },
    ];
Behavior4/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 effectively describes what the tool does (loads data, generates embeddings), mentions the output ('Returns statistics about loaded entities and embedding generation progress'), and implies it's a setup/initialization operation. However, it doesn't mention potential side effects like data persistence, time requirements, or error conditions.

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 perfectly concise with three sentences that each earn their place: the core functionality, usage guidance, and return value. It's front-loaded with the main purpose and wastes no words while covering essential information.

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?

Given the tool's complexity (server initialization with data loading and embedding generation) and the absence of both annotations and output schema, the description does well by explaining the purpose, usage context, and return values. However, it could be more complete by mentioning potential performance implications, error handling, or what happens on subsequent calls.

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?

Schema description coverage is 100%, so the schema already fully documents all three parameters. The description doesn't add any parameter-specific information beyond what's in the schema, so it meets the baseline expectation but doesn't provide additional semantic context about how parameters affect the initialization process.

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?

The description clearly states the specific action ('initialize the server by loading all Disney park data and generating embeddings for semantic search') and distinguishes it from sibling tools by explicitly mentioning 'discover' as the tool to use after initialization. It specifies both the verb ('initialize') and the resource ('server' with Disney park data).

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool ('Call this once before using discover for meaning-based queries'), which clearly distinguishes it from alternatives like 'discover' and other search/find tools. It establishes a clear prerequisite relationship with the 'discover' tool.

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/cameronsjo/mouse-mcp'

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