find_related_sections
Locate manuscript sections with similar content to reference text using semantic analysis for writing consistency and research.
Instructions
Find content semantically similar to given text
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_path | No | Path to manuscript directory (defaults to current directory) | |
| reference_text | Yes | Text to find related content for | |
| limit | No | Maximum results | |
| exclude_file | No | File to exclude from results |
Implementation Reference
- src/tools/WriterToolHandlers.ts:115-121 (handler)The core handler function implementing the 'find_related_sections' tool logic. It extracts 'reference_text' and 'limit' from the input arguments and performs a semantic search using the underlying WritersAid instance's searchContent method to find related sections.private async findRelatedSections(args: Record<string, unknown>) { const referenceText = args.reference_text as string; const limit = (args.limit as number) || 5; // Use search with the reference text return this.writersAid.searchContent(referenceText, { limit }); }
- The schema definition for the 'find_related_sections' tool, including name, description, input schema with properties like project_path, reference_text, limit, exclude_file, and required fields.{ name: "find_related_sections", description: "Find content semantically similar to given text", inputSchema: { type: "object", properties: { project_path: { type: "string", description: "Path to manuscript directory (defaults to current directory)" }, reference_text: { type: "string", description: "Text to find related content for" }, limit: { type: "number", description: "Maximum results", default: 5 }, exclude_file: { type: "string", description: "File to exclude from results" }, }, required: ["reference_text"], },
- src/tools/WriterToolHandlers.ts:16-17 (registration)The switch case statement in the handleTool method that registers and dispatches calls to the findRelatedSections handler for the 'find_related_sections' tool.case "find_related_sections": return this.findRelatedSections(args);