Skip to main content
Glama

Probe Media File

media_probe

Inspect video, audio, or image files to retrieve technical metadata using ffprobe, enabling informed decisions for further processing in the video automation pipeline.

Instructions

Use ffprobe to inspect a video/audio/image file under VIDEO_FACTORY_ROOT.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputPathYes

Implementation Reference

  • Registration of the 'media_probe' tool via server.registerTool(), called from src/index.ts line 21.
    export function registerMediaTools(server: McpServer) {
      server.registerTool(
        'media_probe',
        {
          title: 'Probe Media File',
          description: 'Use ffprobe to inspect a video/audio/image file under VIDEO_FACTORY_ROOT.',
          inputSchema: z.object({ inputPath: z.string() })
        },
        async ({ inputPath }) => {
          try {
            const input = safePath(inputPath);
            const args = ['-v', 'error', '-show_format', '-show_streams', '-of', 'json', input];
            const result = await runCommand(config.ffprobeBin, args);
            if (result.code !== 0) return errorResult('ffprobe failed', result.stderr);
            return textResult(JSON.parse(result.stdout));
          } catch (err) {
            return errorResult('Failed to probe media', String(err));
          }
        }
      );
  • Handler function that uses ffprobe to inspect a media file under VIDEO_FACTORY_ROOT. Runs ffprobe with -show_format and -show_streams flags, parses JSON output, and returns results or errors.
    async ({ inputPath }) => {
      try {
        const input = safePath(inputPath);
        const args = ['-v', 'error', '-show_format', '-show_streams', '-of', 'json', input];
        const result = await runCommand(config.ffprobeBin, args);
        if (result.code !== 0) return errorResult('ffprobe failed', result.stderr);
        return textResult(JSON.parse(result.stdout));
      } catch (err) {
        return errorResult('Failed to probe media', String(err));
      }
    }
  • Input schema for media_probe: requires a single string inputPath (path relative to VIDEO_FACTORY_ROOT).
    {
      title: 'Probe Media File',
      description: 'Use ffprobe to inspect a video/audio/image file under VIDEO_FACTORY_ROOT.',
      inputSchema: z.object({ inputPath: z.string() })
    },
  • safePath helper used by the handler to resolve and validate the input path stays within VIDEO_FACTORY_ROOT.
    export function safePath(input: string) {
      ensureRoot();
      const resolved = path.resolve(config.root, input);
      if (!resolved.startsWith(config.root)) {
        throw new Error(`Path escapes VIDEO_FACTORY_ROOT: ${input}`);
      }
      return resolved;
    }
  • runCommand helper used by the handler to execute ffprobe as a subprocess.
    export function runCommand(command: string, args: string[], cwd?: string): Promise<{ code: number; stdout: string; stderr: string }> {
      return new Promise((resolve) => {
        const child = spawn(command, args, { cwd, shell: false });
        let stdout = '';
        let stderr = '';
        child.stdout.on('data', (d) => (stdout += d.toString()));
        child.stderr.on('data', (d) => (stderr += d.toString()));
        child.on('close', (code) => resolve({ code: code ?? -1, stdout, stderr }));
      });
    }
Behavior2/5

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

No annotations provided; description does not disclose side effects (it is read-only), output format, or limitations. Minimal behavioral context.

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?

One sentence, no fluff. Efficient but could be more informative without breaking conciseness.

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 output schema and no annotations, the description should provide more details on expected output and usage context. Currently insufficient for a single-parameter probing tool.

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?

The schema has 0% description coverage. The description adds that inputPath is relative to VIDEO_FACTORY_ROOT, but does not specify format or constraints.

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 tool uses ffprobe to inspect video/audio/image files under a specific root directory, distinguishing it from sibling tools like ffmpeg_transcode.

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?

No guidance on when to use this tool vs alternatives, nor when not to use it. Lacks context for selection.

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/Eliveral/codex-mcp-comfy-ae-video-factory-mcp'

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