fix: describe every generated web_data_* tool input to the model by karaposu · Pull Request #175 · brightdata/brightdata-mcp · GitHub
Skip to content
Open
Show file tree
Hide file tree
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
33 changes: 33 additions & 0 deletions dataset_inputs.js
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
"browser_session.js",
"aria_snapshot_filter.js",
"tool_groups.js",
"prompts.js"
"prompts.js",
"dataset_inputs.js"
],
"mcpName": "io.github.brightdata/brightdata-mcp"
}
7 changes: 7 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import axios from 'axios';
import {tools as browser_tools} from './browser_tools.js';
import prompts from './prompts.js';
import {GROUPS} from './tool_groups.js';
import {DATASET_INPUT_DESCRIPTIONS} from './dataset_inputs.js';
import {parse_google_search_response} from './search_utils.js';
import {dataset_id_schema, filter_schema, metadata_to_fields, FILTER_OPERATORS}
from './search_dataset_schema.js';
Expand Down Expand Up @@ -1207,6 +1208,12 @@ for (let {dataset_id, id, description, inputs, defaults = {},
for (let input of inputs)
{
let param_schema = input=='url' ? z.string().url() : z.string();
// Descriptions are keyed by input name; a name with no entry ships
// undescribed (the old behaviour) and is caught by the consistency
// check in test/dataset-inputs.test.js, not at runtime.
const description = DATASET_INPUT_DESCRIPTIONS[input];
if (description)
param_schema = param_schema.describe(description);
parameters[input] = defaults[input] !== undefined ?
param_schema.default(defaults[input]) : param_schema;
}
Expand Down
85 changes: 85 additions & 0 deletions test/dataset-inputs.test.js