codelens-mcp 1.9.8

Pure Rust MCP server for code intelligence — 101 tools (+6 semantic), 25 languages, tree-sitter-first, 50-87% fewer tokens
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
//! Output schema definitions for MCP tools.

use serde_json::json;

pub(super) fn symbol_output_schema() -> serde_json::Value {
    json!({
        "type": "object",
        "properties": {
            "symbols": {
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "name": {"type": "string"},
                        "kind": {"type": "string", "enum": ["function","class","method","interface","enum","variable","module","typealias"]},
                        "file_path": {"type": "string"},
                        "line": {"type": "integer"},
                        "column": {"type": "integer"},
                        "signature": {"type": "string"},
                        "body": {"type": ["string", "null"]},
                        "name_path": {"type": "string"},
                        "id": {"type": "string"}
                    }
                }
            },
            "count": {"type": "integer"},
            "truncated": {"type": "boolean"},
            "auto_summarized": {"type": "boolean"},
            "body_truncated_count": {"type": "integer"},
            "body_preview": {"type": "boolean"}
        }
    })
}

pub(super) fn ranked_context_output_schema() -> serde_json::Value {
    json!({
        "type": "object",
        "properties": {
            "query": {"type": "string"},
            "symbols": {
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "name": {"type": "string"},
                        "kind": {"type": "string"},
                        "file": {"type": "string"},
                        "line": {"type": "integer"},
                        "signature": {"type": "string"},
                        "body": {"type": ["string", "null"]},
                        "relevance_score": {"type": "integer"},
                        "provenance": {
                            "type": "object",
                            "properties": {
                                "source": {
                                    "type": "string",
                                    "enum": ["structural", "semantic_boosted", "semantic_added"]
                                },
                                "structural_candidate": {"type": "boolean"},
                                "semantic_score": {"type": ["number", "null"]}
                            }
                        }
                    }
                }
            },
            "count": {"type": "integer"},
            "token_budget": {"type": "integer"},
            "chars_used": {"type": "integer"},
            "retrieval": {
                "type": "object",
                "properties": {
                    "semantic_enabled": {"type": "boolean"},
                    "semantic_used_in_core": {"type": "boolean"},
                    "lexical_query": {"type": "string"},
                    "semantic_query": {"type": "string"}
                }
            },
            "semantic_evidence": {
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "symbol": {"type": "string"},
                        "file": {"type": "string"},
                        "score": {"type": "number"},
                        "selected": {"type": "boolean"},
                        "final_rank": {"type": ["integer", "null"]}
                    }
                }
            }
        }
    })
}

#[cfg(feature = "semantic")]
pub(super) fn semantic_search_output_schema() -> serde_json::Value {
    json!({
        "type": "object",
        "properties": {
            "query": {"type": "string"},
            "results": {
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "symbol_name": {"type": "string"},
                        "kind": {"type": "string"},
                        "file_path": {"type": "string"},
                        "line": {"type": "integer"},
                        "signature": {"type": "string"},
                        "name_path": {"type": "string"},
                        "score": {"type": "number"},
                        "provenance": {
                            "type": "object",
                            "properties": {
                                "source": {"type": "string", "enum": ["semantic"]},
                                "retrieval_rank": {"type": "integer"},
                                "prior_delta": {"type": "number"},
                                "adjusted_score": {"type": "number"}
                            }
                        }
                    }
                }
            },
            "count": {"type": "integer"},
            "retrieval": {
                "type": "object",
                "properties": {
                    "semantic_enabled": {"type": "boolean"},
                    "requested_query": {"type": "string"},
                    "semantic_query": {"type": "string"}
                }
            }
        }
    })
}

pub(super) fn references_output_schema() -> serde_json::Value {
    json!({
        "type": "object",
        "properties": {
            "references": {
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "file_path": {"type": "string"},
                        "line": {"type": "integer"},
                        "column": {"type": "integer"},
                        "line_content": {"type": "string"},
                        "is_declaration": {"type": "boolean"},
                        "enclosing_symbol": {"type": "string"}
                    }
                }
            },
            "count": {"type": "integer"},
            "returned_count": {"type": "integer"},
            "sampled": {"type": "boolean"},
            "include_context": {"type": "boolean"},
            "backend": {"type": "string"}
        }
    })
}

