Skip to content

Commit 8358ba3

Browse files
Update snowflake-mcp.md
1 parent c2253d1 commit 8358ba3

1 file changed

Lines changed: 34 additions & 36 deletions

File tree

  • content/en/docs/marketplace/platform-supported-content/modules/snowflake

content/en/docs/marketplace/platform-supported-content/modules/snowflake/snowflake-mcp.md

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -31,52 +31,50 @@ Alternatively, to start from scratch or to add the capability to an exsiting app
3131
To configure a Snowflake-managed MCP server, follow these steps:
3232

3333
1. In Snowflake, set up the database and schemas which will be used by the server.
34-
<details>
35-
<summary>Expand for example code including some testdata</summary>
34+
35+
The following is a code sample including test data:
3636

37-
```sql
38-
-- You can run this example/demo under sysadmin role, for real production screnario's use proper authorisation
39-
CREATE DATABASE IF NOT EXISTS SNOWFLAKE_MCP_DEMO;
40-
CREATE SCHEMA IF NOT EXISTS SNOWFLAKE_MCP_DEMO.TOOLS;
41-
CREATE SCHEMA IF NOT EXISTS SNOWFLAKE_MCP_DEMO.MCPSERVERS;
42-
CREATE SCHEMA IF NOT EXISTS SNOWFLAKE_MCP_DEMO.TESTDATA;
37+
```sql
38+
-- You can run this example under the Sysadmin role. For real production screnarios, use proper authorisation.
39+
CREATE DATABASE IF NOT EXISTS SNOWFLAKE_MCP_DEMO;
40+
CREATE SCHEMA IF NOT EXISTS SNOWFLAKE_MCP_DEMO.TOOLS;
41+
CREATE SCHEMA IF NOT EXISTS SNOWFLAKE_MCP_DEMO.MCPSERVERS;
42+
CREATE SCHEMA IF NOT EXISTS SNOWFLAKE_MCP_DEMO.TESTDATA;
4343

44-
CREATE OR REPLACE TABLE SNOWFLAKE_MCP_DEMO.TESTDATA.TICKETS (
45-
TICKETID NUMBER AUTOINCREMENT START 1 INCREMENT 1,
46-
PRIORITY VARCHAR(10),
47-
TEXT VARCHAR(500)
48-
);
44+
CREATE OR REPLACE TABLE SNOWFLAKE_MCP_DEMO.TESTDATA.TICKETS (
45+
TICKETID NUMBER AUTOINCREMENT START 1 INCREMENT 1,
46+
PRIORITY VARCHAR(10),
47+
TEXT VARCHAR(500)
48+
);
4949

50-
INSERT INTO SNOWFLAKE_MCP_DEMO.TESTDATA.TICKETS (PRIORITY, TEXT)
51-
VALUES
50+
INSERT INTO SNOWFLAKE_MCP_DEMO.TESTDATA.TICKETS (PRIORITY, TEXT)
51+
VALUES
5252
('High', 'Server is down in production environment'),
5353
('Medium', 'User unable to reset password'),
5454
('Low', 'Request for additional monitor'),
5555
('High', 'Database connection timeout on checkout page'),
5656
('Medium', 'Email notifications not being sent');
57-
```
58-
</details>
57+
```
5958

60-
6159
2. Create the stored procedures which the MCP server will expose as tools.
62-
<details>
63-
<summary>Expand for example code for a generic stored procdure returning meta data</summary>
6460

65-
```sql
66-
-- You can run this example/demo under sysadmin role, for real production screnario's use proper authorisation
67-
CREATE OR REPLACE PROCEDURE SNOWFLAKE_MCP_DEMO.TOOLS.GET_SCHEMA_METADATA(
61+
The following is an example of a generic stored procdure which returns metadata:
62+
63+
```sql
64+
-- You can run this example/demo under sysadmin role, for real production screnario's use proper authorisation
65+
CREATE OR REPLACE PROCEDURE SNOWFLAKE_MCP_DEMO.TOOLS.GET_SCHEMA_METADATA(
6866
db_name VARCHAR,
6967
schema_name VARCHAR
70-
)
71-
RETURNS VARIANT
72-
LANGUAGE PYTHON
73-
RUNTIME_VERSION = '3.11'
74-
PACKAGES = ('snowflake-snowpark-python')
75-
HANDLER = 'run'
76-
AS
77-
$$
78-
import json
79-
def run(session, db_name, schema_name):
68+
)
69+
RETURNS VARIANT
70+
LANGUAGE PYTHON
71+
RUNTIME_VERSION = '3.11'
72+
PACKAGES = ('snowflake-snowpark-python')
73+
HANDLER = 'run'
74+
AS
75+
$$
76+
import json
77+
def run(session, db_name, schema_name):
8078
rows = session.sql(f"""
8179
SELECT
8280
c.TABLE_CATALOG,
@@ -127,9 +125,9 @@ To configure a Snowflake-managed MCP server, follow these steps:
127125
})
128126
return tables
129127
$$;
130-
```
131-
</details>
132-
<details>
128+
```
129+
130+
133131
<summary>Expand for example code for a generic stored procdure for retrieving records</summary>
134132

135133
```sql

0 commit comments

Comments
 (0)