list_resources
Display all registered game assets in your RPG Maker MZ project with filtering options by type and tags to organize development resources.
Instructions
List all registered resources with optional filtering
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_path | Yes | Project path | |
| tags | No | Filter by tags | |
| type | No | Filter by resource type |
Implementation Reference
- src/resource-manager.ts:252-286 (handler)Core handler function that loads the resource registry, applies filters if provided, and returns the list of matching resources.export async function listResources( projectPath: string, filters?: { type?: Resource["type"]; tags?: string[]; category?: string; } ): Promise<{ success: boolean; resources?: Resource[]; error?: string }> { try { const registry = await loadResourceRegistry(projectPath); let resources = Array.from(registry.resources.values()); // フィルタリング if (filters) { if (filters.type) { resources = resources.filter(r => r.type === filters.type); } if (filters.tags) { resources = resources.filter(r => filters.tags!.some(tag => r.metadata?.tags?.includes(tag)) ); } if (filters.category) { resources = resources.filter(r => r.metadata?.category === filters.category); } } return { success: true, resources }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error) }; } }
- src/index.ts:782-793 (schema)Input schema definition for the list_resources tool, specifying parameters like project_path (required), type, and tags.name: "list_resources", description: "List all registered resources with optional filtering", inputSchema: { type: "object", properties: { project_path: { type: "string", description: "Project path" }, type: { type: "string", description: "Filter by resource type" }, tags: { type: "array", items: { type: "string" }, description: "Filter by tags" }, }, required: ["project_path"], }, },
- src/index.ts:1437-1445 (registration)Registration and dispatch logic in the MCP server's CallToolRequestHandler that invokes the listResources handler with parsed arguments.case "list_resources": { const result = await listResources(args.project_path as string, { type: args.type as any, tags: args.tags as string[] }); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }
- src/resource-manager.ts:10-24 (schema)TypeScript interface defining the structure of Resource objects, which are returned by the listResources function.export interface Resource { id: string; type: "template" | "asset" | "scenario" | "data" | "custom"; name: string; description?: string; content: any; metadata?: { tags?: string[]; category?: string; author?: string; version?: string; createdAt?: string; updatedAt?: string; }; }
- src/resource-manager.ts:49-82 (helper)Helper function to load the resource registry from JSON file, used by listResources to access the resources Map.export async function loadResourceRegistry(projectPath: string): Promise<ResourceRegistry> { await validateProjectPath(projectPath); const registryPath = path.join(projectPath, "data", "ResourceRegistry.json"); const registry: ResourceRegistry = { projectPath, resources: new Map(), prompts: new Map(), lastUpdated: new Date().toISOString() }; try { const data = await FileHelper.readJSON(registryPath); if (data.resources) { for (const resource of data.resources) { registry.resources.set(resource.id, resource); } } if (data.prompts) { for (const prompt of data.prompts) { registry.prompts.set(prompt.id, prompt); } } registry.lastUpdated = data.lastUpdated || registry.lastUpdated; } catch (error) { // レジストリファイルが存在しない場合は新規作成 await Logger.info("Creating new resource registry", { projectPath }); } return registry; }