A tool object with an inputSchema
The name of the file argument, if the tool can be opened with a file alone
const argument = getToolFileArgument(tool);
if (argument === undefined) {
throw new Error(`${tool.name} cannot be opened with a file alone`);
}
// The file is the only argument
const result = await client.callTool({
name: tool.name,
arguments: { [argument]: fileInput },
});
Find the argument through which a tool takes a file when it is opened from a
"file"entrypoint: its one top-level property marked withx-mcp-file(File Uploads extension,io.modelcontextprotocol/files).Returns
undefinedwhen the input schema marks no top-level property or several, or requires another property: the host cannot open such a tool with a file alone.