suggest_cross_references
Analyzes manuscript sections to identify where cross-references should be added, helping writers connect related content and improve document navigation.
Instructions
Suggest where to add links between sections
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "suggest_cross_references"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_path | No | Path to manuscript directory (defaults to current directory) | |
| min_similarity | No | Minimum similarity threshold | |
| exclude_existing_links | No | Exclude existing links |
Implementation Reference
- src/tools/WriterToolHandlers.ts:218-235 (handler)The handler function that implements the core logic of suggest_cross_references by finding similar content via findDuplicates and generating cross-reference suggestions.
private async suggestCrossReferences(args: Record<string, unknown>) { const minSimilarity = (args.min_similarity as number) || 0.7; const limit = resolvePaginationLimit("suggest_cross_references", args.limit as number | undefined); // Find similar content that could be cross-referenced const duplicates = await this.writersAid.findDuplicates({ similarityThreshold: minSimilarity, limit, }); return { suggestions: duplicates.map((d) => ({ from: d.file1, to: d.file2, reason: `Similar content (${Math.round(d.similarity * 100)}% match)`, })), }; } - The JSON schema defining the input parameters for the suggest_cross_references tool.
{ name: "suggest_cross_references", description: "Suggest where to add links between sections", inputSchema: { type: "object", properties: { project_path: { type: "string", description: "Path to manuscript directory (defaults to current directory)" }, min_similarity: { type: "number", description: "Minimum similarity threshold", default: 0.7, }, exclude_existing_links: { type: "boolean", description: "Exclude existing links", default: true, }, }, }, }, - src/tools/WriterToolHandlers.ts:40-41 (registration)The switch case that registers and routes calls to the suggest_cross_references handler in the main tool dispatcher.
case "suggest_cross_references": return this.suggestCrossReferences(args); - src/utils/pagination.ts:13-22 (helper)Pagination configuration for suggest_cross_references tool used by resolvePaginationLimit to enforce limits and defaults.
export const PAGINATION_DEFAULTS: Record<string, { default: number; max: number }> = { find_gaps: { default: 20, max: 100 }, find_todos: { default: 50, max: 200 }, find_duplicates: { default: 30, max: 100 }, check_terminology: { default: 20, max: 50 }, find_broken_links: { default: 50, max: 200 }, track_concept_evolution: { default: 10, max: 50 }, suggest_cross_references: { default: 25, max: 100 }, analyze_link_graph: { default: 100, max: 500 }, };