|
19 | 19 | # Resources |
20 | 20 | @mcp.resource( |
21 | 21 | "catalog://main", |
22 | | - name="show_catalogs", |
| 22 | + name="list_catalogs", |
23 | 23 | description="List all available Trino catalogs", |
24 | 24 | ) |
25 | | -def show_catalogs() -> str: |
| 25 | +def list_catalogs() -> str: |
26 | 26 | """List all available Trino catalogs.""" |
27 | | - return client.show_catalogs() |
| 27 | + return client.list_catalogs() |
28 | 28 |
|
29 | 29 |
|
30 | 30 | @mcp.resource( |
31 | 31 | "schema://{catalog}", |
32 | | - name="show_schemas", |
| 32 | + name="list_schemas", |
33 | 33 | description="List all schemas in the specified catalog", |
34 | 34 | ) |
35 | | -def show_schemas(catalog: str) -> str: |
| 35 | +def list_schemas(catalog: str) -> str: |
36 | 36 | """List all schemas in a catalog.""" |
37 | | - return client.show_schemas(catalog) |
| 37 | + return client.list_schemas(catalog) |
38 | 38 |
|
39 | 39 |
|
40 | 40 | @mcp.resource( |
41 | 41 | "table://{catalog}/{schema}", |
42 | | - name="show_tables", |
| 42 | + name="list_tables", |
43 | 43 | description="List all tables in the specified schema", |
44 | 44 | ) |
45 | | -def show_tables(catalog: str, schema: str) -> str: |
| 45 | +def list_tables(catalog: str, schema: str) -> str: |
46 | 46 | """List all tables in a schema.""" |
47 | | - return client.show_tables(catalog, schema) |
| 47 | + return client.list_tables(catalog, schema) |
48 | 48 |
|
49 | 49 |
|
50 | 50 | # Tools |
| 51 | +@mcp.tool(description="List all available catalogs") |
| 52 | +def show_catalogs() -> str: |
| 53 | + """List all available catalogs.""" |
| 54 | + return client.list_catalogs() |
| 55 | + |
| 56 | + |
| 57 | +@mcp.tool(description="List all schemas in a catalog") |
| 58 | +def show_schemas(catalog: str) -> str: |
| 59 | + """List all schemas in a catalog. |
| 60 | +
|
| 61 | + Args: |
| 62 | + catalog: The name of the catalog |
| 63 | +
|
| 64 | + Returns: |
| 65 | + str: List of schemas in the specified catalog |
| 66 | + """ |
| 67 | + return client.list_schemas(catalog) |
| 68 | + |
| 69 | + |
| 70 | +@mcp.tool(description="List all tables in a schema") |
| 71 | +def show_tables(catalog: str, schema: str) -> str: |
| 72 | + """List all tables in a schema. |
| 73 | +
|
| 74 | + Args: |
| 75 | + catalog: The name of the catalog |
| 76 | + schema: The name of the schema |
| 77 | +
|
| 78 | + Returns: |
| 79 | + str: List of tables in the specified schema |
| 80 | + """ |
| 81 | + return client.list_tables(catalog, schema) |
| 82 | + |
| 83 | + |
| 84 | +@mcp.tool(description="Describe a table") |
| 85 | +def describe_table(table: str, catalog: str | None = None, schema: str | None = None) -> str: |
| 86 | + """Describe a table. |
| 87 | +
|
| 88 | + Args: |
| 89 | + table: The name of the table |
| 90 | + catalog: Optional catalog name (defaults to configured catalog) |
| 91 | + schema: Optional schema name (defaults to configured schema) |
| 92 | +
|
| 93 | + Returns: |
| 94 | + str: Table description in JSON format |
| 95 | + """ |
| 96 | + return client.describe_table(table, catalog, schema) |
| 97 | + |
| 98 | + |
51 | 99 | @mcp.tool(description="Show the CREATE TABLE statement for a specific table") |
52 | 100 | def show_create_table(table: str, catalog: str | None = None, schema: str | None = None) -> str: |
53 | 101 | """Show the CREATE TABLE statement for a table. |
|
0 commit comments