pub(super) fn impact_output_schema() -> serde_json::Value {
    json!({
        "type": "object",
        "properties": {
            "file": {"type": "string"},
            "symbols": {
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "name": {"type": "string"},
                        "kind": {"type": "string"},
                        "line": {"type": "integer"}
                    }
                }
            },
            "symbol_count": {"type": "integer"},
            "direct_importers": {"type": "array", "items": {"type": "string"}},
            "total_affected_files": {"type": "integer"},
            "blast_radius": {
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "file": {"type": "string"},
                        "depth": {"type": "integer"},
                        "symbol_count": {"type": "integer"}
                    }
                }
            }
        }
    })
}

pub(super) fn diagnostics_output_schema() -> serde_json::Value {
    json!({
        "type": "object",
        "properties": {
            "diagnostics": {
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "file": {"type": "string"},
                        "line": {"type": "integer"},
                        "severity": {"type": "string"},
                        "message": {"type": "string"}
                    }
                }
            },
            "count": {"type": "integer"}
        }
    })
}

pub(super) fn rename_output_schema() -> serde_json::Value {
    json!({
        "type": "object",
        "properties": {
            "success": {"type": "boolean"},
            "modified_files": {"type": "integer"},
            "total_replacements": {"type": "integer"},
            "edits": {
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "file_path": {"type": "string"},
                        "line": {"type": "integer"},
                        "old_text": {"type": "string"},
                        "new_text": {"type": "string"}
                    }
                }
            }
        }
    })
}

pub(super) fn file_content_output_schema() -> serde_json::Value {
    json!({"type":"object","properties":{"content":{"type":"string"}}})
}

pub(super) fn changed_files_output_schema() -> serde_json::Value {
    json!({
        "type": "object",
        "properties": {
            "files": {"type": "array", "items": {"type": "object", "properties": {
                "path": {"type": "string"}, "status": {"type": "string"},
                "symbol_count": {"type": "integer"}
            }}},
            "count": {"type": "integer"}
        }
    })
}

pub(super) fn onboard_output_schema() -> serde_json::Value {
    json!({
        "type": "object",
        "properties": {
            "project_root": {"type": "string"},
            "directory_structure": {"type": "array"},
            "key_files": {"type": "array"},
            "circular_dependencies": {"type": "array"},
            "health": {"type": "object"},
            "semantic": {"type": "object"},
            "suggested_next_tools": {"type": "array", "items": {"type": "string"}}
        }
    })
}

pub(super) fn prune_index_failures_output_schema() -> serde_json::Value {
    json!({
        "type": "object",
        "properties": {
            "pruned_missing_failures": {"type": "integer"},
            "index_failures": {"type": "integer"},
            "index_failures_total": {"type": "integer"},
            "stale_index_failures": {"type": "integer"},
            "persistent_index_failures": {"type": "integer"},
            "recent_failure_window_seconds": {"type": "integer"}
        }
    })
}

pub(super) fn memory_list_output_schema() -> serde_json::Value {
    json!({
        "type": "object",
        "properties": {
            "memories": {"type": "array", "items": {"type": "string"}},
            "count": {"type": "integer"}
        }
    })
}

