set_requirement
Store publisher or style requirements like word count, citation style, formatting, deadlines, and target audience for manuscript projects to ensure writing compliance.
Instructions
Store a publisher or style requirement
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_path | No | Path to manuscript directory (defaults to current directory) | |
| requirement_type | Yes | Type of requirement | |
| description | Yes | Description of the requirement | |
| value | No | Target value (e.g., '50000' for word count) | |
| enforced | No | Whether this requirement is enforced |
Implementation Reference
- src/tools/WriterToolHandlers.ts:402-423 (handler)Primary handler that processes 'set_requirement' tool arguments and delegates to WritersAid.setRequirement for execution.private async setRequirement(args: Record<string, unknown>) { const requirementType = args.requirement_type as | "word_count" | "citation_style" | "formatting" | "deadline" | "target_audience" | "tone" | "reading_level" | "chapter_count" | "other"; const description = args.description as string; const value = args.value as string | undefined; const enforced = (args.enforced as boolean) || false; return this.writersAid.setRequirement({ requirementType, description, value, enforced, }); }
- Defines the input schema, parameters, and metadata for the 'set_requirement' tool.{ name: "set_requirement", description: "Store a publisher or style requirement", inputSchema: { type: "object", properties: { project_path: { type: "string", description: "Path to manuscript directory (defaults to current directory)" }, requirement_type: { type: "string", enum: ["word_count", "citation_style", "formatting", "deadline", "target_audience", "tone", "reading_level", "chapter_count", "other"], description: "Type of requirement", }, description: { type: "string", description: "Description of the requirement" }, value: { type: "string", description: "Target value (e.g., '50000' for word count)" }, enforced: { type: "boolean", description: "Whether this requirement is enforced", default: false }, }, required: ["requirement_type", "description"], }, },
- src/index.ts:73-75 (registration)Registers the list of available tools including 'set_requirement' via writerToolDefinitions.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: writerToolDefinitions, }));
- src/WritersAid.ts:527-556 (helper)Core helper method in WritersAid that invokes RequirementsManager to persist the requirement.setRequirement(options: { requirementType: | "word_count" | "citation_style" | "formatting" | "deadline" | "target_audience" | "tone" | "reading_level" | "chapter_count" | "other"; description: string; value?: string; enforced?: boolean; }) { const requirement = this.requirementsManager.addRequirement({ requirementType: options.requirementType, description: options.description, value: options.value, enforced: options.enforced || false, }); return { id: requirement.id, requirementType: requirement.requirementType, description: requirement.description, value: requirement.value, enforced: requirement.enforced, }; }
- Database insertion logic that stores the requirement in the SQLite 'writing_requirements' table.addRequirement( requirement: Omit<WritingRequirement, "id" | "createdAt"> ): WritingRequirement { const now = Date.now(); const newRequirement: WritingRequirement = { id: nanoid(), ...requirement, createdAt: now, }; this.db .prepare( `INSERT INTO writing_requirements (id, requirement_type, description, value, enforced, created_at) VALUES (?, ?, ?, ?, ?, ?)` ) .run( newRequirement.id, newRequirement.requirementType, newRequirement.description, newRequirement.value || null, newRequirement.enforced ? 1 : 0, newRequirement.createdAt ); return newRequirement; }