docx-editMeta
Modify DOCX metadata such as title, subject, creator, and keywords programmatically by ID. Streamline document updates and management using structured JSON input for precise changes.
Instructions
Patch metadata of a docx by id.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ||
| patch | Yes |
Implementation Reference
- src/index.ts:182-186 (handler)Main MCP tool handler: validates input arguments using the tool's schema and delegates to DocRegistry.editMeta for execution.case "docx-editMeta": { const { id, patch } = parseArgs<{ id: string; patch: any }>(args, tools["docx-editMeta"].inputSchema); const res = registry.editMeta(id, patch); return ok({ id: res.id, updatedAt: res.updatedAt, meta: res.json.meta }); }
- src/docx-utils.ts:205-210 (helper)Core logic implementation: applies the patch to the document's JSON meta field using shallow merge, then triggers doc rebuild via updateJson.editMeta(id: DocId, patch: Partial<DocxJSON["meta"]>) { return this.updateJson(id, (json) => ({ ...json, meta: { ...(json.meta ?? {}), ...(patch ?? {}) } })); }
- src/index.ts:57-60 (registration)Tool registration: defines name, description, and input schema (referencing DocxSchema.properties.meta for patch validation)."docx-editMeta": { description: "Patch metadata of a docx by id.", inputSchema: { type: "object", required: ["id", "patch"], properties: { id: { type: "string" }, patch: DocxSchema.properties.meta } } },
- src/schema.ts:12-29 (schema)JSON schema definition for the document meta object, referenced by the tool's inputSchema for patch validation.meta: { type: "object", additionalProperties: false, properties: { title: { type: "string" }, subject: { type: "string" }, creator: { type: "string" }, description: { type: "string" }, keywords: { type: "string" }, lastModifiedBy: { type: "string" }, category: { type: "string" }, company: { type: "string" }, manager: { type: "string" }, revision: { type: "string" }, createdAt: { type: "string", format: "date-time" }, modifiedAt: { type: "string", format: "date-time" } } },