pub(super) fn analysis_handle_output_schema() -> serde_json::Value {
    json!({
        "type": "object",
        "properties": {
            "analysis_id": {"type": "string"},
            "summary": {"type": "string"},
            "top_findings": {"type": "array", "items": {"type": "string"}},
            "risk_level": {"type": "string", "enum": ["low", "medium", "high"]},
            "confidence": {"type": "number"},
            "next_actions": {"type": "array", "items": {"type": "string"}},
            "blockers": {"type": "array", "items": {"type": "string"}},
            "blocker_count": {"type": "integer"},
            "readiness": {
                "type": "object",
                "properties": {
                    "diagnostics_ready": {"type": "string", "enum": ["ready", "caution", "blocked"]},
                    "reference_safety": {"type": "string", "enum": ["ready", "caution", "blocked"]},
                    "test_readiness": {"type": "string", "enum": ["ready", "caution", "blocked"]},
                    "mutation_ready": {"type": "string", "enum": ["ready", "caution", "blocked"]}
                }
            },
            "readiness_score": {"type": "number", "minimum": 0.0, "maximum": 1.0, "description": "Aggregate readiness score: ready=1.0, caution=0.5, blocked=0.0, averaged across 4 dimensions"},
            "verifier_checks": {
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "check": {"type": "string"},
                        "status": {"type": "string", "enum": ["ready", "caution", "blocked"]},
                        "summary": {"type": "string"},
                        "evidence_section": {"type": ["string", "null"]}
                    }
                }
            },
            "quality_focus": {"type": "array", "items": {"type": "string"}},
            "recommended_checks": {"type": "array", "items": {"type": "string"}},
            "performance_watchpoints": {"type": "array", "items": {"type": "string"}},
            "available_sections": {"type": "array", "items": {"type": "string"}},
            "reused": {"type": "boolean"},
            "schema_version": {"type": "string"},
            "report_kind": {"type": "string"},
            "profile": {"type": "string"},
            "machine_summary": {
                "type": "object",
                "properties": {
                    "finding_count": {"type": "integer"},
                    "next_action_count": {"type": "integer"},
                    "section_count": {"type": "integer"},
                    "blocker_count": {"type": "integer"},
                    "verifier_check_count": {"type": "integer"},
                    "ready_check_count": {"type": "integer"},
                    "blocked_check_count": {"type": "integer"},
                    "quality_focus_count": {"type": "integer"},
                    "recommended_check_count": {"type": "integer"},
                    "performance_watchpoint_count": {"type": "integer"}
                }
            },
            "evidence_handles": {
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "section": {"type": "string"},
                        "uri": {"type": "string"}
                    }
                }
            }
        }
    })
}

pub(super) fn workflow_alias_output_schema() -> serde_json::Value {
    json!({
        "type": "object",
        "properties": {
            "workflow": {"type": "string"},
            "delegated_tool": {"type": "string"},
            "result": {}
        }
    })
}

pub(super) fn analysis_section_output_schema() -> serde_json::Value {
    json!({
        "type": "object",
        "properties": {
            "analysis_id": {"type": "string"},
            "section": {"type": "string"},
            "content": {}
        }
    })
}

pub(super) fn analysis_job_output_schema() -> serde_json::Value {
    json!({
        "type": "object",
        "properties": {
            "job_id": {"type": "string"},
            "kind": {"type": "string"},
            "status": {"type": "string"},
            "progress": {"type": "integer"},
            "current_step": {"type": ["string", "null"]},
            "profile_hint": {"type": ["string", "null"]},
            "analysis_id": {"type": ["string", "null"]},
            "estimated_sections": {"type": "array", "items": {"type": "string"}},
            "error": {"type": ["string", "null"]},
            "updated_at_ms": {"type": "integer"}
        }
    })
}

pub(super) fn replace_content_output_schema() -> serde_json::Value {
    json!({
        "type": "object",
        "properties": {
            "content": {"type": "string", "description": "Full updated file content after replacement"},
            "replacements": {"type": "integer", "description": "Number of replacements performed (text mode only)"}
        }
    })
}

pub(super) fn create_text_file_output_schema() -> serde_json::Value {
    json!({
        "type": "object",
        "properties": {
            "created": {"type": "string", "description": "Relative path of the newly created file"}
        }
    })
}

pub(super) fn add_import_output_schema() -> serde_json::Value {
    json!({
        "type": "object",
        "properties": {
            "success": {"type": "boolean"},
            "file_path": {"type": "string"},
            "content_length": {"type": "integer", "description": "Byte length of the updated file content"}
        }
    })
}

#[cfg(feature = "semantic")]
pub(super) fn find_similar_code_output_schema() -> serde_json::Value {
    json!({
        "type": "object",
        "properties": {
            "query_symbol": {"type": "string"},
            "file": {"type": "string"},
            "min_similarity": {"type": "number"},
            "similar": {
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "file_path": {"type": "string"},
                        "symbol_name": {"type": "string"},
                        "kind": {"type": "string"},
                        "line": {"type": "integer"},
                        "signature": {"type": "string"},
                        "name_path": {"type": "string"},
                        "score": {"type": "number", "description": "Cosine similarity score 0.0-1.0"}
                    }
                }
            },
            "count": {"type": "integer"}
        }
    })
}

#[cfg(feature = "semantic")]
pub(super) fn find_code_duplicates_output_schema() -> serde_json::Value {
    json!({
        "type": "object",
        "properties": {
            "threshold": {"type": "number"},
            "duplicates": {
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "symbol_a": {"type": "string"},
                        "symbol_b": {"type": "string"},
                        "file_a": {"type": "string"},
                        "file_b": {"type": "string"},
                        "line_a": {"type": "integer"},
                        "line_b": {"type": "integer"},
                        "similarity": {"type": "number"}
                    }
                }
            },
            "count": {"type": "integer"}
        }
    })
}

