Skip to content

Commit d5662c5

Browse files
committed
fix: add type annotations, fix isError->is_error for pyright
1 parent 4e45055 commit d5662c5

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

  • examples/servers/postgres-knowledge-server/mcp_postgres_server

examples/servers/postgres-knowledge-server/mcp_postgres_server/server.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import json
1717
import os
1818
from pathlib import Path
19+
from typing import Any
1920

2021
import anyio
2122
import click
@@ -60,7 +61,7 @@ def get_conn():
6061
return psycopg2.connect(dbname=PG_DB, user=PG_USER)
6162

6263

63-
def ensure_schema(conn):
64+
def ensure_schema(conn: Any) -> None:
6465
with conn.cursor() as cur:
6566
cur.execute("""
6667
CREATE TABLE IF NOT EXISTS knowledge (
@@ -142,7 +143,7 @@ async def handle_call_tool(ctx: ServerRequestContext, params: types.CallToolRequ
142143
if not authorized(app_id):
143144
return types.CallToolResult(
144145
content=[types.TextContent(type="text", text=f"Unauthorized: no SAFE folder for '{app_id}'")],
145-
isError=True,
146+
is_error=True,
146147
)
147148

148149
try:
@@ -182,7 +183,7 @@ async def handle_call_tool(ctx: ServerRequestContext, params: types.CallToolRequ
182183
else:
183184
return types.CallToolResult(
184185
content=[types.TextContent(type="text", text=f"Unknown tool: {params.name}")],
185-
isError=True,
186+
is_error=True,
186187
)
187188

188189
conn.close()
@@ -191,7 +192,7 @@ async def handle_call_tool(ctx: ServerRequestContext, params: types.CallToolRequ
191192
except Exception as exc:
192193
return types.CallToolResult(
193194
content=[types.TextContent(type="text", text=f"Error: {exc}")],
194-
isError=True,
195+
is_error=True,
195196
)
196197

197198

0 commit comments

Comments
 (0)