project_details
Retrieve project metadata including name, terms count, and last activity to prepare for translation management operations in POEditor.
Instructions
Retrieve project metadata such as name, terms count, and last activity. Useful before performing other operations on the project.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | No |
Implementation Reference
- src/server.ts:144-149 (handler)Handler function for the 'project_details' tool. It resolves the project ID using the helper, calls the POEditor API endpoint 'projects/view', extracts the project object from the response, and returns it formatted as JSON text content.async (args) => { const id = requireProjectId(args.project_id ?? null); const res = await poeditor("projects/view", { id: String(id) }); const project = res.result?.project ?? res.result ?? {}; return { content: [{ type: "text", text: JSON.stringify(project, null, 2) }] }; }
- src/server.ts:103-105 (schema)Zod input schema for the 'project_details' tool, accepting an optional positive integer project_id.const ProjectDetailsInput = z.object({ project_id: z.number().int().positive().optional() });
- src/server.ts:140-150 (registration)Registration of the 'project_details' tool on the MCP server using server.tool(), including the tool name, description, input schema reference, and inline handler implementation.server.tool( "project_details", "Retrieve project metadata such as name, terms count, and last activity. Useful before performing other operations on the project.", ProjectDetailsInput.shape, async (args) => { const id = requireProjectId(args.project_id ?? null); const res = await poeditor("projects/view", { id: String(id) }); const project = res.result?.project ?? res.result ?? {}; return { content: [{ type: "text", text: JSON.stringify(project, null, 2) }] }; } );
- src/server.ts:40-44 (helper)Helper function used by the project_details handler (and others) to resolve the project ID from tool arguments or the POEDITOR_PROJECT_ID environment variable.function requireProjectId(argProjectId?: number | null) { const id = argProjectId ?? (PROJECT_ID ? Number(PROJECT_ID) : null); if (!id) throw new Error("project_id is required (either pass it to the tool or set POEDITOR_PROJECT_ID)"); return id; }
- src/server.ts:19-38 (helper)Core helper function for making authenticated API requests to POEditor, used by the project_details handler to fetch project details.export async function poeditor(endpoint: string, form: Record<string, string>) { const body = new URLSearchParams({ api_token: API_TOKEN!, ...form }); const { body: resBody } = await request(`${API_BASE}/${endpoint}`, { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded" }, body: body.toString() }); const text = await resBody.text(); let json: any; try { json = JSON.parse(text); } catch (e) { throw new Error(`POEditor: invalid JSON response: ${text}`); } const status = json?.response?.status; if (status !== "success") { const code = json?.response?.code; const message = json?.response?.message || "Unknown POEditor error"; throw new Error(`POEditor API error ${code ?? ""}: ${message}`); } return json; }