|
2 | 2 |
|
3 | 3 | from mcp.server.fastmcp import Context, FastMCP |
4 | 4 |
|
5 | | -from graph_sitter.cli.api.client import RestAPI |
6 | | -from graph_sitter.cli.mcp.agent.docs_expert import create_sdk_expert_agent |
7 | 5 | from graph_sitter.cli.mcp.resources.system_prompt import SYSTEM_PROMPT |
8 | 6 | from graph_sitter.cli.mcp.resources.system_setup_instructions import SETUP_INSTRUCTIONS |
9 | | -from graph_sitter.core.codebase import Codebase |
10 | | -from graph_sitter.shared.enums.programming_language import ProgrammingLanguage |
11 | 7 |
|
12 | 8 | # Initialize FastMCP server |
13 | 9 |
|
@@ -41,51 +37,19 @@ def get_service_config() -> dict[str, Any]: |
41 | 37 | # ----- TOOLS ----- |
42 | 38 |
|
43 | 39 |
|
44 | | -@mcp.tool() |
45 | | -def ask_codegen_sdk(query: Annotated[str, "Ask a question to an exper agent for details about any aspect of the codegen sdk core set of classes and utilities"]): |
46 | | - codebase = Codebase("../../sdk/core") |
47 | | - agent = create_sdk_expert_agent(codebase=codebase) |
48 | | - |
49 | | - result = agent.invoke( |
50 | | - {"input": query}, |
51 | | - config={"configurable": {"thread_id": 1}}, |
52 | | - ) |
53 | | - |
54 | | - return result["messages"][-1].content |
55 | | - |
56 | | - |
57 | 40 | @mcp.tool() |
58 | 41 | def generate_codemod( |
59 | 42 | title: Annotated[str, "The title of the codemod (hyphenated)"], |
60 | | - task: Annotated[str, "The task to which the codemod should implement to solve"], |
61 | 43 | codebase_path: Annotated[str, "The absolute path to the codebase directory"], |
62 | 44 | ctx: Context, |
63 | 45 | ) -> str: |
64 | 46 | """Generate a codemod for the given task and codebase.""" |
65 | | - return f''' |
| 47 | + return f""" |
66 | 48 | Use the graph_sitter.cli to generate a codemod. If you need to intall the cli the command to do so is `uv tool install graph-sitter`. |
67 | 49 | Once installed, run the following command to generate the codemod: |
68 | 50 |
|
69 | | - gs create {title} -d "{task}" |
70 | | - ''' |
71 | | - |
72 | | - |
73 | | -@mcp.tool() |
74 | | -def improve_codemod( |
75 | | - codemod_source: Annotated[str, "The source code of the codemod to improve"], |
76 | | - task: Annotated[str, "The task to which the codemod should implement to solve"], |
77 | | - concerns: Annotated[list[str], "A list of issues that were discovered with the current codemod that need to be considered in the next iteration"], |
78 | | - context: Annotated[dict[str, Any], "Additional context for the codemod this can be a list of files that are related, additional information about the task, etc."], |
79 | | - language: Annotated[ProgrammingLanguage, "The language of the codebase, i.e ALL CAPS PYTHON or TYPESCRIPT "], |
80 | | - ctx: Context, |
81 | | -) -> str: |
82 | | - """Improve the codemod.""" |
83 | | - try: |
84 | | - client = RestAPI() |
85 | | - response = client.improve_codemod(codemod_source, task, concerns, context, language) |
86 | | - return response.codemod_source |
87 | | - except Exception as e: |
88 | | - return f"Error: {e}" |
| 51 | + gs create {title}" |
| 52 | + """ |
89 | 53 |
|
90 | 54 |
|
91 | 55 | if __name__ == "__main__": |
|
0 commit comments