postgres serves the store seat's verbs, databases and query, and lists its tools (hq ADR 0159)
Named as the seat names them so the runtime finds them by name; the same calls as its own tools. Its definition now lists its tools, which is what holding a seat with verbs demands at registration. Merge before the controller declares the verbs on the mesh-store seat.
This commit is contained in:
@@ -133,5 +133,11 @@
|
||||
"from": "Dockerfile"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"tools": [
|
||||
"databases",
|
||||
"query",
|
||||
"postgres_list_databases",
|
||||
"postgres_query"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -8,6 +8,32 @@ import { PostgresClient } from "../client.js";
|
||||
|
||||
export function getPostgresTools(postgres: PostgresClient): ToolDefinition[] {
|
||||
return [
|
||||
// The store seat's verbs (novox/hq ADR 0159), served by this module wherever it holds the seat:
|
||||
// named as the seat names them, so the runtime finds them by name, and answering with the same
|
||||
// calls as this module's own tools below. A holder that is not the store serves nothing here;
|
||||
// the bus admits the seat's subjects only to the holder.
|
||||
{
|
||||
name: "databases",
|
||||
description: "The store seat's verb: every database the store holds, with its on-disk size.",
|
||||
input: {},
|
||||
run: async () => ({ databases: await postgres.listDatabases() }),
|
||||
},
|
||||
{
|
||||
name: "query",
|
||||
description: "The store seat's verb: one read-only statement against one database the store holds.",
|
||||
input: {
|
||||
database: { type: "string", description: "the database to query" },
|
||||
sql: { type: "string", description: "the SELECT (or other read-only) statement" },
|
||||
},
|
||||
run: async (args) => {
|
||||
const database = String(args.database ?? "");
|
||||
const sql = String(args.sql ?? "");
|
||||
if (!database) throw new Error("query: database is required");
|
||||
if (!sql) throw new Error("query: sql is required");
|
||||
const result = await postgres.readOnlyQuery(database, sql);
|
||||
return { database, command: result.command, rows: result.rows };
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "postgres_list_databases",
|
||||
description: "List the databases on the postgres server, with their on-disk size.",
|
||||
|
||||
Reference in New Issue
Block a user