get_current_privileges
Check the permissions and grants of the current database user to debug access issues.
Instructions
Check the permissions and grants of the current database user. Useful for debugging access issues.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:156-166 (handler)The handler function for get_current_privileges that executes the tool logic: queries CURRENT_USER() and SHOW GRANTS from the database.
async () => { const user = await db.query('SELECT CURRENT_USER() as user'); const grants = await db.query('SHOW GRANTS'); return { content: [{ type: 'text', text: JSON.stringify({ currentUser: user, grants }, null, 2) }], }; } ); - src/index.ts:150-166 (registration)Registration of the 'get_current_privileges' tool on the MCP server with its name, description, input schema, and handler function.
server.registerTool( 'get_current_privileges', { description: 'Check the permissions and grants of the current database user. Useful for debugging access issues.', inputSchema: z.object({}), }, async () => { const user = await db.query('SELECT CURRENT_USER() as user'); const grants = await db.query('SHOW GRANTS'); return { content: [{ type: 'text', text: JSON.stringify({ currentUser: user, grants }, null, 2) }], }; } ); - src/index.ts:152-155 (schema)Input schema definition for get_current_privileges — an empty object schema (no parameters required).
{ description: 'Check the permissions and grants of the current database user. Useful for debugging access issues.', inputSchema: z.object({}), },