create-stored-procedure
Creates a new stored procedure in a specified database schema with optional code, tags, and ownership.
Instructions
Create a new stored procedure
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Stored Procedure name | |
| databaseSchema | Yes | FQN of the parent database schema | |
| description | No | Stored Procedure description in markdown | |
| storedProcedureCode | No | Stored procedure code definition (e.g. {language:'SQL', code:'...'}) | |
| tags | No | Tags to apply | |
| owners | No | Owner references |
Implementation Reference
- src/tools/stored-procedures.ts:57-60 (handler)The handler function that executes the 'create-stored-procedure' tool logic. It calls assertWriteAllowed() to check write permissions, then POSTs to '/storedProcedures' with the provided parameters.
export async function createStoredProcedure(params: z.infer<typeof createStoredProcedureSchema>) { assertWriteAllowed(); return omClient.post("/storedProcedures", params); } - src/tools/stored-procedures.ts:48-55 (schema)Zod schema for the 'create-stored-procedure' tool, defining input parameters: name (required string), databaseSchema (required string), description (optional string), storedProcedureCode (optional record), tags (optional array), and owners (optional array).
export const createStoredProcedureSchema = z.object({ name: z.string().describe("Stored Procedure name"), databaseSchema: z.string().describe("FQN of the parent database schema"), description: z.string().optional().describe("Stored Procedure description in markdown"), storedProcedureCode: z.record(z.string(), z.any()).optional().describe("Stored procedure code definition (e.g. {language:'SQL', code:'...'})"), tags: z.array(z.record(z.string(), z.any())).optional().describe("Tags to apply"), owners: z.array(z.record(z.string(), z.any())).optional().describe("Owner references"), }); - src/index.ts:395-395 (registration)Registration of the 'create-stored-procedure' tool with its name, description, schema shape, and handler wrapped via wrapToolHandler.
tool("create-stored-procedure", "Create a new stored procedure", createStoredProcedureSchema.shape, wrapToolHandler(createStoredProcedure));