#[cfg(feature = "semantic")]
pub(super) fn classify_symbol_output_schema() -> serde_json::Value {
    json!({
        "type": "object",
        "properties": {
            "symbol": {"type": "string"},
            "file": {"type": "string"},
            "classifications": {
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "category": {"type": "string"},
                        "score": {"type": "number", "description": "Zero-shot cosine similarity score"}
                    }
                }
            }
        }
    })
}

#[cfg(feature = "semantic")]
pub(super) fn find_misplaced_code_output_schema() -> serde_json::Value {
    json!({
        "type": "object",
        "properties": {
            "outliers": {
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "file_path": {"type": "string"},
                        "symbol_name": {"type": "string"},
                        "kind": {"type": "string"},
                        "line": {"type": "integer"},
                        "avg_similarity_to_file": {"type": "number", "description": "Lower values indicate stronger semantic outliers"}
                    }
                }
            },
            "count": {"type": "integer"}
        }
    })
}

// ── Group A: Agent high-frequency tools (v1.7 schema expansion) ────

pub(super) fn activate_project_output_schema() -> serde_json::Value {
    json!({
        "type": "object",
        "properties": {
            "activated": {"type": "boolean"},
            "switched": {"type": "boolean"},
            "project_name": {"type": "string"},
            "project_base_path": {"type": "string"},
            "backend_id": {"type": "string"},
            "memory_count": {"type": "integer"},
            "file_watcher": {"type": "boolean"},
            "frameworks": {"type": "array", "items": {"type": "string"}},
            "auto_surface": {"type": "string"},
            "auto_budget": {"type": "integer"},
            "indexed_files": {"type": "integer"},
            "embedding_ready": {"type": "boolean"}
        }
    })
}

pub(super) fn prepare_harness_session_output_schema() -> serde_json::Value {
    json!({
        "type": "object",
        "properties": {
            "activated": {"type": "boolean"},
            "project": activate_project_output_schema(),
            "active_surface": {"type": "string"},
            "token_budget": {"type": "integer"},
            "config": {
                "type": "object",
                "properties": {
                    "runtime": {"type": "string"},
                    "project_root": {"type": "string"},
                    "surface": {"type": "string"},
                    "token_budget": {"type": "integer"},
                    "tool_count": {"type": "integer"},
                    "client_profile": {"type": "string"}
                }
            },
            "capabilities": get_capabilities_output_schema(),
            "warnings": {
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "code": {"type": "string"},
                        "message": {"type": "string"},
                        "restart_recommended": {"type": "boolean"},
                        "recommended_action": {"type": "string"},
                        "action_target": {"type": "string"}
                    }
                }
            },
            "http_session": {
                "type": "object",
                "properties": {
                    "enabled": {"type": "boolean"},
                    "active_sessions": {"type": "integer"},
                    "timeout_seconds": {"type": "integer"},
                    "resume_supported": {"type": "boolean"},
                    "daemon_mode": {"type": "string"},
                    "client_profile": {"type": "string"},
                    "client_name": {"type": ["string", "null"]},
                    "active_surface": {"type": "string"},
                    "deferred_loading_supported": {"type": "boolean"},
                    "default_deferred_tool_loading": {"type": "boolean"},
                    "default_tools_list_contract_mode": {"type": "string"},
                    "loaded_namespaces": {"type": "array", "items": {"type": "string"}},
                    "loaded_tiers": {"type": "array", "items": {"type": "string"}},
                    "full_tool_exposure": {"type": "boolean"},
                    "deferred_namespace_gate": {"type": "boolean"},
                    "deferred_tier_gate": {"type": "boolean"},
                    "preferred_namespaces": {"type": "array", "items": {"type": "string"}},
                    "preferred_tiers": {"type": "array", "items": {"type": "string"}},
                    "trusted_client_hook": {"type": "boolean"},
                    "mutation_requires_trusted_client": {"type": "boolean"},
                    "mutation_preflight_required": {"type": "boolean"},
                    "preflight_ttl_seconds": {"type": "integer"},
                    "rename_requires_symbol_preflight": {"type": "boolean"},
                    "requires_namespace_listing_before_tool_call": {"type": "boolean"},
                    "requires_tier_listing_before_tool_call": {"type": "boolean"}
                }
            },
            "visible_tools": {
                "type": "object",
                "properties": {
                    "tool_count": {"type": "integer"},
                    "tool_count_total": {"type": "integer"},
                    "tool_names": {"type": "array", "items": {"type": "string"}},
                    "all_namespaces": {"type": "array", "items": {"type": "string"}},
                    "all_tiers": {"type": "array", "items": {"type": "string"}},
                    "preferred_namespaces": {"type": "array", "items": {"type": "string"}},
                    "preferred_tiers": {"type": "array", "items": {"type": "string"}},
                    "loaded_namespaces": {"type": "array", "items": {"type": "string"}},
                    "loaded_tiers": {"type": "array", "items": {"type": "string"}},
                    "effective_namespaces": {"type": "array", "items": {"type": "string"}},
                    "effective_tiers": {"type": "array", "items": {"type": "string"}},
                    "selected_namespace": {"type": ["string", "null"]},
                    "selected_tier": {"type": ["string", "null"]},
                    "deferred_loading_active": {"type": "boolean"},
                    "full_tool_exposure": {"type": "boolean"}
                }
            },
            "routing": {
                "type": "object",
                "properties": {
                    "preferred_entrypoints": {"type": "array", "items": {"type": "string"}},
                    "preferred_entrypoints_source": {"type": "string"},
                    "preferred_entrypoints_visible": {"type": "array", "items": {"type": "string"}},
                    "recommended_entrypoint": {"type": ["string", "null"]}
                }
            },
            "harness": {
                "type": "object",
                "properties": {
                    "effort_level": {"type": "string"},
                    "compression_offset": {"type": "integer"},
                    "meta_max_result_size": {"type": "boolean"},
                    "rapid_burst_detection": {"type": "boolean"},
                    "schema_pre_validation": {"type": "boolean"},
                    "doom_loop_threshold": {"type": "integer"},
                    "preflight_ttl_seconds": {"type": "integer"}
                }
            }
        }
    })
}

