The protocol distinguishes things that are read from things that are called, and a schema is the first.
server.resource(
'schema://tables',
async () => ({
contents: [{
uri: 'schema://tables',
mimeType: 'application/json',
text: JSON.stringify(await describeAllTables()),
}],
}),
)
// a resource is offered and can be read without being
// asked for. a tool must be invoked, which means a
// round trip and a decision.
Exposing the schema as a resource rather than as a describe_table tool removes an entire class of interaction — the client has it before it asks. It also means the schema is fetched whether or not it is needed, which on a database with four hundred tables would be the wrong choice and on ours is forty kilobytes.