Skip to main content
Glama

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
NameRequiredDescriptionDefault
project_pathYesProject path
tagsNoFilter by tags
typeNoFilter by resource type

Implementation Reference

  • 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) }; } }
  • 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) }], }; }
  • 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; }; }
  • 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; }

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/ShunsukeHayashi/rpgmaker-mz-mcp'

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