Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/everything/everything.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ const PrintEnvSchema = z.object({});

const SampleLLMSchema = z.object({
prompt: z.string().describe("The prompt to send to the LLM"),
includeContext: z.enum(["none", "thisServer", "allServers"]).default("none").describe("The level of context to include from this server or all servers"),
preferredModelName: z.string().optional().describe("Preferred model name to use for sampling"),
maxTokens: z
.number()
.default(100)
Expand Down Expand Up @@ -220,7 +222,9 @@ export const createServer = () => {
const requestSampling = async (
context: string,
uri: string,
maxTokens: number = 100
maxTokens: number = 100,
includeContext: "none" | "thisServer" | "allServers" = "none",
preferredModelName?: string
) => {
const request: CreateMessageRequest = {
method: "sampling/createMessage",
Expand All @@ -237,7 +241,10 @@ export const createServer = () => {
systemPrompt: "You are a helpful test server.",
maxTokens,
temperature: 0.7,
includeContext: "thisServer",
includeContext,
modelPreferences: {
hints: preferredModelName !== undefined ? [{name: preferredModelName}] : undefined,
},
},
};

Expand Down Expand Up @@ -610,12 +617,14 @@ export const createServer = () => {

if (name === ToolName.SAMPLE_LLM) {
const validatedArgs = SampleLLMSchema.parse(args);
const { prompt, maxTokens } = validatedArgs;
const { prompt, maxTokens, includeContext, preferredModelName } = validatedArgs;

const result = await requestSampling(
prompt,
ToolName.SAMPLE_LLM,
maxTokens
maxTokens,
includeContext,
preferredModelName,
);
return {
content: [
Expand Down Expand Up @@ -735,6 +744,7 @@ export const createServer = () => {
properties: {
color: { type: 'string', description: 'Favorite color' },
number: { type: 'integer', description: 'Favorite number', minimum: 1, maximum: 100 },
number: { type: 'number', description: 'Favorite number', minimum: 0, maximum: 1000, default: 3.14 },
pets: {
type: 'string',
enum: ['cats', 'dogs', 'birds', 'fish', 'reptiles'],
Expand Down
Loading