Skip to main content
Glama

getMedia

Retrieve UI media assets like animations, text effects, buttons, backgrounds, and device mockups from the Eldora UI component library for integration into projects.

Instructions

Provides implementation details for terminal, marquee, github-inline-comments components.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/server.ts:212-247 (registration)
    Dynamic registration of the 'getMedia' tool (and other category tools) via template `get${category}` where 'Media' is a defined category.
      componentCategories,
    )) {
      const componentNamesString = categoryComponents.join(", ");
    
      server.tool(
        `get${category}`,
        `Provides implementation details for ${componentNamesString} components.`,
        {},
        async () => {
          try {
            const categoryResults = await fetchComponentsByCategory(
              categoryComponents,
              components,
              exampleNamesByComponent,
            );
    
            return {
              content: [
                {
                  type: "text",
                  text: JSON.stringify(categoryResults, null, 2),
                },
              ],
            };
          } catch (error) {
            let errorMessage = `Error processing ${category} components`;
            if (error instanceof Error) {
              errorMessage += `: ${error.message}`;
            }
            return {
              content: [{ type: "text", text: errorMessage }],
              isError: true,
            };
          }
        },
      );
  • Core function implementing the logic for the getMedia tool's handler, fetching details for Media components (terminal, marquee, github-inline-comments).
    async function fetchComponentsByCategory(
      categoryComponents: string[],
      allComponents: any[],
      exampleNamesByComponent: Map<string, string[]>,
    ) {
      const componentResults = [];
    
      for (const componentName of categoryComponents) {
        const component = allComponents.find((c) => c.name === componentName);
        if (!component) continue;
    
        try {
          const componentDetails = await fetchComponentDetails(componentName);
          const componentContent = componentDetails.files[0]?.content;
    
          const relevantExampleNames =
            exampleNamesByComponent.get(componentName) || [];
    
          // Generate installation instructions
          const installInstructions = `Install the component using the same process as \
          shadcn/ui. If you run into linter or dependency errors, make sure to install the \
          component using these instructions. For example, with npm/npx: npx shadcn@latest add \
          "https://eldoraui.site/r/${componentName}.json" (Rules: make sure the URL is wrapped in \
          double quotes and use shadcn not shadcn-ui, or the command will fail). After installation, \ 
          you can import the component like this: import { ${formatComponentName(component.name)} } from \
          "@/components/ui/${componentName}";`;
          
          const disclaimerText = `The code below is for context only. It helps you understand \
          the component's props, types, and behavior. To actually install and use the \
          component, refer to the install instructions above. After installing, the component \
          will be available for import via: import { ${formatComponentName(component.name)} } \
          from "@/components/ui/${componentName}";`;
    
          const exampleDetailsList = await Promise.all(
            relevantExampleNames.map((name) => fetchExampleDetails(name)),
          );
    
          const formattedExamples = exampleDetailsList
            .filter((details) => details !== null)
            .map((details) => ({
              name: details.name,
              type: details.type,
              description: details.description,
              content: details.files[0]?.content,
            }));
    
          const validatedComponent = IndividualComponentSchema.parse({
            name: component.name,
            type: component.type,
            description: component.description,
            install: installInstructions,
            content: componentContent && disclaimerText + componentContent,
            examples: formattedExamples,
          });
    
          componentResults.push(validatedComponent);
        } catch (error) {
          console.error(`Error processing component ${componentName}:`, error);
        }
      }
    
      return componentResults;
    }
  • Zod schema used to validate and structure the output of individual components returned by the getMedia tool.
    export const IndividualComponentSchema = ComponentSchema.extend({
      install: z.string(),
      content: z.string(),
      examples: z.array(ExampleSchema),
    });
  • Definition of the 'Media' category components handled by the getMedia tool.
    Media: [
      "terminal",
      "marquee",
      "github-inline-comments",
  • Helper function to map example components to their corresponding UI components, used in getMedia processing.
    function buildExampleComponentMap(
      allExampleComponents: Array<{
        name: string;
        registryDependencies?: string[];
      }>,
    ): Map<string, string[]> {
      const exampleMap = new Map<string, string[]>();
    
      for (const example of allExampleComponents) {
        if (
          example.registryDependencies &&
          Array.isArray(example.registryDependencies)
        ) {
          for (const depUrl of example.registryDependencies) {
            if (typeof depUrl === "string" && depUrl.includes("eldoraui.site")) {
              const componentNameMatch = depUrl.match(/\/r\/([^\/]+)$/);
              if (componentNameMatch && componentNameMatch[1]) {
                const componentName = componentNameMatch[1];
                if (!exampleMap.has(componentName)) {
                  exampleMap.set(componentName, []);
                }
                if (!exampleMap.get(componentName)?.includes(example.name)) {
                  exampleMap.get(componentName)?.push(example.name);
                }
              }
            }
          }
        }
      }
      return exampleMap;
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It mentions 'Provides implementation details' but does not disclose behavioral traits such as whether this is a read-only operation, if it requires authentication, rate limits, or what the output format might be. The description is minimal and lacks critical behavioral context for a tool with no annotations.

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

Conciseness4/5

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

The description is a single sentence that is front-loaded and to the point, with no wasted words. It efficiently states the tool's scope. However, it could be slightly more structured by clarifying the action, but overall it is concise and well-sized for its purpose.

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

Completeness2/5

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

Given no annotations, no output schema, and a vague description, the description is incomplete. It does not explain what 'implementation details' entail, the return format, or behavioral aspects. For a tool with zero parameters but potential complexity in output, more context is needed to guide the agent effectively.

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 there are no parameters to document. The description does not need to add parameter semantics, and it appropriately does not mention any. Baseline is 4 for zero parameters, as the schema fully covers the absence of inputs.

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

Purpose2/5

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

The description states 'Provides implementation details for terminal, marquee, github-inline-comments components' which is somewhat vague about what 'implementation details' means (e.g., documentation, code examples, configuration). It distinguishes from siblings by listing specific components, but the verb 'Provides' is generic and the resource 'implementation details' is ambiguous. This is better than a tautology but lacks specificity about the action.

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 does not provide explicit guidance on when to use this tool versus alternatives like getUIComponents or other siblings. It lists specific components, but this is more about scope than usage context. No exclusions, prerequisites, or comparisons are mentioned, leaving the agent with little direction.

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/eldorauiofficial/mcp'

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