get_package_files
Retrieve the list of files in a package by providing its package ID.
Instructions
Get list of package files
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| packageId | Yes | Id of the package to retrieve files for |
Implementation Reference
- src/api/packages.ts:205-219 (handler)The actual implementation of get_package_files. It takes a packageId, retrieves a package token via getPackageToken, then fetches the list of files from the MASV API endpoint /v1/packages/{packageId}/files.
async function getPackageFiles({ packageId }: GetPackageFilesParams) { const packageToken = await getPackageToken(packageId); const url = new URL(`${MASV_BASE_URL}/v1/packages/${packageId}/files`); const headers = { "content-type": "application/json", "x-package-token": packageToken, }; const r = await fetch(url.toString(), { headers }); const data = await r.json(); return data; } - src/api/packages.ts:199-201 (schema)Defines the Zod input schema for get_package_files, accepting a packageId string parameter.
const GetPackageFilesSchema = z.object({ packageId: z.string().describe("Id of the package to retrieve files for"), }); - src/index.ts:121-136 (registration)Registers the 'get_package_files' tool with the MCP server, linking it to GetPackageFilesSchema for input validation and calling the getPackageFiles handler.
server.registerTool( "get_package_files", { description: "Get list of package files", inputSchema: GetPackageFilesSchema.shape, }, async (args) => { try { const data = await getPackageFiles(args); return mcpOk(data); } catch (error) { return mcpError(error); } }, ); - src/api/packages.ts:194-197 (helper)Helper function used by getPackageFiles that fetches the package details to obtain its access_token for authenticated API requests.
async function getPackageToken(packageId: string) { const data = await getPackage({ packageId }); return data.access_token; } - src/api/packages.ts:344-352 (registration)Exports GetPackageFilesSchema and getPackageFiles from the packages module so they can be imported in src/index.ts for tool registration.
export { GetPackagesSchema, getPackages, GetPackageSchema, getPackage, GetPortalPackagesSchema, getPortalPackages, GetPackageFilesSchema, getPackageFiles,