-
Notifications
You must be signed in to change notification settings - Fork 38
GraphQL Plugin: UTCP 1.0 Migration #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
d28dc58
018806c
0f2af7e
d28c0af
7ba8b3c
908cd40
74a11e2
03a4b9f
8443cda
0150a3b
6e2c671
9cea90f
7016987
718b668
ca252e5
45793cf
662d07d
3aed349
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,47 @@ | ||
| Find the UTCP readme at https://github.com/universal-tool-calling-protocol/python-utcp. | ||
|
|
||
| UTCP GraphQL Communication Protocol Plugin | ||
|
|
||
| This plugin integrates GraphQL as a UTCP 1.0 communication protocol and call template. It supports discovery via schema introspection, authenticated calls, and header handling. | ||
|
|
||
| Getting Started | ||
|
|
||
| Installation | ||
|
|
||
| ```bash | ||
| pip install gql | ||
| ``` | ||
|
|
||
| Registration | ||
|
|
||
| ```python | ||
| import utcp_gql | ||
| utcp_gql.register() | ||
| ``` | ||
|
|
||
| How To Use | ||
|
|
||
| - Ensure the plugin is imported and registered: `import utcp_gql; utcp_gql.register()`. | ||
| - Add a manual in your client config: | ||
| ```json | ||
| { | ||
| "name": "my_graph", | ||
| "call_template_type": "graphql", | ||
| "url": "https://your.graphql/endpoint", | ||
| "operation_type": "query", | ||
| "headers": { "x-client": "utcp" }, | ||
| "header_fields": ["x-session-id"] | ||
| } | ||
| ``` | ||
| - Call a tool: | ||
| ```python | ||
| await client.call_tool("my_graph.someQuery", {"id": "123", "x-session-id": "abc"}) | ||
| ``` | ||
|
|
||
| Notes | ||
|
Comment on lines
+6
to
+40
|
||
|
|
||
| - Tool names are prefixed by the manual name (e.g., `my_graph.someQuery`). | ||
| - Headers merge static `headers` plus whitelisted dynamic fields from `header_fields`. | ||
| - Supported auth: API key, Basic auth, OAuth2 (client-credentials). | ||
| - Security: only `https://` or `http://localhost`/`http://127.0.0.1` endpoints. | ||
|
|
||
| For UTCP core docs, see https://github.com/universal-tool-calling-protocol/python-utcp. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| from utcp.plugins.discovery import register_communication_protocol, register_call_template | ||
|
|
||
| from .gql_communication_protocol import GraphQLCommunicationProtocol | ||
| from .gql_call_template import GraphQLProvider, GraphQLProviderSerializer | ||
|
|
||
|
|
||
| def register(): | ||
| register_communication_protocol("graphql", GraphQLCommunicationProtocol()) | ||
| register_call_template("graphql", GraphQLProviderSerializer()) |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,7 +1,10 @@ | ||||||
| from utcp.data.call_template import CallTemplate | ||||||
| from utcp.data.auth import Auth | ||||||
| from utcp.data.call_template import CallTemplate, CallTemplateSerializer | ||||||
|
||||||
| from utcp.data.call_template import CallTemplate, CallTemplateSerializer | |
| from utcp.data.call_template import CallTemplate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The README is missing a title marker (
#) at the top. Line 2 "UTCP GraphQL Communication Protocol Plugin" should be formatted as# UTCP GraphQL Communication Protocol Pluginto render properly as a heading in Markdown.