Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:0xsline OpenChatCut Agent Local Media

From Leeroopedia
Knowledge Sources
Domains Agent, Media_Import
Last Updated 2026-10-22 14:00 GMT

Overview

Server-side implementation of the `browse_local_media` agent tool that lists local directories and media files with query filtering and pagination.

Description

The Agent Local Media module validates requests via `isAgentLocalMediaRequest`, resolves the root path via `resolveAgentMediaPath`, then walks the directory tree with BFS. Supports query filtering, kind filtering, recursive mode, and pagination (max 10,000 entries). Re-checks agent import roots before opening each directory.

Usage

  • Agent tools: Enables agents to discover and browse local media before importing.

Code Reference

Source Location

  • Repository: OpenChatCut
  • File: server/agent-local-media.ts
  • Lines: 1-60

Signature

export async function browseLocalMedia(request: AgentLocalMediaRequest): Promise<AgentLocalMediaResult>;

Import

import { browseLocalMedia } from './agent-local-media.ts';

I/O Contract

Inputs

Name Type Required Description
request AgentLocalMediaRequest Yes Root path, query, kind filter, pagination

Outputs

Name Type Description
browseLocalMedia() returns Promise<AgentLocalMediaResult> Directory listing with media files

Usage Examples

Browsing Local Media

import { browseLocalMedia } from './agent-local-media.ts';

const result = await browseLocalMedia({
  root: '/home/user/videos',
  kind: 'video',
  recursive: false,
});
for (const file of result.files) console.log(file.name);

Related Pages

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment