claude-self-reflect 2.5.9 → 2.5.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/mcp-server/pyproject.toml +1 -1
- package/mcp-server/src/server.py +0 -107
- package/package.json +1 -1
package/mcp-server/src/server.py
CHANGED
|
@@ -758,36 +758,6 @@ To perform a quick search, please:
|
|
|
758
758
|
This limitation exists because MCP tools can only be orchestrated by the client (Claude),
|
|
759
759
|
not by other tools within the MCP server.
|
|
760
760
|
</error>"""
|
|
761
|
-
|
|
762
|
-
# Parse and reformat for quick overview
|
|
763
|
-
import re
|
|
764
|
-
|
|
765
|
-
# Extract count from metadata
|
|
766
|
-
count_match = re.search(r'<tc>(\d+)</tc>', result)
|
|
767
|
-
total_count = count_match.group(1) if count_match else "0"
|
|
768
|
-
|
|
769
|
-
# Extract top result
|
|
770
|
-
score_match = re.search(r'<s>([\d.]+)</s>', result)
|
|
771
|
-
project_match = re.search(r'<p>([^<]+)</p>', result)
|
|
772
|
-
title_match = re.search(r'<t>([^<]+)</t>', result)
|
|
773
|
-
|
|
774
|
-
if score_match and project_match and title_match:
|
|
775
|
-
return f"""<quick_search>
|
|
776
|
-
<total_matches>{total_count}</total_matches>
|
|
777
|
-
<top_result>
|
|
778
|
-
<score>{score_match.group(1)}</score>
|
|
779
|
-
<project>{project_match.group(1)}</project>
|
|
780
|
-
<title>{title_match.group(1)}</title>
|
|
781
|
-
</top_result>
|
|
782
|
-
</quick_search>"""
|
|
783
|
-
else:
|
|
784
|
-
return f"""<quick_search>
|
|
785
|
-
<total_matches>{total_count}</total_matches>
|
|
786
|
-
<message>No relevant matches found</message>
|
|
787
|
-
</quick_search>"""
|
|
788
|
-
except Exception as e:
|
|
789
|
-
await ctx.error(f"Quick search failed: {str(e)}")
|
|
790
|
-
return f"<quick_search><error>{str(e)}</error></quick_search>"
|
|
791
761
|
|
|
792
762
|
|
|
793
763
|
@mcp.tool()
|
|
@@ -811,57 +781,6 @@ Alternative: Call reflect_on_past directly and analyze the results yourself.
|
|
|
811
781
|
This limitation exists because MCP tools can only be orchestrated by the client (Claude),
|
|
812
782
|
not by other tools within the MCP server.
|
|
813
783
|
</error>"""
|
|
814
|
-
|
|
815
|
-
# Parse results for summary generation
|
|
816
|
-
import re
|
|
817
|
-
from collections import Counter
|
|
818
|
-
|
|
819
|
-
# Extract all projects
|
|
820
|
-
projects = re.findall(r'<p>([^<]+)</p>', result)
|
|
821
|
-
project_counts = Counter(projects)
|
|
822
|
-
|
|
823
|
-
# Extract scores for statistics
|
|
824
|
-
scores = [float(s) for s in re.findall(r'<s>([\d.]+)</s>', result)]
|
|
825
|
-
avg_score = sum(scores) / len(scores) if scores else 0
|
|
826
|
-
|
|
827
|
-
# Extract themes from titles and excerpts
|
|
828
|
-
titles = re.findall(r'<t>([^<]+)</t>', result)
|
|
829
|
-
excerpts = re.findall(r'<e>([^<]+)</e>', result)
|
|
830
|
-
|
|
831
|
-
# Extract metadata
|
|
832
|
-
count_match = re.search(r'<tc>(\d+)</tc>', result)
|
|
833
|
-
total_count = count_match.group(1) if count_match else "0"
|
|
834
|
-
|
|
835
|
-
# Generate summary
|
|
836
|
-
summary = f"""<search_summary>
|
|
837
|
-
<total_matches>{total_count}</total_matches>
|
|
838
|
-
<searched_projects>{len(project_counts)}</searched_projects>
|
|
839
|
-
<average_relevance>{avg_score:.2f}</average_relevance>
|
|
840
|
-
<project_distribution>"""
|
|
841
|
-
|
|
842
|
-
for proj, count in project_counts.most_common(3):
|
|
843
|
-
summary += f"\n <project name='{proj}' matches='{count}'/>"
|
|
844
|
-
|
|
845
|
-
summary += f"""
|
|
846
|
-
</project_distribution>
|
|
847
|
-
<common_themes>"""
|
|
848
|
-
|
|
849
|
-
# Simple theme extraction from titles
|
|
850
|
-
theme_words = []
|
|
851
|
-
for title in titles[:5]: # Top 5 results
|
|
852
|
-
words = [w.lower() for w in title.split() if len(w) > 4]
|
|
853
|
-
theme_words.extend(words)
|
|
854
|
-
|
|
855
|
-
theme_counts = Counter(theme_words)
|
|
856
|
-
for theme, count in theme_counts.most_common(5):
|
|
857
|
-
if count > 1: # Only show repeated themes
|
|
858
|
-
summary += f"\n <theme>{theme}</theme>"
|
|
859
|
-
|
|
860
|
-
summary += """
|
|
861
|
-
</common_themes>
|
|
862
|
-
</search_summary>"""
|
|
863
|
-
|
|
864
|
-
return summary
|
|
865
784
|
|
|
866
785
|
|
|
867
786
|
@mcp.tool()
|
|
@@ -885,32 +804,6 @@ To get more search results, please:
|
|
|
885
804
|
This limitation exists because MCP tools can only be orchestrated by the client (Claude),
|
|
886
805
|
not by other tools within the MCP server.
|
|
887
806
|
</error>"""
|
|
888
|
-
|
|
889
|
-
# Parse and extract only the additional results
|
|
890
|
-
import re
|
|
891
|
-
|
|
892
|
-
# Find all result blocks
|
|
893
|
-
result_pattern = r'<r>.*?</r>'
|
|
894
|
-
all_results = re.findall(result_pattern, result, re.DOTALL)
|
|
895
|
-
|
|
896
|
-
# Get only the results after offset
|
|
897
|
-
additional_results = all_results[offset:offset+limit] if len(all_results) > offset else []
|
|
898
|
-
|
|
899
|
-
if not additional_results:
|
|
900
|
-
return """<more_results>
|
|
901
|
-
<message>No additional results found</message>
|
|
902
|
-
</more_results>"""
|
|
903
|
-
|
|
904
|
-
# Reconstruct response with only additional results
|
|
905
|
-
response = f"""<more_results>
|
|
906
|
-
<offset>{offset}</offset>
|
|
907
|
-
<count>{len(additional_results)}</count>
|
|
908
|
-
<results>
|
|
909
|
-
{''.join(additional_results)}
|
|
910
|
-
</results>
|
|
911
|
-
</more_results>"""
|
|
912
|
-
|
|
913
|
-
return response
|
|
914
807
|
|
|
915
808
|
|
|
916
809
|
@mcp.tool()
|