Prettier formatting

This commit is contained in:
Allen Zhou 2025-02-19 10:30:17 -08:00
commit 7b68e28f05
2 changed files with 6 additions and 7 deletions

View file

@ -34,7 +34,7 @@ class MCPClient {
async connectToServer(serverScriptPath: string) { async connectToServer(serverScriptPath: string) {
/** /**
* Connect to an MCP server * Connect to an MCP server
* *
* @param serverScriptPath - Path to the server script (.py or .js) * @param serverScriptPath - Path to the server script (.py or .js)
*/ */
try { try {
@ -68,7 +68,7 @@ class MCPClient {
}); });
console.log( console.log(
"Connected to server with tools:", "Connected to server with tools:",
this.tools.map(({ name }) => name) this.tools.map(({ name }) => name),
); );
} catch (e) { } catch (e) {
console.log("Failed to connect to MCP server: ", e); console.log("Failed to connect to MCP server: ", e);
@ -79,7 +79,7 @@ class MCPClient {
async processQuery(query: string) { async processQuery(query: string) {
/** /**
* Process a query using Claude and available tools * Process a query using Claude and available tools
* *
* @param query - The user's input query * @param query - The user's input query
* @returns Processed response as a string * @returns Processed response as a string
*/ */
@ -90,7 +90,6 @@ class MCPClient {
}, },
]; ];
// Initial Claude API call // Initial Claude API call
const response = await this.anthropic.messages.create({ const response = await this.anthropic.messages.create({
model: "claude-3-5-sonnet-20241022", model: "claude-3-5-sonnet-20241022",
@ -117,7 +116,7 @@ class MCPClient {
}); });
toolResults.push(result); toolResults.push(result);
finalText.push( finalText.push(
`[Calling tool ${toolName} with args ${JSON.stringify(toolArgs)}]` `[Calling tool ${toolName} with args ${JSON.stringify(toolArgs)}]`,
); );
// Continue conversation with tool results // Continue conversation with tool results
@ -134,7 +133,7 @@ class MCPClient {
}); });
finalText.push( finalText.push(
response.content[0].type === "text" ? response.content[0].text : "" response.content[0].type === "text" ? response.content[0].text : "",
); );
} }
} }

View file

@ -12,4 +12,4 @@
}, },
"include": ["index.ts"], "include": ["index.ts"],
"exclude": ["node_modules"] "exclude": ["node_modules"]
} }