pub(super) fn get_capabilities_output_schema() -> serde_json::Value {
    json!({
        "type": "object",
        "properties": {
            "language": {"type": ["string", "null"]},
            "lsp_attached": {"type": "boolean"},
            "diagnostics_guidance": {
                "type": "object",
                "properties": {
                    "status": {"type": "string", "enum": ["available", "file_path_required", "unsupported_extension", "lsp_binary_missing"]},
                    "available": {"type": "boolean"},
                    "reason": {"type": ["string", "null"]},
                    "reason_code": {"type": ["string", "null"]},
                    "recommended_action": {"type": ["string", "null"]},
                    "action_target": {"type": ["string", "null"]},
                    "file_extension": {"type": ["string", "null"]},
                    "language": {"type": ["string", "null"]},
                    "lsp_command": {"type": ["string", "null"]},
                    "server_name": {"type": ["string", "null"]},
                    "install_command": {"type": ["string", "null"]},
                    "package_manager": {"type": ["string", "null"]}
                }
            },
            "embeddings_loaded": {"type": "boolean"},
            "semantic_search_status": {"type": "string", "enum": ["available", "model_assets_unavailable", "not_in_active_surface", "index_missing", "feature_disabled", "not_compiled"]},
            "semantic_search_guidance": {
                "type": "object",
                "properties": {
                    "status": {"type": "string", "enum": ["available", "model_assets_unavailable", "not_in_active_surface", "index_missing", "feature_disabled", "not_compiled"]},
                    "available": {"type": "boolean"},
                    "reason": {"type": ["string", "null"]},
                    "reason_code": {"type": ["string", "null"]},
                    "recommended_action": {"type": ["string", "null"]},
                    "action_target": {"type": ["string", "null"]}
                }
            },
            "embedding_model": {"type": "string"},
            "embedding_runtime_preference": {"type": "string"},
            "embedding_runtime_backend": {"type": "string"},
            "embedding_threads": {"type": ["integer", "null"]},
            "embedding_max_length": {"type": ["integer", "null"]},
            "embedding_indexed": {"type": "boolean"},
            "embedding_indexed_symbols": {"type": "integer"},
            "index_fresh": {"type": "boolean"},
            "indexed_files": {"type": "integer"},
            "available": {"type": "array", "items": {"type": "string"}},
            "unavailable": {
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "feature": {"type": "string"},
                        "reason": {"type": "string"},
                        "status": {"type": "string"},
                        "reason_code": {"type": ["string", "null"]},
                        "recommended_action": {"type": ["string", "null"]},
                        "action_target": {"type": ["string", "null"]},
                        "file_extension": {"type": ["string", "null"]},
                        "language": {"type": ["string", "null"]},
                        "lsp_command": {"type": ["string", "null"]},
                        "server_name": {"type": ["string", "null"]},
                        "install_command": {"type": ["string", "null"]},
                        "package_manager": {"type": ["string", "null"]}
                    }
                }
            },
            "binary_version": {"type": "string"},
            "binary_git_sha": {"type": "string"},
            "binary_build_time": {"type": "string"},
            "daemon_started_at": {"type": "string"},
            "daemon_binary_drift": {
                "type": "object",
                "properties": {
                    "status": {"type": "string", "enum": ["ok", "stale", "unknown"]},
                    "stale_daemon": {"type": "boolean"},
                    "restart_recommended": {"type": "boolean"},
                    "reason_code": {"type": ["string", "null"]},
                    "recommended_action": {"type": ["string", "null"]},
                    "action_target": {"type": ["string", "null"]},
                    "executable_path": {"type": "string"},
                    "executable_modified_at": {"type": "string"},
                    "daemon_started_at": {"type": "string"},
                    "binary_build_time": {"type": "string"},
                    "binary_git_sha": {"type": "string"},
                    "reason": {"type": ["string", "null"]}
                }
            },
            "binary_build_info": {
                "type": "object",
                "properties": {
                    "version": {"type": "string"},
                    "git_sha": {"type": "string"},
                    "git_dirty": {"type": "boolean"},
                    "build_time": {"type": "string"}
                }
            }
        }
    })
}

pub(super) fn get_current_config_output_schema() -> serde_json::Value {
    json!({
        "type": "object",
        "properties": {
            "project_name": {"type": "string"},
            "project_base_path": {"type": "string"},
            "preset": {"type": "string"},
            "profile": {"type": "string"},
            "surface": {"type": "string"},
            "token_budget": {"type": "integer"},
            "effort_level": {"type": "string"},
            "daemon_mode": {"type": "boolean"},
            "transport": {"type": "string"}
        }
    })
}

pub(super) fn search_for_pattern_output_schema() -> serde_json::Value {
    json!({
        "type": "object",
        "properties": {
            "matches": {
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "file": {"type": "string"},
                        "line": {"type": "integer"},
                        "column": {"type": "integer"},
                        "text": {"type": "string"},
                        "context_before": {"type": "string"},
                        "context_after": {"type": "string"}
                    }
                }
            },
            "count": {"type": "integer"},
            "truncated": {"type": "boolean"}
        }
    })
}

pub(super) fn find_annotations_output_schema() -> serde_json::Value {
    json!({
        "type": "object",
        "properties": {
            "annotations": {
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "file": {"type": "string"},
                        "line": {"type": "integer"},
                        "tag": {"type": "string"},
                        "text": {"type": "string"}
                    }
                }
            },
            "count": {"type": "integer"}
        }
    })
}

pub(super) fn find_tests_output_schema() -> serde_json::Value {
    json!({
        "type": "object",
        "properties": {
            "tests": {
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "file": {"type": "string"},
                        "name": {"type": "string"},
                        "line": {"type": "integer"},
                        "kind": {"type": "string"}
                    }
                }
            },
            "count": {"type": "integer"}
        }
    })
}

pub(super) fn get_project_structure_output_schema() -> serde_json::Value {
    json!({
        "type": "object",
        "properties": {
            "directories": {
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "path": {"type": "string"},
                        "files": {"type": "integer"},
                        "languages": {"type": "array", "items": {"type": "string"}}
                    }
                }
            },
            "total_files": {"type": "integer"},
            "total_directories": {"type": "integer"}
        }
    })
}

pub(super) fn get_type_hierarchy_output_schema() -> serde_json::Value {
    json!({
        "type": "object",
        "properties": {
            "root": {
                "type": "object",
                "properties": {
                    "name": {"type": "string"},
                    "kind": {"type": "string"},
                    "file": {"type": "string"},
                    "line": {"type": "integer"},
                    "children": {"type": "array"}
                }
            },
            "depth": {"type": "integer"}
        }
    })
}