mirror of
https://github.com/modelcontextprotocol/servers.git
synced 2026-04-20 00:53:24 +02:00
remove inlinedResourceLink
This commit is contained in:
@@ -134,9 +134,8 @@ const ZipResourcesInputSchema = z.object({
|
|||||||
files: z.record(z.string().url().describe("URL of the file to include in the zip")).describe("Mapping of file names to URLs to include in the zip"),
|
files: z.record(z.string().url().describe("URL of the file to include in the zip")).describe("Mapping of file names to URLs to include in the zip"),
|
||||||
outputType: z.enum([
|
outputType: z.enum([
|
||||||
'resourceLink',
|
'resourceLink',
|
||||||
'inlinedResourceLink',
|
|
||||||
'resource'
|
'resource'
|
||||||
]).default('inlinedResourceLink').describe("How the resulting zip file should be returned. 'resourceLink' returns a linked to a resource that can be read later, 'inlinedResourceLink' returns a resource_link with a data URI, and 'resource' returns a full resource object."),
|
]).default('resource').describe("How the resulting zip file should be returned. 'resourceLink' returns a linked to a resource that can be read later, 'resource' returns a full resource object."),
|
||||||
});
|
});
|
||||||
|
|
||||||
enum ToolName {
|
enum ToolName {
|
||||||
@@ -891,8 +890,18 @@ export const createServer = () => {
|
|||||||
|
|
||||||
const blob = await zip.generateAsync({ type: "base64" });
|
const blob = await zip.generateAsync({ type: "base64" });
|
||||||
const mimeType = "application/zip";
|
const mimeType = "application/zip";
|
||||||
if (outputType === 'inlinedResourceLink') {
|
const name = `out_${Date.now()}.zip`;
|
||||||
const uri = `data:${mimeType};base64,${blob}`;
|
const uri = `resource://${name}`;
|
||||||
|
const resource = <Resource>{uri, name, mimeType, blob};
|
||||||
|
if (outputType === 'resource') {
|
||||||
|
return {
|
||||||
|
content: [{
|
||||||
|
type: "resource",
|
||||||
|
resource
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
} else if (outputType === 'resourceLink') {
|
||||||
|
transientResources.set(uri, resource);
|
||||||
return {
|
return {
|
||||||
content: [{
|
content: [{
|
||||||
type: "resource_link",
|
type: "resource_link",
|
||||||
@@ -901,28 +910,7 @@ export const createServer = () => {
|
|||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
const name = `out_${Date.now()}.zip`;
|
throw new Error(`Unknown outputType: ${outputType}`);
|
||||||
const uri = `resource://${name}`;
|
|
||||||
const resource = <Resource>{uri, name, mimeType, blob};
|
|
||||||
if (outputType === 'resource') {
|
|
||||||
return {
|
|
||||||
content: [{
|
|
||||||
type: "resource",
|
|
||||||
resource
|
|
||||||
}]
|
|
||||||
};
|
|
||||||
} else if (outputType === 'resourceLink') {
|
|
||||||
transientResources.set(uri, resource);
|
|
||||||
return {
|
|
||||||
content: [{
|
|
||||||
type: "resource_link",
|
|
||||||
mimeType,
|
|
||||||
uri
|
|
||||||
}]
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
throw new Error(`Unknown outputType: ${outputType}`);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user