Skip to content

Commit aa018fc

Browse files
committed
feat: update server to support response modes and domain filtering
1 parent b0d47b4 commit aa018fc

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "groq-compound-mcp-server",
3-
"version": "0.1.5",
3+
"version": "0.1.7",
44
"description": "MCP server for interacting with Groq models",
55
"main": "build/index.js",
66
"type": "module",

src/server.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,27 @@ import { z } from "zod";
33
import Groq from "groq-sdk";
44

55
const ModelEnum = z.enum(["compound-beta", "compound-beta-mini"]);
6+
const ModeEnum = z.enum(["minimal", "verbose"]);
67

78
// Define Tool Schemas
89
export const realtimeToolArgsSchema = z.object({
910
question: z.string().describe("The question to ask the model, especially if it requires real-time information (e.g., current news, recent events)."),
1011
model: ModelEnum.optional()
1112
.default("compound-beta")
1213
.describe("The model to use (compound-beta or compound-beta-mini). Defaults to compound-beta. Use compound-beta-mini for quick answers."),
13-
verbose: z.boolean().optional().default(false).describe("Optional (default: false). If true, includes executed tools in the response. This is very verbose and should only be used when the user asks for it or when the user query cannot be answered without it (always first try without it)."),
14+
mode: ModeEnum.optional().default("minimal").describe("Response mode ('minimal' or 'verbose'). Defaults to 'minimal'. 'verbose' includes executed tools in the response. This is very verbose and should only be used when the user asks for it or when the user query cannot be answered without it (always first try without it)."),
15+
include_domains: z.array(z.string()).optional().describe("List of domains to specifically include in the search."),
16+
exclude_domains: z.array(z.string()).optional().describe("List of domains to exclude from the search."),
1417
});
1518

1619
export const replToolArgsSchema = z.object({
1720
question: z.string().describe("The question to ask the model, especially one that benefits from Python REPL interaction (e.g., for intermediate calculations or code execution)."),
1821
model: ModelEnum.optional()
1922
.default("compound-beta")
2023
.describe("The model to use (compound-beta or compound-beta-mini). Defaults to compound-beta. Use compound-beta-mini for quick answers."),
21-
verbose: z.boolean().optional().default(false).describe("Optional (default: false). If true, includes executed tools in the response. This is very verbose and should only be used when the user asks for it or when the user query cannot be answered without it (always first try without it)."),
24+
mode: ModeEnum.optional().default("minimal").describe("Response mode ('minimal' or 'verbose'). Defaults to 'minimal'. 'verbose' includes executed tools in the response. This is very verbose and should only be used when the user asks for it or when the user query cannot be answered without it (always first try without it)."),
25+
include_domains: z.array(z.string()).optional().describe("List of domains to specifically include in the search."),
26+
exclude_domains: z.array(z.string()).optional().describe("List of domains to exclude from the search."),
2227
});
2328

2429
// Type alias for the arguments
@@ -36,15 +41,18 @@ async function executeGroqQuery(args: ToolArgs) {
3641
content: args.question,
3742
},
3843
],
39-
model: args.model
44+
model: args.model,
45+
// Add include_domains and exclude_domains if they exist in args
46+
...(args.include_domains && { include_domains: args.include_domains }),
47+
...(args.exclude_domains && { exclude_domains: args.exclude_domains }),
4048
});
4149

4250
const choice = chatCompletion.choices[0]?.message;
4351
const responseTextContent = choice?.content || "No response from model.";
4452
let finalResponseText = responseTextContent;
4553

4654
// Check if verbose flag is true
47-
if ('verbose' in args && args.verbose) {
55+
if ('mode' in args && args.mode === 'verbose') {
4856
// Use the logic to get executed_tools
4957
const executedTools = (choice as any)?.executed_tools ?? null;
5058
const responsePayload = {

0 commit comments

Comments
 (0)